Last active
December 20, 2015 13:09
-
-
Save zeffii/54410dcbff9b6aa4953d to your computer and use it in GitHub Desktop.
iterating over Image Editors Blender IMAGE_EDITOR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
images = bpy.data.images | |
# say I know I have 2 images loaded, and 2 IMAGE_EDITORS open | |
# currently none of the image editors are showing any image. | |
loaded_images = images[:] | |
AREA = 'IMAGE_EDITOR' | |
for window in bpy.context.window_manager.windows: | |
for area in window.screen.areas: | |
if not area.type == AREA: | |
continue | |
for s in area.spaces: | |
if s.type == AREA: | |
image_to_use = loaded_images.pop() | |
# s.image is the property you would need to set for each | |
# IMAGE_EDITOR to tell it to display a certain image ( by reference ) | |
s.image = image_to_use | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment