Module Scene
The Blender.Scene submodule.
Scene
This module provides access to Scenes in Blender.
Example:
import Blender
from Blender import Scene, Object, Camera
#
camdata = Camera.New('ortho') # create new camera data
camdata.setName('newCam')
camdata.setLens(16.0)
scene = Scene.New('NewScene') # create a new scene
camobj = Object.New('Camera') # create a new camera object
camobj.link(camdata) # (*) link data to object first
scene.link(camobj) # and then link object to scene
scene.makeCurrent() # make this the current scene
Warning: as done in the example (*), it's recommended to first link object data
to objects and only after that link objects to scene. This is because if
there is no object data linked to an object ob, scene.link(ob) will
automatically create the missing data. This is ok on its own, but if
after that this object is linked to obdata, the automatically created
one will be discarded -- as expected -- but will stay in Blender's memory
space until the program is exited, since Blender doesn't really get rid
of most kinds of data. So first linking obdata to object, then object to
scene is a tiny tiny bit faster than the other way around and also saves
some realtime memory (if many objects are created from scripts, the
savings become important).
Classes |
Scene |
This object gives access to Scene data in Blender. |
Function Summary |
Blender Scene or a list of Blender Scenes
|
Get (name)
Get the Scene(s) from Blender. |
Blender Scene
|
GetCurrent ()
Get the currently active Scene in Blender. |
Blender Scene
|
New (name)
Create a new Scene in Blender. |
|
Unlink (scene)
Unlink (delete) a Scene from Blender. |
Get(name=None)
Get the Scene(s) from Blender.
-
- Parameters:
name -
The name of a Scene.
(type=string)
- Returns:
-
It depends on the name parameter:
-
(name): The Scene with the given name;
-
(): A list with all Scenes currently in Blender.
(type=Blender Scene or a list of Blender Scenes)
|
GetCurrent()
Get the currently active Scene in Blender.
-
- Returns:
-
The currently active Scene.
(type=Blender Scene)
|
New(name='Scene')
Create a new Scene in Blender.
-
- Parameters:
name -
The Scene name.
(type=string)
- Returns:
-
The created Scene.
(type=Blender Scene)
|
Unlink(scene)
Unlink (delete) a Scene from Blender.
-
- Parameters:
scene -
The Scene to be unlinked.
(type=Blender Scene)
|