Skip to content

Instantly share code, notes, and snippets.

@satishgoda
Last active May 21, 2023 18:21
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 satishgoda/4414757 to your computer and use it in GitHub Desktop.
Save satishgoda/4414757 to your computer and use it in GitHub Desktop.
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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment