29
scn = Blender.Scene.GetCurrent() # get the current scene
30
cam = Blender.Camera.New('ortho') # make ortho camera data object
31
ob = scn.objects.new(cam) # make a new object in this scene using the camera data
32
ob.setLocation (0.0, -5.0, 1.0) # position the object in the scene
29
scn = Blender.Scene.GetCurrent() # get the current scene
30
cam = Blender.Camera.New('ortho') # make ortho camera data object
31
ob = scn.objects.new(cam) # make a new object in this scene using the camera data
32
ob.setLocation (0.0, -5.0, 1.0) # position the object in the scene
34
Blender.Redraw() # redraw the scene to show the updates.
34
Blender.Redraw() # redraw the scene to show the updates.
36
36
@type DrawModes: readonly dictionary
37
37
@var DrawModes: Constant dict used for with L{Object.drawMode} bitfield
38
attribute. Values can be ORed together. Individual bits can also
39
be set/cleared with boolean attributes.
40
- AXIS: Enable display of active object's center and axis.
41
- TEXSPACE: Enable display of active object's texture space.
42
- NAME: Enable display of active object's name.
43
- WIRE: Enable the active object's wireframe over solid drawing.
44
- XRAY: Enable drawing the active object in front of others.
45
- TRANSP: Enable transparent materials for the active object (mesh only).
38
attribute. Values can be ORed together. Individual bits can also
39
be set/cleared with boolean attributes.
40
- AXIS: Enable display of active object's center and axis.
41
- TEXSPACE: Enable display of active object's texture space.
42
- NAME: Enable display of active object's name.
43
- WIRE: Enable the active object's wireframe over solid drawing.
44
- XRAY: Enable drawing the active object in front of others.
45
- TRANSP: Enable transparent materials for the active object (mesh only).
47
47
@type DrawTypes: readonly dictionary
48
48
@var DrawTypes: Constant dict used for with L{Object.drawType} attribute.
49
Only one type can be selected at a time.
50
- BOUNDBOX: Only draw object with bounding box
51
- WIRE: Draw object in wireframe
52
- SOLID: Draw object in solid
53
- SHADED: Draw object with shaded or textured
49
Only one type can be selected at a time.
50
- BOUNDBOX: Only draw object with bounding box
51
- WIRE: Draw object in wireframe
52
- SOLID: Draw object in solid
53
- SHADED: Draw object with shaded or textured
55
55
@type ParentTypes: readonly dictionary
56
56
@var ParentTypes: Constant dict used for with L{Object.parentType} attribute.
57
- OBJECT: Object parent type.
58
- CURVE: Curve deform parent type.
59
- LATTICE: Lattice deform parent type.
60
- ARMATURE: Armature deform parent type.
61
- VERT1: 1 mesh vert parent type.
62
- VERT3: 1 mesh verts parent type.
63
- BONE: Armature bone parent type.
57
- OBJECT: Object parent type.
58
- CURVE: Curve deform parent type.
59
- LATTICE: Lattice deform parent type. Note: This is the same as ARMATURE, 2.43 was released with LATTICE as an invalid value.
60
- ARMATURE: Armature deform parent type.
61
- VERT1: 1 mesh vert parent type.
62
- VERT3: 1 mesh verts parent type.
63
- BONE: Armature bone parent type.
66
66
@type ProtectFlags: readonly dictionary
67
67
@var ProtectFlags: Constant dict used for with L{Object.protectFlags} attribute.
68
Values can be ORed together.
69
- LOCX, LOCY, LOCZ: lock x, y or z location individually
70
- ROTX, ROTY, ROTZ: lock x, y or z rotation individually
71
- SCALEX, SCALEY, SCALEZ: lock x, y or z scale individually
72
- LOC, ROT, SCALE: lock all 3 attributes for location, rotation or scale
68
Values can be ORed together.
69
- LOCX, LOCY, LOCZ: lock x, y or z location individually
70
- ROTX, ROTY, ROTZ: lock x, y or z rotation individually
71
- SCALEX, SCALEY, SCALEZ: lock x, y or z scale individually
72
- LOC, ROT, SCALE: lock all 3 attributes for location, rotation or scale
74
74
@type PITypes: readonly dictionary
75
75
@var PITypes: Constant dict used for with L{Object.piType} attribute.
76
Only one type can be selected at a time.
77
- NONE: No force influence on particles
78
- FORCE: Object center attracts or repels particles ("Spherical")
79
- VORTEX: Particles swirl around Z-axis of the object
80
- WIND: Constant force applied in direction of object Z axis
81
- GUIDE: Use a Curve Path to guide particles
76
Only one type can be selected at a time.
77
- NONE: No force influence on particles
78
- FORCE: Object center attracts or repels particles ("Spherical")
79
- VORTEX: Particles swirl around Z-axis of the object
80
- WIND: Constant force applied in direction of object Z axis
81
- GUIDE: Use a Curve Path to guide particles
83
83
@type RBFlags: readonly dictionary
84
84
@var RBFlags: Constant dict used for with L{Object.rbFlags} attribute.
85
Values can be ORed together.
86
- SECTOR: All game elements should be in the Sector boundbox
87
- PROP: An Object fixed within a sector
88
- BOUNDS: Specify a bounds object for physics
89
- ACTOR: Enables objects that are evaluated by the engine
90
- DYNAMIC: Enables motion defined by laws of physics (requires ACTOR)
91
- GHOST: Enable objects that don't restitute collisions (requires ACTOR)
92
- MAINACTOR: Enables MainActor (requires ACTOR)
93
- RIGIDBODY: Enable rolling physics (requires ACTOR, DYNAMIC)
94
- COLLISION_RESPONSE: Disable auto (de)activation (requires ACTOR, DYNAMIC)
95
- USEFH: Use Fh settings in Materials (requires ACTOR, DYNAMIC)
96
- ROTFH: Use face normal to rotate Object (requires ACTOR, DYNAMIC)
97
- ANISOTROPIC: Enable anisotropic friction (requires ACTOR, DYNAMIC)
85
Values can be ORed together.
86
- SECTOR: All game elements should be in the Sector boundbox
87
- PROP: An Object fixed within a sector
88
- BOUNDS: Specify a bounds object for physics
89
- ACTOR: Enables objects that are evaluated by the engine
90
- DYNAMIC: Enables motion defined by laws of physics (requires ACTOR)
91
- GHOST: Enable objects that don't restitute collisions (requires ACTOR)
92
- MAINACTOR: Enables MainActor (requires ACTOR)
93
- RIGIDBODY: Enable rolling physics (requires ACTOR, DYNAMIC)
94
- COLLISION_RESPONSE: Disable auto (de)activation (requires ACTOR, DYNAMIC)
95
- USEFH: Use Fh settings in Materials (requires ACTOR, DYNAMIC)
96
- ROTFH: Use face normal to rotate Object (requires ACTOR, DYNAMIC)
97
- ANISOTROPIC: Enable anisotropic friction (requires ACTOR, DYNAMIC)
100
@type IpoKeyTypes: readonly dictionary
101
@var IpoKeyTypes: Constant dict used for with L{Object.insertIpoKey} attribute.
102
Values can be ORed together.
100
114
@type RBShapes: readonly dictionary
101
115
@var RBShapes: Constant dict used for with L{Object.rbShapeBoundType}
102
attribute. Only one type can be selected at a time. Values are
103
BOX, SPHERE, CYLINDER, CONE, and POLYHEDERON
116
attribute. Only one type can be selected at a time. Values are
117
BOX, SPHERE, CYLINDER, CONE, and POLYHEDERON
107
121
def New (type, name='type'):
109
Creates a new Object. Deprecated; instead use Scene.objects.new().
111
@param type: The Object type: 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
112
'Mball', 'Mesh', 'Surf' or 'Empty'.
114
@param name: The name of the object. By default, the name will be the same
116
If the name is already in use, this new object will have a number at the end of the name.
117
@return: The created Object.
121
The example below creates a new Lamp object and puts it at the default
122
location (0, 0, 0) in the current scene::
125
object = Blender.Object.New('Lamp')
126
lamp = Blender.Lamp.New('Spot')
128
scene = Blender.Scene.GetCurrent()
132
@Note: if an object is created but is not linked to object data, and the
133
object is not linked to a scene, it will be deleted when the Python
134
object is deallocated. This is because Blender does not allow objects
135
to exist without object data unless they are Empty objects. Scene.link()
136
will automatically create object data for an object if it has none.
123
Creates a new Object. Deprecated; instead use Scene.objects.new().
125
@param type: The Object type: 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
126
'Mball', 'Mesh', 'Surf' or 'Empty'.
128
@param name: The name of the object. By default, the name will be the same
130
If the name is already in use, this new object will have a number at the end of the name.
131
@return: The created Object.
135
The example below creates a new Lamp object and puts it at the default
136
location (0, 0, 0) in the current scene::
139
object = Blender.Object.New('Lamp')
140
lamp = Blender.Lamp.New('Spot')
142
sce = Blender.Scene.GetCurrent()
146
@Note: if an object is created but is not linked to object data, and the
147
object is not linked to a scene, it will be deleted when the Python
148
object is deallocated. This is because Blender does not allow objects
149
to exist without object data unless they are Empty objects. Scene.link()
150
will automatically create object data for an object if it has none.
139
153
def Get (name = None):
141
Get the Object from Blender.
143
@param name: The name of the requested Object.
144
@return: It depends on the 'name' parameter:
145
- (name): The Object with the given name;
146
- (): A list with all Objects in the current scene.
150
The example below works on the default scene. The script returns the plane object and prints the location of the plane::
153
object = Blender.Object.Get ('plane')
154
print object.getLocation()
158
The example below works on the default scene. The script returns all objects
159
in the scene and prints the list of object names::
162
objects = Blender.Object.Get ()
164
@note: Get will return objects from all scenes.
165
Most user tools should only operate on objects from the current scene - Blender.Scene.GetCurrent().getChildren()
155
Get the Object from Blender.
157
@param name: The name of the requested Object.
158
@return: It depends on the 'name' parameter:
159
- (name): The Object with the given name;
160
- (): A list with all Objects in the current scene.
164
The example below works on the default scene. The script returns the plane object and prints the location of the plane::
167
object = Blender.Object.Get ('plane')
168
print object.getLocation()
172
The example below works on the default scene. The script returns all objects
173
in the scene and prints the list of object names::
176
objects = Blender.Object.Get ()
178
@note: Get will return objects from all scenes.
179
Most user tools should only operate on objects from the current scene - Blender.Scene.GetCurrent().getChildren()
168
182
def GetSelected ():
170
Get the user selection. If no objects are selected, an empty list will be returned.
172
@return: A list of all selected Objects in the current scene.
176
The example below works on the default scene. Select one or more objects and
177
the script will print the selected objects::
180
objects = Blender.Object.GetSelected()
182
@note: The active object will always be the first object in the list (if selected).
183
@note: The user selection is made up of selected objects from Blender's current scene only.
184
@note: The user selection is limited to objects on visible layers;
185
if the user's last active 3d view is in localview then the selection will be limited to the objects in that localview.
184
Get the user selection. If no objects are selected, an empty list will be returned.
186
@return: A list of all selected Objects in the current scene.
190
The example below works on the default scene. Select one or more objects and
191
the script will print the selected objects::
194
objects = Blender.Object.GetSelected()
196
@note: The active object will always be the first object in the list (if selected).
197
@note: The user selection is made up of selected objects from Blender's current scene only.
198
@note: The user selection is limited to objects on visible layers;
199
if the user's last active 3d view is in localview then the selection will be limited to the objects in that localview.
189
203
def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=0, material=0, texture=0, ipo=0):
191
Duplicate selected objects on visible layers from Blenders current scene,
192
de-selecting the currently visible, selected objects and making a copy where all new objects are selected.
193
By default no data linked to the object is duplicated; use the keyword arguments to change this.
194
L{Object.GetSelected()<GetSelected>} will return the list of objects resulting from duplication.
197
@param mesh: When non-zero, mesh object data will be duplicated with the objects.
199
@param surface: When non-zero, surface object data will be duplicated with the objects.
201
@param curve: When non-zero, curve object data will be duplicated with the objects.
203
@param text: When non-zero, text object data will be duplicated with the objects.
205
@param metaball: When non-zero, metaball object data will be duplicated with the objects.
207
@param armature: When non-zero, armature object data will be duplicated with the objects.
209
@param lamp: When non-zero, lamp object data will be duplicated with the objects.
211
@param material: When non-zero, materials used by the object or its object data will be duplicated with the objects.
213
@param texture: When non-zero, texture data used by the object's materials will be duplicated with the objects.
215
@param ipo: When non-zero, Ipo data linked to the object will be duplicated with the objects.
219
The example below creates duplicates the active object 10 times
220
and moves each object 1.0 on the X axis::
223
scn = Scene.GetCurrent()
224
ob_act = scn.objects.active
227
scn.objects.selected = []
231
Blender.Object.Duplicate() # Duplicate linked
232
ob_act = scn.objects.active
205
Duplicate selected objects on visible layers from Blenders current scene,
206
de-selecting the currently visible, selected objects and making a copy where all new objects are selected.
207
By default no data linked to the object is duplicated; use the keyword arguments to change this.
208
L{Object.GetSelected()<GetSelected>} will return the list of objects resulting from duplication.
210
B{Note}: This command will raise an error if used from the command line (background mode) because it uses the 3D view context.
213
@param mesh: When non-zero, mesh object data will be duplicated with the objects.
215
@param surface: When non-zero, surface object data will be duplicated with the objects.
217
@param curve: When non-zero, curve object data will be duplicated with the objects.
219
@param text: When non-zero, text object data will be duplicated with the objects.
221
@param metaball: When non-zero, metaball object data will be duplicated with the objects.
223
@param armature: When non-zero, armature object data will be duplicated with the objects.
225
@param lamp: When non-zero, lamp object data will be duplicated with the objects.
227
@param material: When non-zero, materials used by the object or its object data will be duplicated with the objects.
229
@param texture: When non-zero, texture data used by the object's materials will be duplicated with the objects.
231
@param ipo: When non-zero, Ipo data linked to the object will be duplicated with the objects.
235
The example below creates duplicates the active object 10 times
236
and moves each object 1.0 on the X axis::
239
scn = Scene.GetCurrent()
240
ob_act = scn.objects.active
243
scn.objects.selected = []
247
Blender.Object.Duplicate() # Duplicate linked
248
ob_act = scn.objects.active
237
253
from IDProp import IDGroup, IDArray
242
This object gives access to generic data from all objects in Blender.
245
When dealing with properties and functions such as LocX/RotY/getLocation(), getSize() and getEuler(),
246
keep in mind that these transformation properties are relative to the object's parent (if any).
248
To get these values in worldspace (taking into account vertex parents, constraints, etc.)
249
pass the argument 'worldspace' to these functions.
251
@ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
252
object's ID Properties.
253
@type properties: L{IDGroup<IDProp.IDGroup>}
254
@ivar restrictDisplay: Don't display this object in the 3D view: disabled by default, use the outliner to toggle.
255
@type restrictDisplay: bool
256
@ivar restrictSelect: Don't select this object in the 3D view: disabled by default, use the outliner to toggle.
257
@type restrictSelect: bool
258
@ivar restrictRender: Don't render this object: disabled by default, use the outliner to toggle.
259
@type restrictRender: bool
260
@ivar LocX: The X location coordinate of the object.
262
@ivar LocY: The Y location coordinate of the object.
264
@ivar LocZ: The Z location coordinate of the object.
266
@ivar loc: The (X,Y,Z) location coordinates of the object.
267
@type loc: tuple of 3 floats
268
@ivar dLocX: The delta X location coordinate of the object.
269
This variable applies to IPO Objects only.
271
@ivar dLocY: The delta Y location coordinate of the object.
272
This variable applies to IPO Objects only.
274
@ivar dLocZ: The delta Z location coordinate of the object.
275
This variable applies to IPO Objects only.
277
@ivar dloc: The delta (X,Y,Z) location coordinates of the object (vector).
278
This variable applies to IPO Objects only.
279
@type dloc: tuple of 3 floats
280
@ivar RotX: The X rotation angle (in radians) of the object.
282
@ivar RotY: The Y rotation angle (in radians) of the object.
284
@ivar RotZ: The Z rotation angle (in radians) of the object.
286
@ivar rot: The (X,Y,Z) rotation angles (in radians) of the object.
287
@type rot: euler (Py_WRAPPED)
288
@ivar dRotX: The delta X rotation angle (in radians) of the object.
289
This variable applies to IPO Objects only.
291
@ivar dRotY: The delta Y rotation angle (in radians) of the object.
292
This variable applies to IPO Objects only.
294
@ivar dRotZ: The delta Z rotation angle (in radians) of the object.
295
This variable applies to IPO Objects only.
297
@ivar drot: The delta (X,Y,Z) rotation angles (in radians) of the object.
298
This variable applies to IPO Objects only.
299
@type drot: tuple of 3 floats
300
@ivar SizeX: The X size of the object.
302
@ivar SizeY: The Y size of the object.
304
@ivar SizeZ: The Z size of the object.
306
@ivar size: The (X,Y,Z) size of the object.
307
@type size: tuple of 3 floats
308
@ivar dSizeX: The delta X size of the object.
310
@ivar dSizeY: The delta Y size of the object.
312
@ivar dSizeZ: The delta Z size of the object.
314
@ivar dsize: The delta (X,Y,Z) size of the object.
315
@type dsize: tuple of 3 floats
316
@ivar Layers: The object layers (also check the newer attribute
317
L{layers<layers>}). This value is a bitmask with at
318
least one position set for the 20 possible layers starting from the low
319
order bit. The easiest way to deal with these values in in hexadecimal
322
ob.Layer = 0x04 # sets layer 3 ( bit pattern 0100 )
323
After setting the Layer value, call Blender.Redraw( -1 ) to update
325
@type Layers: integer (bitmask)
326
@type layers: list of integers
327
@ivar layers: The layers this object is visible in (also check the older
328
attribute L{Layers<Layers>}). This returns a list of
329
integers in the range [1, 20], each number representing the respective
330
layer. Setting is done by passing a list of ints or an empty list for
333
ob.layers = [] # object won't be visible
334
ob.layers = [1, 4] # object visible only in layers 1 and 4
338
print ob.layers # will print: [1, 4, 10]
339
B{Note}: changes will only be visible after the screen (at least
340
the 3d View and Buttons windows) is redrawn.
341
@ivar parent: The parent object of the object (if defined). Read-only.
342
@type parent: Object or None
343
@ivar data: The Datablock object linked to this object. Read-only.
345
@ivar ipo: Contains the Ipo if one is assigned to the object, B{None}
346
otherwise. Setting to B{None} clears the current Ipo.
348
@ivar mat: The matrix of the object in world space (absolute, takes vertex parents, tracking
349
and Ipos into account). Read-only.
351
@ivar matrix: Same as L{mat}. Read-only.
353
@ivar matrixLocal: The matrix of the object relative to its parent; if there is no parent,
354
returns the world matrix (L{matrixWorld<Object.Object.matrixWorld>}).
355
@type matrixLocal: Matrix
356
@ivar matrixOldWorld: Old-type worldspace matrix (prior to Blender 2.34).
358
@type matrixOldWorld: Matrix
359
@ivar matrixWorld: Same as L{mat}. Read-only.
360
@type matrixWorld: Matrix
361
@ivar colbits: The Material usage mask. A set bit #n means: the Material
362
#n in the Object's material list is used. Otherwise, the Material #n
363
of the Objects Data material list is displayed.
365
object.colbits = (1<<0) + (1<<5) # use mesh materials 0 (1<<0) and 5 (1<<5)
366
# use object materials for all others
367
@ivar sel: The selection state of the object in the current scene.
368
True is selected, False is unselected. Setting makes the object active.
370
@ivar effects: The list of particle effects associated with the object.
372
@type effects: list of Effect objects
373
@ivar parentbonename: The string name of the parent bone (if defined).
374
This can be set to another bone in the armature if the object already has a bone parent.
375
@type parentbonename: string or None
376
@ivar protectFlags: The "transform locking" bitfield flags for the object.
377
See L{ProtectFlags} const dict for values.
378
@type protectFlags: int
379
@ivar DupGroup: The DupliGroup Animation Property. Assign a group to
380
DupGroup to make this object an instance of that group.
381
This does not enable or disable the DupliGroup option, for that use
383
The attribute returns None when this object does not have a dupliGroup,
384
and setting the attrbute to None deletes the object from the group.
385
@type DupGroup: Group or None
386
@ivar DupObjects: The Dupli object instances. Read-only.
387
Returns of list of tuples for object duplicated
388
by dupliframe, dupliverts dupligroups and other animation properties.
389
The first tuple item is the original object that is duplicated,
390
the second is the 4x4 worldspace dupli-matrix.
393
from Blender import Object, Scene, Mathutils
395
ob= Object.Get('Cube')
396
dupe_obs= ob.DupObjects
397
scn= Scene.GetCurrent()
398
for dupe_ob, dupe_matrix in dupe_obs:
400
empty_ob = scn.objects.new('Empty')
401
empty_ob.setMatrix(dupe_matrix)
403
@type DupObjects: list of tuples containing (object, matrix)
404
@ivar enableNLAOverride: Whether the object uses NLA or active Action for animation.
405
@type enableNLAOverride: boolean
406
@ivar enableDupVerts: The DupliVerts status of the object.
407
Does not indicate that this object has any dupliVerts,
408
(as returned by L{DupObjects}) just that dupliVerts are enabled.
409
@type enableDupVerts: boolean
410
@ivar enableDupFaces: The DupliFaces status of the object.
411
Does not indicate that this object has any dupliFaces,
412
(as returned by L{DupObjects}) just that dupliFaces are enabled.
413
@type enableDupFaces: boolean
414
@ivar enableDupFacesScale: The DupliFacesScale status of the object.
415
@type enableDupFacesScale: boolean
416
@ivar enableDupFrames: The DupliFrames status of the object.
417
Does not indicate that this object has any dupliFrames,
418
(as returned by L{DupObjects}) just that dupliFrames are enabled.
419
@type enableDupFrames: boolean
420
@ivar enableDupGroup: The DupliGroup status of the object.
421
Set True to make this object an instance of the object's L{DupGroup},
422
and set L{DupGroup} to a group for this to take effect,
423
Use L{DupObjects} to get the object data from this instance.
424
@type enableDupGroup: boolean
425
@ivar enableDupRot: The DupliRot status of the object.
426
Use with L{enableDupVerts} to rotate each instance
427
by the vertex normal.
428
@type enableDupRot: boolean
429
@ivar enableDupNoSpeed: The DupliNoSpeed status of the object.
430
Use with L{enableDupFrames} to ignore dupliFrame speed.
431
@type enableDupNoSpeed: boolean
432
@ivar DupSta: The DupliFrame starting frame. Use with L{enableDupFrames}.
433
Value clamped to [1,32767].
435
@ivar DupEnd: The DupliFrame end frame. Use with L{enableDupFrames}.
436
Value clamped to [1,32767].
438
@ivar DupOn: The DupliFrames in succession between DupOff frames.
439
Value is clamped to [1,1500].
440
Use with L{enableDupFrames} and L{DupOff} > 0.
442
@ivar DupOff: The DupliFrame removal of every Nth frame for this object.
443
Use with L{enableDupFrames}. Value is clamped to [0,1500].
445
@ivar passIndex: Index # for the IndexOB render pass.
446
Value is clamped to [0,1000].
448
@ivar activeMaterial: The active material index for this object.
450
The active index is used to select the material to edit in the material buttons,
451
new data created will also use the active material.
453
Value is clamped to [1,len(ob.materials)]. - [0,0] when there is no materials applied to the object.
454
@type activeMaterial: int
455
@ivar drawSize: The size to display the Empty.
456
Value clamped to [0.01,10.0].
457
@type drawSize: float
458
@ivar modifiers: The modifiers associated with the object.
460
# copy the active objects modifiers to all other visible selected objects
461
from Blender import *
462
scn = Scene.GetCurrent()
463
ob_act = scn.objects.active
464
for ob in scn.objects.context:
465
# Cannot copy modifiers to an object of a different type
466
if ob.type == ob_act.type:
467
ob.modifiers = ob_act.modifiers
468
@type modifiers: L{Modifier Sequence<Modifier.ModSeq>}
469
@ivar constraints: a L{sequence<Constraint.Constraints>} of
470
L{constraints<Constraint.Constraint>} for the object. Read-only.
471
@type constraints: Constraint Sequence
472
@ivar actionStrips: a L{sequence<NLA.ActionStrips>} of
473
L{action strips<NLA.ActionStrip>} for the object. Read-only.
474
@type actionStrips: BPy_ActionStrips
475
@ivar action: The action associated with this object (if defined).
477
@type action: L{Action<NLA.Action>} or None
478
@ivar name: Object data name. Maximum length 20 characters.
480
@ivar oopsLoc: Object's (X,Y) OOPs location. Returns None if object
481
is not found in list.
482
@type oopsLoc: tuple of 2 floats
483
@ivar oopsSel: Object OOPs selection flag.
484
@type oopsSel: boolean
485
@ivar game_properties: The object's properties. Read-only.
486
@type game_properties: list of Properties.
487
@ivar timeOffset: The time offset of the object's animation.
488
Value clamped to [-300000.0,300000.0].
489
@type timeOffset: float
490
@ivar track: The object's tracked object. B{None} is returned if no
491
object is tracked. Also, assigning B{None} clear the tracked object.
492
@type track: Object or None
493
@ivar type: The object's type. Read-only.
495
@ivar users: The number of users of the object. Read-only.
497
@ivar fakeUser: The fake user status.
498
Enabling this will keep it in the blend even if there are no users.
500
@ivar boundingBox: The bounding box of this object. Read-only.
501
@type boundingBox: list of 8 3D vectors
502
@ivar drawType: The object's drawing type.
503
See L{DrawTypes} constant dict for values.
505
@ivar parentType: The object's parent type. Read-only.
506
See L{ParentTypes} constant dict for values.
507
@type parentType: int
508
@ivar axis: Enable display of active object's center and axis.
509
Also see B{AXIS} bit in L{drawMode} attribute.
511
@ivar texSpace: Enable display of active object's texture space.
512
Also see B{TEXSPACE} bit in L{drawMode} attribute.
513
@type texSpace: boolean
514
@ivar nameMode: Enable display of active object's name.
515
Also see B{NAME} bit in L{drawMode} attribute.
516
@type nameMode: boolean
517
@ivar wireMode: Enable the active object's wireframe over solid drawing.
518
Also see B{WIRE} bit in L{drawMode} attribute.
519
@type wireMode: boolean
520
@ivar xRay: Enable drawing the active object in front of others.
521
Also see B{XRAY} bit in L{drawMode} attribute.
523
@ivar transp: Enable transparent materials for the active object
524
(mesh only). Also see B{TRANSP} bit in L{drawMode} attribute.
525
@type transp: boolean
526
@ivar drawMode: The object's drawing mode bitfield.
527
See L{DrawModes} constant dict for values.
530
@ivar piType: Type of particle interaction.
531
See L{PITypes} constant dict for values.
533
@ivar piFalloff: The particle interaction falloff power.
534
Value clamped to [0.0,10.0].
535
@type piFalloff: float
536
@ivar piMaxDist: Max distance for the particle interaction field to work.
537
Value clamped to [0.0,1000.0].
538
@type piMaxDist: float
539
@ivar piPermeability: Probability that a particle will pass through the
540
mesh. Value clamped to [0.0,1.0].
541
@type piPermeability: float
542
@ivar piRandomDamp: Random variation of particle interaction damping.
543
Value clamped to [0.0,1.0].
544
@type piRandomDamp: float
545
@ivar piSoftbodyDamp: Damping factor for softbody deflection.
546
Value clamped to [0.0,1.0].
547
@type piSoftbodyDamp: float
548
@ivar piSoftbodyIThick: Inner face thickness for softbody deflection.
549
Value clamped to [0.001,1.0].
550
@type piSoftbodyIThick: float
551
@ivar piSoftbodyOThick: Outer face thickness for softbody deflection.
552
Value clamped to [0.001,1.0].
553
@type piSoftbodyOThick: float
554
@ivar piStrength: Particle interaction force field strength.
555
Value clamped to [0.0,1000.0].
556
@type piStrength: float
557
@ivar piSurfaceDamp: Amount of damping during particle collision.
558
Value clamped to [0.0,1.0].
559
@type piSurfaceDamp: float
560
@ivar piUseMaxDist: Use a maximum distance for the field to work.
561
@type piUseMaxDist: boolean
563
@ivar isSoftBody: True if object is a soft body. Read-only.
564
@type isSoftBody: boolean
565
@ivar SBDefaultGoal: Default softbody goal value, when no vertex group used.
566
Value clamped to [0.0,1.0].
567
@type SBDefaultGoal: float
568
@ivar SBErrorLimit: Softbody Runge-Kutta ODE solver error limit (low values give more precision).
569
Value clamped to [0.01,1.0].
570
@type SBErrorLimit: float
571
@ivar SBFriction: General media friction for softbody point movements.
572
Value clamped to [0.0,10.0].
573
@type SBFriction: float
574
@ivar SBGoalFriction: Softbody goal (vertex target position) friction.
575
Value clamped to [0.0,10.0].
576
@type SBGoalFriction: float
577
@ivar SBGoalSpring: Softbody goal (vertex target position) spring stiffness.
578
Value clamped to [0.0,0.999].
579
@type SBGoalSpring: float
580
@ivar SBGrav: Apply gravitation to softbody point movement.
581
Value clamped to [0.0,10.0].
583
@ivar SBInnerSpring: Softbody edge spring stiffness.
584
Value clamped to [0.0,0.999].
585
@type SBInnerSpring: float
586
@ivar SBInnerSpringFrict: Softbody edge spring friction.
587
Value clamped to [0.0,10.0].
588
@type SBInnerSpringFrict: float
589
@ivar SBMass: Softbody point mass (heavier is slower).
590
Value clamped to [0.001,50.0].
592
@ivar SBMaxGoal: Softbody goal maximum (vertex group weights scaled to
593
match this range). Value clamped to [0.0,1.0].
594
@type SBMaxGoal: float
595
@ivar SBMinGoal: Softbody goal minimum (vertex group weights scaled to
596
match this range). Value clamped to [0.0,1.0].
597
@type SBMinGoal: float
598
@ivar SBSpeed: Tweak timing for physics to control softbody frequency and
599
speed. Value clamped to [0.0,10.0].
601
@ivar SBStiffQuads: Softbody adds diagonal springs on 4-gons enabled.
602
@type SBStiffQuads: boolean
603
@ivar SBUseEdges: Softbody use edges as springs enabled.
604
@type SBUseEdges: boolean
605
@ivar SBUseGoal: Softbody forces for vertices to stick to animated position enabled.
606
@type SBUseGoal: boolean
608
@ivar rbFlags: Rigid body bitfield. See L{RBFlags} for valid values.
610
@ivar rbMass: Rigid body mass. Must be a positive value.
612
@ivar rbRadius: Rigid body bounding sphere size. Must be a positive
614
@type rbRadius: float
615
@ivar rbShapeBoundType: Rigid body shape bound type. See L{RBShapes}
616
const dict for values.
617
@type rbShapeBoundType: int
622
Recomputes the particle system. This method only applies to an Object of
626
def insertShapeKey():
628
Insert a Shape Key in the current object. It applies to Objects of
629
the type Mesh, Lattice, or Curve.
634
Gets the current Pose of the object.
636
@return: the current pose object
639
def evaluatePose(framenumber):
641
Evaluates the Pose based on its currently bound action at a certain frame.
642
@type framenumber: Int
643
@param framenumber: The frame number to evaluate to.
648
Unlinks the ipo from this object.
649
@return: True if there was an ipo linked or False otherwise.
652
def clrParent(mode = 0, fast = 0):
654
Clears parent object.
657
@param mode: A mode flag. If mode flag is 2, then the object transform will
658
be kept. Any other value, or no value at all will update the object
660
@param fast: If the value is 0, the scene hierarchy will not be updated. Any
661
other value, or no value at all will update the scene hierarchy.
664
def getData(name_only=False, mesh=False):
666
Returns the Datablock object (Mesh, Lamp, Camera, etc.) linked to this
667
Object. If the keyword parameter B{name_only} is True, only the Datablock
668
name is returned as a string. It the object is of type Mesh, then the
669
B{mesh} keyword can also be used; the data return is a Mesh object if
670
True, otherwise it is an NMesh object (the default).
671
The B{mesh} keyword is ignored for non-mesh objects.
672
@type name_only: bool
673
@param name_only: This is a keyword parameter. If True (or nonzero),
674
only the name of the data object is returned.
676
@param mesh: This is a keyword parameter. If True (or nonzero),
677
a Mesh data object is returned.
678
@rtype: specific Object type or string
679
@return: Depends on the type of Datablock linked to the Object. If
680
B{name_only} is True, it returns a string.
681
@note: Mesh is faster than NMesh because Mesh is a thin wrapper.
682
@note: This function is different from L{NMesh.GetRaw} and L{Mesh.Get}
683
because it keeps a link to the original mesh, which is needed if you are
684
dealing with Mesh weight groups.
685
@note: Make sure the object you are getting the data from isn't in
686
EditMode before calling this function; otherwise you'll get the data
687
before entering EditMode. See L{Window.EditMode}.
690
def getParentBoneName():
692
Returns None, or the 'sub-name' of the parent (eg. Bone name)
696
def getDeltaLocation():
698
Returns the object's delta location in a list (x, y, z)
699
@rtype: A vector triple
705
Returns the object draw mode.
707
@return: a sum of the following:
718
Returns the object draw type
720
@return: One of the following:
731
@param space: The desired space for the size:
732
- localspace: (default) relative to the object's parent;
733
- worldspace: absolute, taking vertex parents, tracking and
735
Returns the object's localspace rotation as Euler rotation vector (rotX, rotY, rotZ). Angles are in radians.
737
@return: A python Euler. Data is wrapped when euler is present.
740
def getInverseMatrix():
742
Returns the object's inverse matrix.
744
@return: A python matrix 4x4
749
Returns the Ipo associated to this object or None if there's no linked ipo.
751
@return: the wrapped ipo or None.
755
Returns the objects selection state in the current scene as a boolean value True or False.
757
@return: Selection state as True or False
760
def getLocation(space):
763
@param space: The desired space for the location:
764
- localspace: (default) relative to the object's parent;
765
- worldspace: absolute, taking vertex parents, tracking and
767
Returns the object's location (x, y, z).
772
The example below works on the default scene. It retrieves all objects in
773
the scene and prints the name and location of each object::
776
objects = Blender.Object.Get()
780
print obj.getLocation()
781
@note: the worldspace location is the same as ob.matrixWorld[3][0:3]
786
Returns an action if one is associated with this object (only useful for armature types).
788
@return: a python action.
791
def getMaterials(what = 0):
793
Returns a list of materials assigned to the object.
795
@param what: if nonzero, empty slots will be returned as None's instead
796
of being ignored (default way). See L{NMesh.NMesh.getMaterials}.
797
@rtype: list of Material Objects
798
@return: list of Material Objects assigned to the object.
801
def getMatrix(space = 'worldspace'):
803
Returns the object matrix.
805
@param space: The desired matrix:
806
- worldspace (default): absolute, taking vertex parents, tracking and
808
- localspace: relative to the object's parent (returns worldspace
809
matrix if the object doesn't have a parent);
810
- old_worldspace: old behavior, prior to Blender 2.34, where eventual
811
changes made by the script itself were not taken into account until
812
a redraw happened, either called by the script or upon its exit.
813
Returns the object matrix.
814
@rtype: Py_Matrix (WRAPPED DATA)
815
@return: a python 4x4 matrix object. Data is wrapped for 'worldspace'
820
Returns the name of the object
821
@return: The name of the object
825
The example below works on the default scene. It retrieves all objects in
826
the scene and prints the name of each object::
829
scn= Blender.Scene.GetCurrent()
830
objects = scn.getChildren()
838
Returns the object's parent object.
840
@return: The parent object of the object. If not available, None will be
847
@param space: The desired space for the size:
848
- localspace: (default) relative to the object's parent;
849
- worldspace: absolute, taking vertex parents, tracking and
851
Returns the object's size.
852
@return: (SizeX, SizeY, SizeZ)
853
@note: the worldspace size will not return negative (flipped) scale values.
856
def getParentBoneName():
858
Returns the object's parent object's sub name, or None.
859
For objects parented to bones, this is the name of the bone.
861
@return: The parent object sub-name of the object.
862
If not available, None will be returned.
867
Returns the time offset of the object's animation.
873
Returns the object's tracked object.
875
@return: The tracked object of the object. If not available, None will be
881
Returns the type of the object in 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
882
'Mball', 'Mesh', 'Surf', 'Empty', 'Wave' (deprecated) or 'unknown' in exceptional cases.
886
The example below works on the default scene. It retrieves all objects in
887
the scene and updates the location and rotation of the camera. When run,
888
the camera will rotate 180 degrees and moved to the opposite side of the X
889
axis. Note that the number 'pi' in the example is an approximation of the
890
true number 'pi'. A better, less error-prone value of pi is math.pi from the python math module.::
893
objects = Blender.Object.Get()
896
if obj.getType() == 'Camera':
898
obj.RotZ = 3.141592 - obj.RotZ
902
@return: The type of object.
906
def insertIpoKey(keytype):
908
Inserts keytype values in object ipo at curframe. Uses module constants.
909
@type keytype: Integer
926
Links Object with ObData datablock provided in the argument. The data must match the
927
Object's type, so you cannot link a Lamp to a Mesh type object.
928
@type datablock: Blender ObData datablock
929
@param datablock: A Blender datablock matching the objects type.
932
def makeParent(objects, noninverse = 0, fast = 0):
934
Makes the object the parent of the objects provided in the argument which
935
must be a list of valid Objects.
936
@type objects: Sequence of Blender Object
937
@param objects: The children of the parent
938
@type noninverse: Integer
940
0 - make parent with inverse
941
1 - make parent without inverse
944
0 - update scene hierarchy automatically
945
1 - don't update scene hierarchy (faster). In this case, you must
946
explicitely update the Scene hierarchy.
947
@warn: objects must first be linked to a scene before they can become
948
parents of other objects. Calling this makeParent method for an
949
unlinked object will result in an error.
954
Uses the object as a base for all of the objects in the provided list to join into.
956
@type objects: Sequence of Blender Object
957
@param objects: A list of objects matching the object's type.
958
@note: Objects in the list will not be removed from the scene.
959
To avoid overlapping data you may want to remove them manually after joining.
960
@note: Join modifies the base object's data in place so that
961
other objects are joined into it. No new object or data is created.
962
@note: Join will only work for object types Mesh, Armature, Curve and Surface;
963
an excption will be raised if the object is not of these types.
964
@note: Objects in the list will be ignored if they to not match the base object.
965
@note: The base object must be in the current scene to be joined.
966
@note: This function will not work in background mode (no user interface).
967
@note: An error in the function input will raise a TypeError or AttributeError,
968
otherwise an error in the data input will raise a RuntimeError.
969
For situations where you don't have tight control on the data that is being joined,
970
you should handle the RuntimeError error, letting the user know the data can't be joined.
973
def makeParentDeform(objects, noninverse = 0, fast = 0):
975
Makes the object the deformation parent of the objects provided in the argument
976
which must be a list of valid Objects.
977
The parent object must be a Curve or Armature.
978
@type objects: Sequence of Blender Object
979
@param objects: The children of the parent
980
@type noninverse: Integer
982
0 - make parent with inverse
983
1 - make parent without inverse
986
0 - update scene hierarchy automatically
987
1 - don't update scene hierarchy (faster). In this case, you must
988
explicitely update the Scene hierarchy.
989
@warn: objects must first be linked to a scene before they can become
990
parents of other objects. Calling this makeParent method for an
991
unlinked object will result in an error.
992
@warn: child objects must be of mesh type to deform correctly. Other object
993
types will fall back to normal parenting silently.
996
def makeParentVertex(objects, indices, noninverse = 0, fast = 0):
998
Makes the object the vertex parent of the objects provided in the argument
999
which must be a list of valid Objects.
1000
The parent object must be a Mesh, Curve or Surface.
1001
@type objects: Sequence of Blender Object
1002
@param objects: The children of the parent
1003
@type indices: Tuple of Integers
1004
@param indices: The indices of the vertices you want to parent to (1 or 3 values)
1005
@type noninverse: Integer
1007
0 - make parent with inverse
1008
1 - make parent without inverse
1011
0 - update scene hierarchy automatically
1012
1 - don't update scene hierarchy (faster). In this case, you must
1013
explicitely update the Scene hierarchy.
1014
@warn: objects must first be linked to a scene before they can become
1015
parents of other objects. Calling this makeParent method for an
1016
unlinked object will result in an error.
1018
def makeParentBone(objects, bonename, noninverse = 0, fast = 0):
1020
Makes one of the object's bones the parent of the objects provided in the argument
1021
which must be a list of valid objects. The parent object must be an Armature.
1022
@type objects: Sequence of Blender Object
1023
@param objects: The children of the parent
1024
@type bonename: string
1025
@param bonename: a valid bone name from the armature
1026
@type noninverse: integer
1028
0 - make parent with inverse
1029
1 - make parent without inverse
1032
0 - update scene hierarchy automatically
1033
1 - don't update scene hierarchy (faster). In this case, you must
1034
explicitly update the Scene hierarchy.
1035
@warn: Objects must first be linked to a scene before they can become
1036
parents of other objects. Calling this method for an
1037
unlinked object will result in an exception.
1040
def setDeltaLocation(delta_location):
1042
Sets the object's delta location which must be a vector triple.
1043
@type delta_location: A vector triple
1044
@param delta_location: A vector triple (x, y, z) specifying the new
1048
def setDrawMode(drawmode):
1050
Sets the object's drawing mode. The drawing mode can be a mix of modes. To
1051
enable these, add up the values.
1052
@type drawmode: Integer
1053
@param drawmode: A sum of the following:
1062
def setDrawType(drawtype):
1064
Sets the object's drawing type.
1065
@type drawtype: Integer
1066
@param drawtype: One of the following:
1074
def setEuler(euler):
1076
Sets the object's localspace rotation according to the specified Euler angles.
1077
@type euler: Py_Euler or a list of floats
1078
@param euler: a python Euler or x,y,z rotations as floats
1083
Links an ipo to this object.
1084
@type ipo: Blender Ipo
1085
@param ipo: an object type ipo.
1088
def setLocation(x, y, z):
1090
Sets the object's location relative to the parent object (if any).
1092
@param x: The X coordinate of the new location.
1094
@param y: The Y coordinate of the new location.
1096
@param z: The Z coordinate of the new location.
1099
def setMaterials(materials):
1101
Sets the materials. The argument must be a list 16 items or less. Each
1102
list element is either a Material or None. Also see L{colbits}.
1103
@type materials: Materials list
1104
@param materials: A list of Blender material objects.
1105
@note: Materials are assigned to the object's data by default. Unless
1106
you know the material is applied to the object or are changing the
1107
object's L{colbits}, you need to look at the object data's materials.
1110
def setMatrix(matrix):
1112
Sets the object's matrix and updates its transformation. If the object
1113
has a parent, the matrix transform is relative to the parent.
1114
@type matrix: Py_Matrix 3x3 or 4x4
1115
@param matrix: a 3x3 or 4x4 Python matrix. If a 3x3 matrix is given,
1116
it is extended to a 4x4 matrix.
1117
@Note: This method is "bad": when called it changes the location,
1118
rotation and size attributes of the object (since Blender uses these
1119
values to calculate the object's transformation matrix). Ton is
1120
not happy having a method which "pretends" to do a matrix operation.
1121
In the future, this method may be replaced with other methods which
1122
make it easier for the user to determine the correct loc/rot/size values
1123
for necessary for the object.
1128
Sets the name of the object. A string longer than 20 characters will be shortened.
1130
@param name: The new name for the object.
1133
def setSize(x, y, z):
1135
Sets the object's size, relative to the parent object (if any), clamped
1137
@param x: The X size multiplier.
1139
@param y: The Y size multiplier.
1141
@param z: The Z size multiplier.
1144
def setTimeOffset(timeOffset):
1146
Sets the time offset of the object's animation.
1147
@type timeOffset: float
1148
@param timeOffset: The new time offset for the object's animation.
1151
def shareFrom(object):
1153
Link data of a specified argument with this object. This works only
1154
if both objects are of the same type.
1155
@type object: Blender Object
1156
@param object: A Blender Object of the same type.
1157
@note: This function is faster than using L{getData()} and setData()
1158
because it skips making a Python object from the object's data.
1161
def select(boolean):
1163
Sets the object's selection state in the current scene.
1164
setting the selection will make this object the active object of this scene.
1165
@type boolean: Integer
1173
Returns the worldspace bounding box of this object. This works for meshes (out of
1174
edit mode) and curves.
1175
@rtype: list of 8 (x,y,z) float coordinate vectors (WRAPPED DATA)
1176
@return: The coordinates of the 8 corners of the bounding box. Data is wrapped when
1177
bounding box is present.
1180
def makeDisplayList():
1182
Updates this object's display list. Blender uses display lists to store
1183
already transformed data (like a mesh with its vertices already modified
1184
by coordinate transformations and armature deformation). If the object
1185
isn't modified, there's no need to recalculate this data. This method is
1186
here for the *few cases* where a script may need it, like when toggling
1187
the "SubSurf" mode for a mesh:
1192
scn = Blender.Scene.GetCurrent()
1193
object = scn.objects.active
1194
object.modifiers.append(Blender.Modifier.Type.SUBSURF)
1195
object.makeDisplayList()
1196
Blender.Window.RedrawAll()
1198
If you try this example without the line to update the display list, the
1199
object will disappear from the screen until you press "SubSurf".
1200
@warn: If after running your script objects disappear from the screen or
1201
are not displayed correctly, try this method function. But if the script
1202
works properly without it, there's no reason to use it.
1205
def getScriptLinks (event):
1207
Get a list with this Object's script links of type 'event'.
1209
@param event: "FrameChanged", "Redraw" or "Render".
1211
@return: a list with Blender L{Text} names (the script links of the given
1212
'event' type) or None if there are no script links at all.
1215
def clearScriptLinks (links = None):
1217
Delete script links from this Object. If no list is specified, all
1218
script links are deleted.
1219
@type links: list of strings
1220
@param links: None (default) or a list of Blender L{Text} names.
1223
def addScriptLink (text, event):
1225
Add a new script link to this Object.
1227
@param text: the name of an existing Blender L{Text}.
1229
@param event: "FrameChanged", "Redraw" or "Render".
1232
def makeTrack (tracked, fast = 0):
1234
Make this Object track another.
1235
@type tracked: Blender Object
1236
@param tracked: the object to be tracked.
1237
@type fast: int (bool)
1238
@param fast: if zero, the scene hierarchy is updated automatically. If
1239
you set 'fast' to a nonzero value, don't forget to update the scene
1240
yourself (see L{Scene.Scene.update}).
1241
@note: you also need to clear the rotation (L{setEuler}) of this object
1242
if it was not (0,0,0) already.
1245
def clearTrack (mode = 0, fast = 0):
1247
Make this Object not track another anymore.
1248
@type mode: int (bool)
1249
@param mode: if nonzero the matrix transformation used for tracking is kept.
1250
@type fast: int (bool)
1251
@param fast: if zero, the scene hierarchy is updated automatically. If
1252
you set 'fast' to a nonzero value, don't forget to update the scene
1253
yourself (see L{Scene.Scene.update}).
1256
def getAllProperties ():
1258
Return a list of all game properties from this object.
1260
@return: List of Property objects.
1263
def getProperty (name):
1265
Return a game property from this object matching the name argument.
1267
@param name: the name of the property to get.
1268
@rtype: Property object
1269
@return: The first property that matches name.
1272
def addProperty (name_or_property, data, type):
1274
Add or create a game property for an object. If called with only a
1275
property object, the property is assigned to the object. If called
1276
with a property name string and data object, a new property is
1277
created and added to the object.
1278
@type name_or_property: string or Property object
1279
@param name_or_property: the property name, or a property object.
1280
@type data: string, int or float
1281
@param data: Only valid when I{name_or_property} is a string.
1282
Value depends on what is passed in:
1283
- string: string type property
1284
- int: integer type property
1285
- float: float type property
1286
@type type: string (optional)
1287
@param type: Only valid when I{name_or_property} is a string.
1288
Can be the following:
1294
@warn: If a type is not declared string data will
1295
become string type, int data will become int type
1296
and float data will become float type. Override type
1297
to declare bool type, and time type.
1298
@warn: A property object can be added only once to an object;
1299
you must remove the property from an object to add it elsewhere.
1302
def removeProperty (property):
1304
Remove a game property from an object.
1305
@type property: Property object or string
1306
@param property: Property object or property name to be removed.
1309
def removeAllProperties():
1311
Removes all game properties from an object.
1314
def copyAllPropertiesTo (object):
1316
Copies all game properties from one object to another.
1317
@type object: Object object
1318
@param object: Object that will receive the properties.
1323
Get the Object's Particle Interaction Strength.
1327
def setPIStrength(strength):
1329
Set the Object's Particle Interaction Strength.
1330
Values between -1000.0 to 1000.0
1332
@type strength: float
1333
@param strength: the Object's Particle Interaction New Strength.
1338
Get the Object's Particle Interaction falloff.
1342
def setPIFalloff(falloff):
1344
Set the Object's Particle Interaction falloff.
1345
Values between 0 to 10.0
1347
@type falloff: float
1348
@param falloff: the Object's Particle Interaction New falloff.
1353
Get the Object's Particle Interaction MaxDist.
1357
def setPIMaxDist(MaxDist):
1359
Set the Object's Particle Interaction MaxDist.
1360
Values between 0 to 1000.0
1362
@type MaxDist: float
1363
@param MaxDist: the Object's Particle Interaction New MaxDist.
1368
Get the Object's Particle Interaction Type.
1372
def setPIType(type):
1374
Set the Object's Particle Interaction type.
1375
Use Module Constants
1383
@param type: the Object's Particle Interaction Type.
1386
def getPIUseMaxDist():
1388
Get the Object's Particle Interaction if using MaxDist.
1392
def setPIUseMaxDist(status):
1394
Set the Object's Particle Interaction MaxDist.
1398
@param status: the new status
1401
def getPIDeflection():
1403
Get the Object's Particle Interaction Deflection Setting.
1407
def setPIDeflection(status):
1409
Set the Object's Particle Interaction Deflection Setting.
1413
@param status: the new status
1418
Get the Object's Particle Interaction Permeability.
1422
def setPIPerm(perm):
1424
Set the Object's Particle Interaction Permeability.
1425
Values between 0 to 10.0
1428
@param perm: the Object's Particle Interaction New Permeability.
1431
def getPIRandomDamp():
1433
Get the Object's Particle Interaction RandomDamp.
1437
def setPIRandomDamp(damp):
1439
Set the Object's Particle Interaction RandomDamp.
1440
Values between 0 to 10.0
1443
@param damp: the Object's Particle Interaction New RandomDamp.
1446
def getPISurfaceDamp():
1448
Get the Object's Particle Interaction SurfaceDamp.
1452
def setPISurfaceDamp(damp):
1454
Set the Object's Particle Interaction SurfaceDamp.
1455
Values between 0 to 10.0
1458
@param damp: the Object's Particle Interaction New SurfaceDamp.
1463
Get the Object's SoftBody Mass.
1467
def setSBMass(mass):
1469
Set the Object's SoftBody Mass.
1470
Values between 0 to 50.0
1473
@param mass: the Object's SoftBody New mass.
1478
Get the Object's SoftBody Gravity.
1482
def setSBGravity(grav):
1484
Set the Object's SoftBody Gravity.
1485
Values between 0 to 10.0
1488
@param grav: the Object's SoftBody New Gravity.
1491
def getSBFriction():
1493
Get the Object's SoftBody Friction.
1497
def setSBFriction(frict):
1499
Set the Object's SoftBody Friction.
1500
Values between 0 to 10.0
1503
@param frict: the Object's SoftBody New Friction.
1506
def getSBErrorLimit():
1508
Get the Object's SoftBody ErrorLimit.
1512
def setSBErrorLimit(err):
1514
Set the Object's SoftBody ErrorLimit.
1515
Values between 0 to 1.0
1518
@param err: the Object's SoftBody New ErrorLimit.
1521
def getSBGoalSpring():
1523
Get the Object's SoftBody GoalSpring.
1527
def setSBGoalSpring(gs):
1529
Set the Object's SoftBody GoalSpring.
1530
Values between 0 to 0.999
1533
@param gs: the Object's SoftBody New GoalSpring.
1536
def getSBGoalFriction():
1538
Get the Object's SoftBody GoalFriction.
1542
def setSBGoalFriction(gf):
1544
Set the Object's SoftBody GoalFriction.
1545
Values between 0 to 10.0
1548
@param gf: the Object's SoftBody New GoalFriction.
1553
Get the Object's SoftBody MinGoal.
1557
def setSBMinGoal(mg):
1559
Set the Object's SoftBody MinGoal.
1560
Values between 0 to 1.0
1563
@param mg: the Object's SoftBody New MinGoal.
1568
Get the Object's SoftBody MaxGoal.
1572
def setSBMaxGoal(mg):
1574
Set the Object's SoftBody MaxGoal.
1575
Values between 0 to 1.0
1578
@param mg: the Object's SoftBody New MaxGoal.
1581
def getSBInnerSpring():
1583
Get the Object's SoftBody InnerSpring.
1587
def setSBInnerSpring(sprr):
1589
Set the Object's SoftBody InnerSpring.
1590
Values between 0 to 0.999
1593
@param sprr: the Object's SoftBody New InnerSpring.
1596
def getSBInnerSpringFriction():
1598
Get the Object's SoftBody InnerSpringFriction.
1602
def setSBInnerSpringFriction(sprf):
1604
Set the Object's SoftBody InnerSpringFriction.
1605
Values between 0 to 10.0
1608
@param sprf: the Object's SoftBody New InnerSpringFriction.
1611
def getSBDefaultGoal():
1613
Get the Object's SoftBody DefaultGoal.
1617
def setSBDefaultGoal(goal):
1619
Set the Object's SoftBody DefaultGoal.
1620
Values between 0 to 1.0
1623
@param goal: the Object's SoftBody New DefaultGoal.
1628
Returns the Object's SoftBody enabled state.
1634
get SoftBodies PostDef option
1638
def setSBPostDef(switch):
1640
Enable / Disable SoftBodies PostDef option
1645
@param switch: the Object's SoftBody New PostDef Value.
1650
get SoftBodies UseGoal option
1654
def setSBUseGoal(switch):
1656
Enable / Disable SoftBodies UseGoal option
1661
@param switch: the Object's SoftBody New UseGoal Value.
1663
def getSBUseEdges():
1665
get SoftBodies UseEdges option
1669
def setSBUseEdges(switch):
1671
Enable / Disable SoftBodies UseEdges option
1676
@param switch: the Object's SoftBody New UseEdges Value.
1679
def getSBStiffQuads():
1681
get SoftBodies StiffQuads option
1685
def setSBStiffQuads(switch):
1687
Enable / Disable SoftBodies StiffQuads option
1692
@param switch: the Object's SoftBody New StiffQuads Value.
258
This object gives access to generic data from all objects in Blender.
261
When dealing with properties and functions such as LocX/RotY/getLocation(), getSize() and getEuler(),
262
keep in mind that these transformation properties are relative to the object's parent (if any).
264
To get these values in worldspace (taking into account vertex parents, constraints, etc.)
265
pass the argument 'worldspace' to these functions.
267
@ivar restrictDisplay: Don't display this object in the 3D view: disabled by default, use the outliner to toggle.
268
@type restrictDisplay: bool
269
@ivar restrictSelect: Don't select this object in the 3D view: disabled by default, use the outliner to toggle.
270
@type restrictSelect: bool
271
@ivar restrictRender: Don't render this object: disabled by default, use the outliner to toggle.
272
@type restrictRender: bool
273
@ivar LocX: The X location coordinate of the object.
275
@ivar LocY: The Y location coordinate of the object.
277
@ivar LocZ: The Z location coordinate of the object.
279
@ivar loc: The (X,Y,Z) location coordinates of the object.
280
@type loc: tuple of 3 floats
281
@ivar dLocX: The delta X location coordinate of the object.
282
This variable applies to IPO Objects only.
284
@ivar dLocY: The delta Y location coordinate of the object.
285
This variable applies to IPO Objects only.
287
@ivar dLocZ: The delta Z location coordinate of the object.
288
This variable applies to IPO Objects only.
290
@ivar dloc: The delta (X,Y,Z) location coordinates of the object (vector).
291
This variable applies to IPO Objects only.
292
@type dloc: tuple of 3 floats
293
@ivar RotX: The X rotation angle (in radians) of the object.
295
@ivar RotY: The Y rotation angle (in radians) of the object.
297
@ivar RotZ: The Z rotation angle (in radians) of the object.
299
@ivar rot: The (X,Y,Z) rotation angles (in radians) of the object.
300
@type rot: euler (Py_WRAPPED)
301
@ivar dRotX: The delta X rotation angle (in radians) of the object.
302
This variable applies to IPO Objects only.
304
@ivar dRotY: The delta Y rotation angle (in radians) of the object.
305
This variable applies to IPO Objects only.
307
@ivar dRotZ: The delta Z rotation angle (in radians) of the object.
308
This variable applies to IPO Objects only.
310
@ivar drot: The delta (X,Y,Z) rotation angles (in radians) of the object.
311
This variable applies to IPO Objects only.
312
@type drot: tuple of 3 floats
313
@ivar SizeX: The X size of the object.
315
@ivar SizeY: The Y size of the object.
317
@ivar SizeZ: The Z size of the object.
319
@ivar size: The (X,Y,Z) size of the object.
320
@type size: tuple of 3 floats
321
@ivar dSizeX: The delta X size of the object.
323
@ivar dSizeY: The delta Y size of the object.
325
@ivar dSizeZ: The delta Z size of the object.
327
@ivar dsize: The delta (X,Y,Z) size of the object.
328
@type dsize: tuple of 3 floats
329
@ivar Layers: The object layers (also check the newer attribute
330
L{layers<layers>}). This value is a bitmask with at
331
least one position set for the 20 possible layers starting from the low
332
order bit. The easiest way to deal with these values in in hexadecimal
335
ob.Layer = 0x04 # sets layer 3 ( bit pattern 0100 )
336
After setting the Layer value, call Blender.Redraw( -1 ) to update
338
@type Layers: integer (bitmask)
339
@type layers: list of integers
340
@ivar layers: The layers this object is visible in (also check the older
341
attribute L{Layers<Layers>}). This returns a list of
342
integers in the range [1, 20], each number representing the respective
343
layer. Setting is done by passing a list of ints or an empty list for
346
ob.layers = [] # object won't be visible
347
ob.layers = [1, 4] # object visible only in layers 1 and 4
351
print ob.layers # will print: [1, 4, 10]
352
B{Note}: changes will only be visible after the screen (at least
353
the 3d View and Buttons windows) is redrawn.
354
@ivar parent: The parent object of the object (if defined). Read-only.
355
@type parent: Object or None
356
@ivar data: The Datablock object linked to this object. Read-only.
358
@ivar ipo: Contains the Ipo if one is assigned to the object, B{None}
359
otherwise. Setting to B{None} clears the current Ipo.
361
@ivar mat: The matrix of the object in world space (absolute, takes vertex parents, tracking
362
and Ipos into account). Read-only.
364
@ivar matrix: Same as L{mat}. Read-only.
366
@ivar matrixLocal: The matrix of the object relative to its parent; if there is no parent,
367
returns the world matrix (L{matrixWorld<Object.Object.matrixWorld>}).
368
@type matrixLocal: Matrix
369
@ivar matrixOldWorld: Old-type worldspace matrix (prior to Blender 2.34).
371
@type matrixOldWorld: Matrix
372
@ivar matrixWorld: Same as L{mat}. Read-only.
373
@type matrixWorld: Matrix
374
@ivar colbits: The Material usage mask. A set bit #n means: the Material
375
#n in the Object's material list is used. Otherwise, the Material #n
376
of the Objects Data material list is displayed.
378
object.colbits = (1<<0) + (1<<5) # use mesh materials 0 (1<<0) and 5 (1<<5)
379
# use object materials for all others
380
@ivar sel: The selection state of the object in the current scene.
381
True is selected, False is unselected. Setting makes the object active.
383
@ivar effects: The list of particle effects associated with the object.
385
@type effects: list of Effect objects
386
@ivar parentbonename: The string name of the parent bone (if defined).
387
This can be set to another bone in the armature if the object already has a bone parent.
388
@type parentbonename: string or None
389
@ivar protectFlags: The "transform locking" bitfield flags for the object.
390
See L{ProtectFlags} const dict for values.
391
@type protectFlags: int
392
@ivar DupGroup: The DupliGroup Animation Property. Assign a group to
393
DupGroup to make this object an instance of that group.
394
This does not enable or disable the DupliGroup option, for that use
396
The attribute returns None when this object does not have a dupliGroup,
397
and setting the attrbute to None deletes the object from the group.
398
@type DupGroup: Group or None
399
@ivar DupObjects: The Dupli object instances. Read-only.
400
Returns of list of tuples for object duplicated
401
by dupliframe, dupliverts dupligroups and other animation properties.
402
The first tuple item is the original object that is duplicated,
403
the second is the 4x4 worldspace dupli-matrix.
406
from Blender import Object, Scene, Mathutils
408
ob= Object.Get('Cube')
409
dupe_obs= ob.DupObjects
410
scn= Scene.GetCurrent()
411
for dupe_ob, dupe_matrix in dupe_obs:
413
empty_ob = scn.objects.new('Empty')
414
empty_ob.setMatrix(dupe_matrix)
416
@type DupObjects: list of tuples containing (object, matrix)
417
@ivar enableNLAOverride: Whether the object uses NLA or active Action for animation.
418
@type enableNLAOverride: boolean
419
@ivar enableDupVerts: The DupliVerts status of the object.
420
Does not indicate that this object has any dupliVerts,
421
(as returned by L{DupObjects}) just that dupliVerts are enabled.
422
@type enableDupVerts: boolean
423
@ivar enableDupFaces: The DupliFaces status of the object.
424
Does not indicate that this object has any dupliFaces,
425
(as returned by L{DupObjects}) just that dupliFaces are enabled.
426
@type enableDupFaces: boolean
427
@ivar enableDupFacesScale: The DupliFacesScale status of the object.
428
@type enableDupFacesScale: boolean
429
@ivar enableDupFrames: The DupliFrames status of the object.
430
Does not indicate that this object has any dupliFrames,
431
(as returned by L{DupObjects}) just that dupliFrames are enabled.
432
@type enableDupFrames: boolean
433
@ivar enableDupGroup: The DupliGroup status of the object.
434
Set True to make this object an instance of the object's L{DupGroup},
435
and set L{DupGroup} to a group for this to take effect,
436
Use L{DupObjects} to get the object data from this instance.
437
@type enableDupGroup: boolean
438
@ivar enableDupRot: The DupliRot status of the object.
439
Use with L{enableDupVerts} to rotate each instance
440
by the vertex normal.
441
@type enableDupRot: boolean
442
@ivar enableDupNoSpeed: The DupliNoSpeed status of the object.
443
Use with L{enableDupFrames} to ignore dupliFrame speed.
444
@type enableDupNoSpeed: boolean
445
@ivar DupSta: The DupliFrame starting frame. Use with L{enableDupFrames}.
446
Value clamped to [1,32767].
448
@ivar DupEnd: The DupliFrame end frame. Use with L{enableDupFrames}.
449
Value clamped to [1,32767].
451
@ivar DupOn: The DupliFrames in succession between DupOff frames.
452
Value is clamped to [1,1500].
453
Use with L{enableDupFrames} and L{DupOff} > 0.
455
@ivar DupOff: The DupliFrame removal of every Nth frame for this object.
456
Use with L{enableDupFrames}. Value is clamped to [0,1500].
458
@ivar passIndex: Index # for the IndexOB render pass.
459
Value is clamped to [0,1000].
461
@ivar activeMaterial: The active material index for this object.
463
The active index is used to select the material to edit in the material buttons,
464
new data created will also use the active material.
466
Value is clamped to [1,len(ob.materials)]. - [0,0] when there is no materials applied to the object.
467
@type activeMaterial: int
468
@ivar drawSize: The size to display the Empty.
469
Value clamped to [0.01,10.0].
470
@type drawSize: float
471
@ivar modifiers: The modifiers associated with the object.
473
# copy the active objects modifiers to all other visible selected objects
474
from Blender import *
475
scn = Scene.GetCurrent()
476
ob_act = scn.objects.active
477
for ob in scn.objects.context:
478
# Cannot copy modifiers to an object of a different type
479
if ob.type == ob_act.type:
480
ob.modifiers = ob_act.modifiers
481
@type modifiers: L{Modifier Sequence<Modifier.ModSeq>}
482
@ivar constraints: a L{sequence<Constraint.Constraints>} of
483
L{constraints<Constraint.Constraint>} for the object. Read-only.
484
@type constraints: Constraint Sequence
485
@ivar actionStrips: a L{sequence<NLA.ActionStrips>} of
486
L{action strips<NLA.ActionStrip>} for the object. Read-only.
487
@type actionStrips: BPy_ActionStrips
488
@ivar action: The action associated with this object (if defined).
489
@type action: L{Action<NLA.Action>} or None
490
@ivar oopsLoc: Object's (X,Y) OOPs location. Returns None if object
491
is not found in list.
492
@type oopsLoc: tuple of 2 floats
493
@ivar oopsSel: Object OOPs selection flag.
494
@type oopsSel: boolean
495
@ivar game_properties: The object's properties. Read-only.
496
@type game_properties: list of Properties.
497
@ivar timeOffset: The time offset of the object's animation.
498
Value clamped to [-300000.0,300000.0].
499
@type timeOffset: float
500
@ivar track: The object's tracked object. B{None} is returned if no
501
object is tracked. Also, assigning B{None} clear the tracked object.
502
@type track: Object or None
503
@ivar type: The object's type. Read-only.
505
@ivar boundingBox: The bounding box of this object. Read-only.
506
@type boundingBox: list of 8 3D vectors
507
@ivar drawType: The object's drawing type.
508
See L{DrawTypes} constant dict for values.
510
@ivar parentType: The object's parent type. Read-only.
511
See L{ParentTypes} constant dict for values.
512
@type parentType: int
513
@ivar axis: Enable display of active object's center and axis.
514
Also see B{AXIS} bit in L{drawMode} attribute.
516
@ivar texSpace: Enable display of active object's texture space.
517
Also see B{TEXSPACE} bit in L{drawMode} attribute.
518
@type texSpace: boolean
519
@ivar nameMode: Enable display of active object's name.
520
Also see B{NAME} bit in L{drawMode} attribute.
521
@type nameMode: boolean
522
@ivar wireMode: Enable the active object's wireframe over solid drawing.
523
Also see B{WIRE} bit in L{drawMode} attribute.
524
@type wireMode: boolean
525
@ivar xRay: Enable drawing the active object in front of others.
526
Also see B{XRAY} bit in L{drawMode} attribute.
528
@ivar transp: Enable transparent materials for the active object
529
(mesh only). Also see B{TRANSP} bit in L{drawMode} attribute.
530
@type transp: boolean
531
@ivar drawMode: The object's drawing mode bitfield.
532
See L{DrawModes} constant dict for values.
535
@ivar piType: Type of particle interaction.
536
See L{PITypes} constant dict for values.
538
@ivar piFalloff: The particle interaction falloff power.
539
Value clamped to [0.0,10.0].
540
@type piFalloff: float
541
@ivar piMaxDist: Max distance for the particle interaction field to work.
542
Value clamped to [0.0,1000.0].
543
@type piMaxDist: float
544
@ivar piPermeability: Probability that a particle will pass through the
545
mesh. Value clamped to [0.0,1.0].
546
@type piPermeability: float
547
@ivar piRandomDamp: Random variation of particle interaction damping.
548
Value clamped to [0.0,1.0].
549
@type piRandomDamp: float
550
@ivar piSoftbodyDamp: Damping factor for softbody deflection.
551
Value clamped to [0.0,1.0].
552
@type piSoftbodyDamp: float
553
@ivar piSoftbodyIThick: Inner face thickness for softbody deflection.
554
Value clamped to [0.001,1.0].
555
@type piSoftbodyIThick: float
556
@ivar piSoftbodyOThick: Outer face thickness for softbody deflection.
557
Value clamped to [0.001,1.0].
558
@type piSoftbodyOThick: float
559
@ivar piStrength: Particle interaction force field strength.
560
Value clamped to [0.0,1000.0].
561
@type piStrength: float
562
@ivar piSurfaceDamp: Amount of damping during particle collision.
563
Value clamped to [0.0,1.0].
564
@type piSurfaceDamp: float
565
@ivar piUseMaxDist: Use a maximum distance for the field to work.
566
@type piUseMaxDist: boolean
568
@ivar isSoftBody: True if object is a soft body. Read-only.
569
@type isSoftBody: boolean
570
@ivar SBDefaultGoal: Default softbody goal value, when no vertex group used.
571
Value clamped to [0.0,1.0].
572
@type SBDefaultGoal: float
573
@ivar SBErrorLimit: Softbody Runge-Kutta ODE solver error limit (low values give more precision).
574
Value clamped to [0.01,1.0].
575
@type SBErrorLimit: float
576
@ivar SBFriction: General media friction for softbody point movements.
577
Value clamped to [0.0,10.0].
578
@type SBFriction: float
579
@ivar SBGoalFriction: Softbody goal (vertex target position) friction.
580
Value clamped to [0.0,10.0].
581
@type SBGoalFriction: float
582
@ivar SBGoalSpring: Softbody goal (vertex target position) spring stiffness.
583
Value clamped to [0.0,0.999].
584
@type SBGoalSpring: float
585
@ivar SBGrav: Apply gravitation to softbody point movement.
586
Value clamped to [0.0,10.0].
588
@ivar SBInnerSpring: Softbody edge spring stiffness.
589
Value clamped to [0.0,0.999].
590
@type SBInnerSpring: float
591
@ivar SBInnerSpringFrict: Softbody edge spring friction.
592
Value clamped to [0.0,10.0].
593
@type SBInnerSpringFrict: float
594
@ivar SBMass: Softbody point mass (heavier is slower).
595
Value clamped to [0.001,50.0].
597
@ivar SBMaxGoal: Softbody goal maximum (vertex group weights scaled to
598
match this range). Value clamped to [0.0,1.0].
599
@type SBMaxGoal: float
600
@ivar SBMinGoal: Softbody goal minimum (vertex group weights scaled to
601
match this range). Value clamped to [0.0,1.0].
602
@type SBMinGoal: float
603
@ivar SBSpeed: Tweak timing for physics to control softbody frequency and
604
speed. Value clamped to [0.0,10.0].
606
@ivar SBStiffQuads: Softbody adds diagonal springs on 4-gons enabled.
607
@type SBStiffQuads: boolean
608
@ivar SBUseEdges: Softbody use edges as springs enabled.
609
@type SBUseEdges: boolean
610
@ivar SBUseGoal: Softbody forces for vertices to stick to animated position enabled.
611
@type SBUseGoal: boolean
613
@ivar rbFlags: Rigid body bitfield. See L{RBFlags} for valid values.
615
@ivar rbMass: Rigid body mass. Must be a positive value.
617
@ivar rbRadius: Rigid body bounding sphere size. Must be a positive
619
@type rbRadius: float
620
@ivar rbShapeBoundType: Rigid body shape bound type. See L{RBShapes}
621
const dict for values.
622
@type rbShapeBoundType: int
627
Recomputes the particle system. This method only applies to an Object of
631
def insertShapeKey():
633
Insert a Shape Key in the current object. It applies to Objects of
634
the type Mesh, Lattice, or Curve.
639
Gets the current Pose of the object.
641
@return: the current pose object
644
def evaluatePose(framenumber):
646
Evaluates the Pose based on its currently bound action at a certain frame.
647
@type framenumber: Int
648
@param framenumber: The frame number to evaluate to.
653
Unlinks the ipo from this object.
654
@return: True if there was an ipo linked or False otherwise.
657
def clrParent(mode = 0, fast = 0):
659
Clears parent object.
662
@param mode: A mode flag. If mode flag is 2, then the object transform will
663
be kept. Any other value, or no value at all will update the object
665
@param fast: If the value is 0, the scene hierarchy will not be updated. Any
666
other value, or no value at all will update the scene hierarchy.
669
def getData(name_only=False, mesh=False):
671
Returns the Datablock object (Mesh, Lamp, Camera, etc.) linked to this
672
Object. If the keyword parameter B{name_only} is True, only the Datablock
673
name is returned as a string. It the object is of type Mesh, then the
674
B{mesh} keyword can also be used; the data return is a Mesh object if
675
True, otherwise it is an NMesh object (the default).
676
The B{mesh} keyword is ignored for non-mesh objects.
677
@type name_only: bool
678
@param name_only: This is a keyword parameter. If True (or nonzero),
679
only the name of the data object is returned.
681
@param mesh: This is a keyword parameter. If True (or nonzero),
682
a Mesh data object is returned.
683
@rtype: specific Object type or string
684
@return: Depends on the type of Datablock linked to the Object. If
685
B{name_only} is True, it returns a string.
686
@note: Mesh is faster than NMesh because Mesh is a thin wrapper.
687
@note: This function is different from L{NMesh.GetRaw} and L{Mesh.Get}
688
because it keeps a link to the original mesh, which is needed if you are
689
dealing with Mesh weight groups.
690
@note: Make sure the object you are getting the data from isn't in
691
EditMode before calling this function; otherwise you'll get the data
692
before entering EditMode. See L{Window.EditMode}.
695
def getParentBoneName():
697
Returns None, or the 'sub-name' of the parent (eg. Bone name)
701
def getDeltaLocation():
703
Returns the object's delta location in a list (x, y, z)
704
@rtype: A vector triple
710
Returns the object draw mode.
712
@return: a sum of the following:
723
Returns the object draw type
725
@return: One of the following:
736
@param space: The desired space for the size:
737
- localspace: (default) relative to the object's parent;
738
- worldspace: absolute, taking vertex parents, tracking and
740
Returns the object's localspace rotation as Euler rotation vector (rotX, rotY, rotZ). Angles are in radians.
742
@return: A python Euler. Data is wrapped when euler is present.
745
def getInverseMatrix():
747
Returns the object's inverse matrix.
749
@return: A python matrix 4x4
754
Returns the Ipo associated to this object or None if there's no linked ipo.
756
@return: the wrapped ipo or None.
760
Returns the objects selection state in the current scene as a boolean value True or False.
762
@return: Selection state as True or False
765
def getLocation(space):
768
@param space: The desired space for the location:
769
- localspace: (default) relative to the object's parent;
770
- worldspace: absolute, taking vertex parents, tracking and
772
Returns the object's location (x, y, z).
777
The example below works on the default scene. It retrieves all objects in
778
the scene and prints the name and location of each object::
781
sce = Blender.Scene.GetCurrent()
783
for ob in sce.objects:
786
@note: the worldspace location is the same as ob.matrixWorld[3][0:3]
791
Returns an action if one is associated with this object (only useful for armature types).
793
@return: a python action.
796
def getMaterials(what = 0):
798
Returns a list of materials assigned to the object.
800
@param what: if nonzero, empty slots will be returned as None's instead
801
of being ignored (default way). See L{NMesh.NMesh.getMaterials}.
802
@rtype: list of Material Objects
803
@return: list of Material Objects assigned to the object.
806
def getMatrix(space = 'worldspace'):
808
Returns the object matrix.
810
@param space: The desired matrix:
811
- worldspace (default): absolute, taking vertex parents, tracking and
813
- localspace: relative to the object's parent (returns worldspace
814
matrix if the object doesn't have a parent);
815
- old_worldspace: old behavior, prior to Blender 2.34, where eventual
816
changes made by the script itself were not taken into account until
817
a redraw happened, either called by the script or upon its exit.
818
Returns the object matrix.
819
@rtype: Py_Matrix (WRAPPED DATA)
820
@return: a python 4x4 matrix object. Data is wrapped for 'worldspace'
825
Returns the name of the object
826
@return: The name of the object
830
The example below works on the default scene. It retrieves all objects in
831
the scene and prints the name of each object::
834
sce= Blender.Scene.GetCurrent()
836
for ob in sce.objects:
842
Returns the object's parent object.
844
@return: The parent object of the object. If not available, None will be
851
@param space: The desired space for the size:
852
- localspace: (default) relative to the object's parent;
853
- worldspace: absolute, taking vertex parents, tracking and
855
Returns the object's size.
856
@return: (SizeX, SizeY, SizeZ)
857
@note: the worldspace size will not return negative (flipped) scale values.
860
def getParentBoneName():
862
Returns the object's parent object's sub name, or None.
863
For objects parented to bones, this is the name of the bone.
865
@return: The parent object sub-name of the object.
866
If not available, None will be returned.
871
Returns the time offset of the object's animation.
877
Returns the object's tracked object.
879
@return: The tracked object of the object. If not available, None will be
885
Returns the type of the object in 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
886
'Mball', 'Mesh', 'Surf', 'Empty', 'Wave' (deprecated) or 'unknown' in exceptional cases.
890
The example below works on the default scene. It retrieves all objects in
891
the scene and updates the location and rotation of the camera. When run,
892
the camera will rotate 180 degrees and moved to the opposite side of the X
893
axis. Note that the number 'pi' in the example is an approximation of the
894
true number 'pi'. A better, less error-prone value of pi is math.pi from the python math module.::
897
sce = Blender.Scene.GetCurrent()
899
for obj in sce.objects:
900
if obj.type == 'Camera':
902
obj.RotZ = 3.141592 - obj.RotZ
906
@return: The type of object.
910
def insertIpoKey(keytype):
912
Inserts keytype values in object ipo at curframe.
914
@param keytype: A constant from L{IpoKeyTypes<Object.IpoKeyTypes>}
920
Links Object with ObData datablock provided in the argument. The data must match the
921
Object's type, so you cannot link a Lamp to a Mesh type object.
922
@type datablock: Blender ObData datablock
923
@param datablock: A Blender datablock matching the objects type.
926
def makeParent(objects, noninverse = 0, fast = 0):
928
Makes the object the parent of the objects provided in the argument which
929
must be a list of valid Objects.
930
@type objects: Sequence of Blender Object
931
@param objects: The children of the parent
932
@type noninverse: Integer
934
0 - make parent with inverse
935
1 - make parent without inverse
938
0 - update scene hierarchy automatically
939
1 - don't update scene hierarchy (faster). In this case, you must
940
explicitely update the Scene hierarchy.
941
@warn: objects must first be linked to a scene before they can become
942
parents of other objects. Calling this makeParent method for an
943
unlinked object will result in an error.
948
Uses the object as a base for all of the objects in the provided list to join into.
950
@type objects: Sequence of Blender Object
951
@param objects: A list of objects matching the object's type.
952
@note: Objects in the list will not be removed from the scene.
953
To avoid overlapping data you may want to remove them manually after joining.
954
@note: Join modifies the base object's data in place so that
955
other objects are joined into it. No new object or data is created.
956
@note: Join will only work for object types Mesh, Armature, Curve and Surface;
957
an excption will be raised if the object is not of these types.
958
@note: Objects in the list will be ignored if they to not match the base object.
959
@note: The base object must be in the current scene to be joined.
960
@note: This function will not work in background mode (no user interface).
961
@note: An error in the function input will raise a TypeError or AttributeError,
962
otherwise an error in the data input will raise a RuntimeError.
963
For situations where you don't have tight control on the data that is being joined,
964
you should handle the RuntimeError error, letting the user know the data can't be joined.
967
def makeParentDeform(objects, noninverse = 0, fast = 0):
969
Makes the object the deformation parent of the objects provided in the argument
970
which must be a list of valid Objects.
971
The parent object must be a Curve or Armature.
972
@type objects: Sequence of Blender Object
973
@param objects: The children of the parent
974
@type noninverse: Integer
976
0 - make parent with inverse
977
1 - make parent without inverse
980
0 - update scene hierarchy automatically
981
1 - don't update scene hierarchy (faster). In this case, you must
982
explicitely update the Scene hierarchy.
983
@warn: objects must first be linked to a scene before they can become
984
parents of other objects. Calling this makeParent method for an
985
unlinked object will result in an error.
986
@warn: child objects must be of mesh type to deform correctly. Other object
987
types will fall back to normal parenting silently.
990
def makeParentVertex(objects, indices, noninverse = 0, fast = 0):
992
Makes the object the vertex parent of the objects provided in the argument
993
which must be a list of valid Objects.
994
The parent object must be a Mesh, Curve or Surface.
995
@type objects: Sequence of Blender Object
996
@param objects: The children of the parent
997
@type indices: Tuple of Integers
998
@param indices: The indices of the vertices you want to parent to (1 or 3 values)
999
@type noninverse: Integer
1001
0 - make parent with inverse
1002
1 - make parent without inverse
1005
0 - update scene hierarchy automatically
1006
1 - don't update scene hierarchy (faster). In this case, you must
1007
explicitely update the Scene hierarchy.
1008
@warn: objects must first be linked to a scene before they can become
1009
parents of other objects. Calling this makeParent method for an
1010
unlinked object will result in an error.
1012
def makeParentBone(objects, bonename, noninverse = 0, fast = 0):
1014
Makes one of the object's bones the parent of the objects provided in the argument
1015
which must be a list of valid objects. The parent object must be an Armature.
1016
@type objects: Sequence of Blender Object
1017
@param objects: The children of the parent
1018
@type bonename: string
1019
@param bonename: a valid bone name from the armature
1020
@type noninverse: integer
1022
0 - make parent with inverse
1023
1 - make parent without inverse
1026
0 - update scene hierarchy automatically
1027
1 - don't update scene hierarchy (faster). In this case, you must
1028
explicitly update the Scene hierarchy.
1029
@warn: Objects must first be linked to a scene before they can become
1030
parents of other objects. Calling this method for an
1031
unlinked object will result in an exception.
1034
def setDeltaLocation(delta_location):
1036
Sets the object's delta location which must be a vector triple.
1037
@type delta_location: A vector triple
1038
@param delta_location: A vector triple (x, y, z) specifying the new
1042
def setDrawMode(drawmode):
1044
Sets the object's drawing mode. The drawing mode can be a mix of modes. To
1045
enable these, add up the values.
1046
@type drawmode: Integer
1047
@param drawmode: A sum of the following:
1056
def setDrawType(drawtype):
1058
Sets the object's drawing type.
1059
@type drawtype: Integer
1060
@param drawtype: One of the following:
1068
def setEuler(euler):
1070
Sets the object's localspace rotation according to the specified Euler angles.
1071
@type euler: Py_Euler or a list of floats
1072
@param euler: a python Euler or x,y,z rotations as floats
1077
Links an ipo to this object.
1078
@type ipo: Blender Ipo
1079
@param ipo: an object type ipo.
1082
def setLocation(x, y, z):
1084
Sets the object's location relative to the parent object (if any).
1086
@param x: The X coordinate of the new location.
1088
@param y: The Y coordinate of the new location.
1090
@param z: The Z coordinate of the new location.
1093
def setMaterials(materials):
1095
Sets the materials. The argument must be a list 16 items or less. Each
1096
list element is either a Material or None. Also see L{colbits}.
1097
@type materials: Materials list
1098
@param materials: A list of Blender material objects.
1099
@note: Materials are assigned to the object's data by default. Unless
1100
you know the material is applied to the object or are changing the
1101
object's L{colbits}, you need to look at the object data's materials.
1104
def setMatrix(matrix):
1106
Sets the object's matrix and updates its transformation. If the object
1107
has a parent, the matrix transform is relative to the parent.
1108
@type matrix: Py_Matrix 3x3 or 4x4
1109
@param matrix: a 3x3 or 4x4 Python matrix. If a 3x3 matrix is given,
1110
it is extended to a 4x4 matrix.
1111
@Note: This method is "bad": when called it changes the location,
1112
rotation and size attributes of the object (since Blender uses these
1113
values to calculate the object's transformation matrix). Ton is
1114
not happy having a method which "pretends" to do a matrix operation.
1115
In the future, this method may be replaced with other methods which
1116
make it easier for the user to determine the correct loc/rot/size values
1117
for necessary for the object.
1122
Sets the name of the object. A string longer than 20 characters will be shortened.
1124
@param name: The new name for the object.
1127
def setSize(x, y, z):
1129
Sets the object's size, relative to the parent object (if any), clamped
1131
@param x: The X size multiplier.
1133
@param y: The Y size multiplier.
1135
@param z: The Z size multiplier.
1138
def setTimeOffset(timeOffset):
1140
Sets the time offset of the object's animation.
1141
@type timeOffset: float
1142
@param timeOffset: The new time offset for the object's animation.
1145
def shareFrom(object):
1147
Link data of a specified argument with this object. This works only
1148
if both objects are of the same type.
1149
@type object: Blender Object
1150
@param object: A Blender Object of the same type.
1151
@note: This function is faster than using L{getData()} and setData()
1152
because it skips making a Python object from the object's data.
1155
def select(boolean):
1157
Sets the object's selection state in the current scene.
1158
setting the selection will make this object the active object of this scene.
1159
@type boolean: Integer
1167
Returns the worldspace bounding box of this object. This works for meshes (out of
1168
edit mode) and curves.
1169
@rtype: list of 8 (x,y,z) float coordinate vectors (WRAPPED DATA)
1170
@return: The coordinates of the 8 corners of the bounding box. Data is wrapped when
1171
bounding box is present.
1174
def makeDisplayList():
1176
Updates this object's display list. Blender uses display lists to store
1177
already transformed data (like a mesh with its vertices already modified
1178
by coordinate transformations and armature deformation). If the object
1179
isn't modified, there's no need to recalculate this data. This method is
1180
here for the *few cases* where a script may need it, like when toggling
1181
the "SubSurf" mode for a mesh:
1186
scn = Blender.Scene.GetCurrent()
1187
object = scn.objects.active
1188
object.modifiers.append(Blender.Modifier.Type.SUBSURF)
1189
object.makeDisplayList()
1190
Blender.Window.RedrawAll()
1192
If you try this example without the line to update the display list, the
1193
object will disappear from the screen until you press "SubSurf".
1194
@warn: If after running your script objects disappear from the screen or
1195
are not displayed correctly, try this method function. But if the script
1196
works properly without it, there's no reason to use it.
1199
def getScriptLinks (event):
1201
Get a list with this Object's script links of type 'event'.
1203
@param event: "FrameChanged", "Redraw" or "Render".
1205
@return: a list with Blender L{Text} names (the script links of the given
1206
'event' type) or None if there are no script links at all.
1209
def clearScriptLinks (links = None):
1211
Delete script links from this Object. If no list is specified, all
1212
script links are deleted.
1213
@type links: list of strings
1214
@param links: None (default) or a list of Blender L{Text} names.
1217
def addScriptLink (text, event):
1219
Add a new script link to this Object.
1221
@param text: the name of an existing Blender L{Text}.
1223
@param event: "FrameChanged", "Redraw" or "Render".
1226
def makeTrack (tracked, fast = 0):
1228
Make this Object track another.
1229
@type tracked: Blender Object
1230
@param tracked: the object to be tracked.
1231
@type fast: int (bool)
1232
@param fast: if zero, the scene hierarchy is updated automatically. If
1233
you set 'fast' to a nonzero value, don't forget to update the scene
1234
yourself (see L{Scene.Scene.update}).
1235
@note: you also need to clear the rotation (L{setEuler}) of this object
1236
if it was not (0,0,0) already.
1239
def clearTrack (mode = 0, fast = 0):
1241
Make this Object not track another anymore.
1242
@type mode: int (bool)
1243
@param mode: if nonzero the matrix transformation used for tracking is kept.
1244
@type fast: int (bool)
1245
@param fast: if zero, the scene hierarchy is updated automatically. If
1246
you set 'fast' to a nonzero value, don't forget to update the scene
1247
yourself (see L{Scene.Scene.update}).
1250
def getAllProperties ():
1252
Return a list of all game properties from this object.
1254
@return: List of Property objects.
1257
def getProperty (name):
1259
Return a game property from this object matching the name argument.
1261
@param name: the name of the property to get.
1262
@rtype: Property object
1263
@return: The first property that matches name.
1266
def addProperty (name_or_property, data, type):
1268
Add or create a game property for an object. If called with only a
1269
property object, the property is assigned to the object. If called
1270
with a property name string and data object, a new property is
1271
created and added to the object.
1272
@type name_or_property: string or Property object
1273
@param name_or_property: the property name, or a property object.
1274
@type data: string, int or float
1275
@param data: Only valid when I{name_or_property} is a string.
1276
Value depends on what is passed in:
1277
- string: string type property
1278
- int: integer type property
1279
- float: float type property
1280
@type type: string (optional)
1281
@param type: Only valid when I{name_or_property} is a string.
1282
Can be the following:
1288
@warn: If a type is not declared string data will
1289
become string type, int data will become int type
1290
and float data will become float type. Override type
1291
to declare bool type, and time type.
1292
@warn: A property object can be added only once to an object;
1293
you must remove the property from an object to add it elsewhere.
1296
def removeProperty (property):
1298
Remove a game property from an object.
1299
@type property: Property object or string
1300
@param property: Property object or property name to be removed.
1303
def removeAllProperties():
1305
Removes all game properties from an object.
1308
def copyAllPropertiesTo (object):
1310
Copies all game properties from one object to another.
1311
@type object: Object object
1312
@param object: Object that will receive the properties.
1317
Get the Object's Particle Interaction Strength.
1321
def setPIStrength(strength):
1323
Set the Object's Particle Interaction Strength.
1324
Values between -1000.0 to 1000.0
1326
@type strength: float
1327
@param strength: the Object's Particle Interaction New Strength.
1332
Get the Object's Particle Interaction falloff.
1336
def setPIFalloff(falloff):
1338
Set the Object's Particle Interaction falloff.
1339
Values between 0 to 10.0
1341
@type falloff: float
1342
@param falloff: the Object's Particle Interaction New falloff.
1347
Get the Object's Particle Interaction MaxDist.
1351
def setPIMaxDist(MaxDist):
1353
Set the Object's Particle Interaction MaxDist.
1354
Values between 0 to 1000.0
1356
@type MaxDist: float
1357
@param MaxDist: the Object's Particle Interaction New MaxDist.
1362
Get the Object's Particle Interaction Type.
1366
def setPIType(type):
1368
Set the Object's Particle Interaction type.
1369
Use Module Constants
1377
@param type: the Object's Particle Interaction Type.
1380
def getPIUseMaxDist():
1382
Get the Object's Particle Interaction if using MaxDist.
1386
def setPIUseMaxDist(status):
1388
Set the Object's Particle Interaction MaxDist.
1392
@param status: the new status
1395
def getPIDeflection():
1397
Get the Object's Particle Interaction Deflection Setting.
1401
def setPIDeflection(status):
1403
Set the Object's Particle Interaction Deflection Setting.
1407
@param status: the new status
1412
Get the Object's Particle Interaction Permeability.
1416
def setPIPerm(perm):
1418
Set the Object's Particle Interaction Permeability.
1419
Values between 0 to 10.0
1422
@param perm: the Object's Particle Interaction New Permeability.
1425
def getPIRandomDamp():
1427
Get the Object's Particle Interaction RandomDamp.
1431
def setPIRandomDamp(damp):
1433
Set the Object's Particle Interaction RandomDamp.
1434
Values between 0 to 10.0
1437
@param damp: the Object's Particle Interaction New RandomDamp.
1440
def getPISurfaceDamp():
1442
Get the Object's Particle Interaction SurfaceDamp.
1446
def setPISurfaceDamp(damp):
1448
Set the Object's Particle Interaction SurfaceDamp.
1449
Values between 0 to 10.0
1452
@param damp: the Object's Particle Interaction New SurfaceDamp.
1457
Get the Object's SoftBody Mass.
1461
def setSBMass(mass):
1463
Set the Object's SoftBody Mass.
1464
Values between 0 to 50.0
1467
@param mass: the Object's SoftBody New mass.
1472
Get the Object's SoftBody Gravity.
1476
def setSBGravity(grav):
1478
Set the Object's SoftBody Gravity.
1479
Values between 0 to 10.0
1482
@param grav: the Object's SoftBody New Gravity.
1485
def getSBFriction():
1487
Get the Object's SoftBody Friction.
1491
def setSBFriction(frict):
1493
Set the Object's SoftBody Friction.
1494
Values between 0 to 10.0
1497
@param frict: the Object's SoftBody New Friction.
1500
def getSBErrorLimit():
1502
Get the Object's SoftBody ErrorLimit.
1506
def setSBErrorLimit(err):
1508
Set the Object's SoftBody ErrorLimit.
1509
Values between 0 to 1.0
1512
@param err: the Object's SoftBody New ErrorLimit.
1515
def getSBGoalSpring():
1517
Get the Object's SoftBody GoalSpring.
1521
def setSBGoalSpring(gs):
1523
Set the Object's SoftBody GoalSpring.
1524
Values between 0 to 0.999
1527
@param gs: the Object's SoftBody New GoalSpring.
1530
def getSBGoalFriction():
1532
Get the Object's SoftBody GoalFriction.
1536
def setSBGoalFriction(gf):
1538
Set the Object's SoftBody GoalFriction.
1539
Values between 0 to 10.0
1542
@param gf: the Object's SoftBody New GoalFriction.
1547
Get the Object's SoftBody MinGoal.
1551
def setSBMinGoal(mg):
1553
Set the Object's SoftBody MinGoal.
1554
Values between 0 to 1.0
1557
@param mg: the Object's SoftBody New MinGoal.
1562
Get the Object's SoftBody MaxGoal.
1566
def setSBMaxGoal(mg):
1568
Set the Object's SoftBody MaxGoal.
1569
Values between 0 to 1.0
1572
@param mg: the Object's SoftBody New MaxGoal.
1575
def getSBInnerSpring():
1577
Get the Object's SoftBody InnerSpring.
1581
def setSBInnerSpring(sprr):
1583
Set the Object's SoftBody InnerSpring.
1584
Values between 0 to 0.999
1587
@param sprr: the Object's SoftBody New InnerSpring.
1590
def getSBInnerSpringFriction():
1592
Get the Object's SoftBody InnerSpringFriction.
1596
def setSBInnerSpringFriction(sprf):
1598
Set the Object's SoftBody InnerSpringFriction.
1599
Values between 0 to 10.0
1602
@param sprf: the Object's SoftBody New InnerSpringFriction.
1605
def getSBDefaultGoal():
1607
Get the Object's SoftBody DefaultGoal.
1611
def setSBDefaultGoal(goal):
1613
Set the Object's SoftBody DefaultGoal.
1614
Values between 0 to 1.0
1617
@param goal: the Object's SoftBody New DefaultGoal.
1622
Returns the Object's SoftBody enabled state.
1628
get SoftBodies PostDef option
1632
def setSBPostDef(switch):
1634
Enable / Disable SoftBodies PostDef option
1639
@param switch: the Object's SoftBody New PostDef Value.
1644
get SoftBodies UseGoal option
1648
def setSBUseGoal(switch):
1650
Enable / Disable SoftBodies UseGoal option
1655
@param switch: the Object's SoftBody New UseGoal Value.
1657
def getSBUseEdges():
1659
get SoftBodies UseEdges option
1663
def setSBUseEdges(switch):
1665
Enable / Disable SoftBodies UseEdges option
1670
@param switch: the Object's SoftBody New UseEdges Value.
1673
def getSBStiffQuads():
1675
get SoftBodies StiffQuads option
1679
def setSBStiffQuads(switch):
1681
Enable / Disable SoftBodies StiffQuads option
1686
@param switch: the Object's SoftBody New StiffQuads Value.
1696
1690
class Property:
1700
This property gives access to object property data in Blender, used by the game engine.
1701
@ivar name: The property name.
1702
@ivar data: Data for this property. Depends on property type.
1703
@ivar type: The property type.
1704
@warn: Comparisons between properties will only be true when
1705
both the name and data pairs are the same.
1710
Get the name of this property.
1712
@return: The property name.
1717
Set the name of this property.
1719
@param name: The new name of the property
1724
Get the data for this property.
1725
@rtype: string, int, or float
1730
Set the data for this property.
1731
@type data: string, int, or float
1732
@param data: The data to set for this property.
1733
@warn: See object.setProperty(). Changing data
1734
which is of a different type then the property is
1735
set to (i.e. setting an int value to a float type'
1736
property) will change the type of the property
1742
Get the type for this property.
1694
This property gives access to object property data in Blender, used by the game engine.
1695
@ivar name: The property name.
1696
@ivar data: Data for this property. Depends on property type.
1697
@ivar type: The property type.
1698
@warn: Comparisons between properties will only be true when
1699
both the name and data pairs are the same.
1704
Get the name of this property.
1706
@return: The property name.
1711
Set the name of this property.
1713
@param name: The new name of the property
1718
Get the data for this property.
1719
@rtype: string, int, or float
1724
Set the data for this property.
1725
@type data: string, int, or float
1726
@param data: The data to set for this property.
1727
@warn: See object.setProperty(). Changing data
1728
which is of a different type then the property is
1729
set to (i.e. setting an int value to a float type'
1730
property) will change the type of the property
1736
Get the type for this property.
1741
Object.__doc__ += id_generics.attributes