Module Scene
[frames] | no frames]

Module Scene

The Blender.Scene submodule.

New:

Scene

This module provides access to Scenes in Blender.

Example:

       import Blender
       from Blender import Scene, Object, Camera
       #
       camdata = Camera.New('persp')           # create new camera data
       camdata.name = 'newCam'
       camdata.lens = 16.0
       scene = Scene.New('NewScene')           # create a new scene
       scene.objects.new(camdata,'Camera')     # add a new object to the scene with newly-created data
       scene.makeCurrent()                     # make this the current scene

Warning: scene.objects.new is the preferred way to add new objects to a scene. The older way is to create an object with Object.New(), link the data to the new object, then link the object to the scene. This way is not recommended since a forgotten step or run-time error in the script can cause bad things to be done to Blender's database.

If you use this older method, it's recommended to always perform the operations in this order. 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 object ob 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.
  SceneObjects
This object gives access to the Objects in a Scene in Blender.
Functions
Blender Scene
New(name='Scene')
Create a new Scene in Blender.
Blender Scene or a list of Blender Scenes
Get(name=None)
Get the Scene(s) from Blender.
Blender Scene
GetCurrent()
Get the currently active Scene in Blender.
 
Unlink(scene)
Unlink (delete) a Scene from Blender.
Variables
  __package__ = None
Function Details

New(name='Scene')

 

Create a new Scene in Blender.

Parameters:
  • name (string) - The Scene name.
Returns: Blender Scene
The created Scene.

Get(name=None)

 

Get the Scene(s) from Blender.

Parameters:
  • name (string) - The name of a Scene.
Returns: Blender Scene or a list of Blender Scenes
It depends on the name parameter:
  • (name): The Scene with the given name;
  • (): A list with all Scenes currently in Blender.

GetCurrent()

 

Get the currently active Scene in Blender.

Returns: Blender Scene
The currently active Scene.

Unlink(scene)

 

Unlink (delete) a Scene from Blender.

Parameters:
  • scene (Blender Scene) - The Scene to be unlinked.