Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active December 20, 2015 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/54410dcbff9b6aa4953d to your computer and use it in GitHub Desktop.
Save zeffii/54410dcbff9b6aa4953d to your computer and use it in GitHub Desktop.
iterating over Image Editors Blender IMAGE_EDITOR
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