p2or
1/31/2016 - 9:50 PM

The goal of this script is to print the number of Spaces in each area of the current screen in Blender (http://learningblender3dsoftware.blo

The goal of this script is to print the number of Spaces in each area of the current screen in Blender (http://learningblender3dsoftware.blogspot.in)

# http://www.blender.org/documentation/blender_python_api_2_65_3/bpy.types.Area.html
# http://www.blender.org/documentation/blender_python_api_2_65_3/bpy.types.Space.html

import bpy

template_Area = "Area: {0}\n"
template_Space = "\tSpace: {0} {1}\n"

for area in bpy.context.screen.areas:
    print(template_Area.format(area.type))
    spaces = area.spaces
    for space in spaces:
        is_active = "[ACTIVE]" if (space == spaces.active) else ""
        print(template_Space.format(space.type, is_active))

-------------------  OUTPUT ------------------------

Area: INFO

        Space: INFO [ACTIVE]

Area: PROPERTIES

        Space: PROPERTIES [ACTIVE]

Area: CONSOLE

        Space: CONSOLE [ACTIVE]

        Space: TIMELINE

Area: OUTLINER

        Space: OUTLINER [ACTIVE]

Area: TEXT_EDITOR

        Space: TEXT_EDITOR [ACTIVE]

        Space: FILE_BROWSER

        Space: VIEW_3D

Area: VIEW_3D

        Space: VIEW_3D [ACTIVE]