4
4
The Blender.Scene submodule.
7
- L{Scene.clearScriptLinks} accepts a parameter now.
8
- L{Scene.getLayers}, L{Scene.setLayers} and the L{layers<Scene.layers>} and
9
L{Layers<Scene.Layers>} Scene attributes.
10
- L{Scene.getActiveObject} method.
75
81
This object gives access to Scene data in Blender.
76
@cvar name: The Scene name.
83
@ivar name: The Scene name.
84
@type Layers: integer (bitmask)
85
@ivar Layers: The Scene layers (check also the easier to use
86
L{layers<Scene.Scene.layers>}). This value is a bitmask with at least
87
one position set for the 20 possible layers starting from the low order
88
bit. The easiest way to deal with these values in in hexadecimal
91
scene.Layers = 0x04 # sets layer 3 ( bit pattern 0100 )
93
print scene.Layers # will print: 5 ( meaning bit pattern 0101)
94
After setting the Layers value, the interface (at least the 3d View and
95
the Buttons window) needs to be redrawn to show the changes.
96
@type layers: list of integers
97
@ivar layers: The Scene layers (check also L{Layers<Scene.Scene.Layers>}).
98
This attribute accepts and returns a list of integer values in the
101
scene.layers = [3] # set layer 3
102
scene.layers = scene.layers.append(1)
103
print scene.layers # will print: [1, 3]
89
116
@param name: The new name.
94
@warn: B{Depricated}: use RenderData.imageSizeX() and RenderData.imageSizeY()
121
Get the layers set for this Scene.
122
@rtype: list of integers
123
@return: a list where each number means the layer with that number is
97
def setWinSize(dimensions):
127
def setLayers(layers):
99
@warn: B{Depricated}: use RenderData.imageSizeX() and RenderData.imageSizeY
129
Set the visible layers for this scene.
130
@type layers: list of integers
131
@param layers: a list of integers in the range [1, 20], where each available
132
index makes the layer with that number visible.
133
@note: if this Scene is the current one, the 3D View layers are also
134
updated, but the screen needs to be redrawn (at least 3D Views and
135
Buttons windows) for the changes to be seen.
102
138
def copy(duplicate_objects = 1):
111
147
@return: The copied Blender Scene.
114
def startFrame(frame = None):
116
@warn: B{Depricated}: use RenderData.startFrame()
119
def endFrame(frame = None):
121
@warn: B{Depricated}: use RenderData.endFrame()
124
def currentFrame(frame = None):
126
@warn: B{Depricated}: use RenderData.currentFrame
129
def frameSettings(start = None, end = None, current = None):
131
@warn: B{Depricated}: use RenderData.startFrame(), RenderData.endFrame, RenderData.currentFrame
134
150
def makeCurrent():
136
152
Make this Scene the currently active one in Blender.
147
163
The "full" update is a recent addition to this method.
166
def getRenderingContext():
168
Get the rendering context for this scene, see L{Render}.
170
@return: the render data object for this scene.
173
def getRadiosityContext():
175
Get the radiosity context for this scene, see L{Radio}.
176
@rtype: Blender Radiosity
177
@return: the radiosity object for this scene.
178
@note: only the current scene can return a radiosity context.
183
Get all objects linked to this Scene.
184
@rtype: list of Blender Objects
185
@return: A list with all Blender Objects linked to this Scene.
186
@note: L{Object.Get} will return all objects currently in Blender, which
187
means all objects from all available scenes. In most cases (exporter
188
scripts, for example), it's probably better to use this
189
scene.GetChildren instead, since it will only access objects from this
193
def getActiveObject():
195
Get this scene's active object.
196
@note: the active object, if selected, can also be retrieved with
197
L{Object.GetSelected} -- it is the first item in the returned
198
list. But even when no object is selected in Blender, there can be
199
an active one (if the user enters editmode, for example, this is the
200
object that should become available for edition). So what makes this
201
scene method different from C{Object.GetSelected()[0]} is that it can
202
return the active object even when no objects are selected.
203
@rtype: Blender Object or None
204
@return: the active object or None if not available.
207
def getCurrentCamera():
209
Get the currently active Camera for this Scene.
210
@rtype: Blender Camera
211
@return: The currently active Camera.
214
def setCurrentCamera(camera):
216
Set the currently active Camera in this Scene.
217
@type camera: Blender Camera
218
@param camera: The new active Camera.
150
221
def link(object):
152
223
Link an Object to this Scene.
160
231
@type object: Blender Object
161
232
@param object: A Blender Object.
235
def getScriptLinks (event):
237
Get a list with this Scene's script links of type 'event'.
239
@param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
241
@return: a list with Blender L{Text} names (the script links of the given
242
'event' type) or None if there are no script links at all.
245
def clearScriptLinks (links = None):
247
Delete script links from this Scene. If no list is specified, all
248
script links are deleted.
249
@type links: list of strings
250
@param links: None (default) or a list of Blender L{Text} names.
253
def addScriptLink (text, event):
255
Add a new script link to this Scene.
257
@param text: the name of an existing Blender L{Text}.
259
@param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
262
def play (mode = 0, win = '<VIEW3D>'):
264
Play a realtime animation. This is the "Play Back Animation" function in
265
Blender, different from playing a sequence of rendered images (for that
266
check L{Render.RenderData.play}).
268
@param mode: controls playing:
269
- 0: keep playing in the biggest 'win' window;
270
- 1: keep playing in all 'win', VIEW3D and SEQ windows;
271
- 2: play once in the biggest VIEW3D;
272
- 3: play once in all 'win', VIEW3D and SEQ windows.
274
@param win: window type, see L{Window.Types}. Only some of them are
275
meaningful here: VIEW3D, SEQ, IPO, ACTION, NLA, SOUND. But the others
276
are also accepted, since this function can be used simply as an
277
interruptible timer. If 'win' is not visible or invalid, VIEW3D is
278
tried, then any bigger visible window.
280
@return: 0 on normal exit or 1 when play back is canceled by user input.