Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

January 20, 2015

Screen Areas, Iterate Through

Sometimes I need this but it's a pain to type, so here is how to iterate through current screen areas
import bpy

for window in bpy.context.window_manager.windows:
    for area in window.screen.areas:
        if area.type == 'VIEW_3D':
            print('yes!')
and deeper
import bpy


for window in bpy.context.window_manager.windows:
    for area in window.screen.areas:
        if area.type == 'VIEW_3D':
            print('yes!')
            print(dir(area))
            for space in area.spaces:
                print(space.type)
                if space.type=='VIEW_3D':
                    print(dir(space))

No comments:

Post a Comment

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.