Understanding the user context
The current state of interaction, the current scene, and the selection are available via bpy.context
. Since it depends on the user actions, bpy.context
is read-only; that is, it cannot be changed directly. Anyway, we can affect the state of the current activity via Python. Rather than changing the attributes of bpy.context
, we must look for the selection and activity properties of Blender’s objects, layers, and scenes.
Active scene
A .blend
file, or an unsaved session for that matter, can contain more than one scene. That differs from the standard in 3D packages, where a saved file is equivalent to one scene. If more scenes are available, they can be selected from the list menu at the top right of Blender’s header.
Each scene can contain any of the objects from bpy.data.objects
, and one object can belong to more than one scene. Changes made to an object in one scene retained in the others.
We have seen how to create new objects...