Module Scene :: Class SceneObjects

Class SceneObjects

source code

The SceneObjects (Scene ObjectSeq) object

This object gives access to the Objects in a Scene in Blender.

Example:
       from Blender import Scene
       scn = Scene.GetCurrent()
       
       scn.objects.selected = [] # select none
       scn.objects.selected = scn.objects # select all
       scn.objects.context = scn.objects # select all and move into the scenes display layer
       
       # get a list of mesh objects
       obs = [ob for ob in scn.objects if ob.type == 'Mesh']
       
       # Select only these mesh objects
       scn.objects.selected = obs
       
       # print all object names
       for ob in scn.objects: print ob.name
       
       # make a list of objects that you can add and remove to
       # will not affect the current scene
       scene_obs = list(scn.objects)


Instance Methods
Object
new(data)
Adds a new object to the scene.
source code
None
link(object)
Adds an existing object to the scene.
source code
None
unlink(object)
Removes an object from the scene.
source code
Instance Variables
Object active
the active object in the scene.
Object camera
the active camera in the scene.
sequence of Object context
an iterator over all the visible selected objects in a scene.
sequence of Object selected
an iterator over all the selected objects in a scene.
Method Details

new(data)

source code 
Adds a new object to the scene. Data is either object data such as a Mesh or Curve, or the string "Empty" for an Empty object. The type of the object is determined by the type of the data.
Parameters:
  • data (string or object data) - the object data for the new object
Returns: Object
the new object.

link(object)

source code 
Adds an existing object to the scene. If the object is already linked to the scene, no action is taken and no exception is raised.
Parameters:
  • object (Object) - the object
Returns: None

unlink(object)

source code 
Removes an object from the scene. If the object is not linked to the scene, no action is taken and no exception is raised.
Parameters:
  • object (Object) - the object
Returns: None