Module Object
[hide private]
[frames] | no frames]

Source Code for Module Object

   1  # Blender.Object module and the Object PyType object 
   2   
   3  """ 
   4  The Blender.Object submodule 
   5   
   6  B{New}: 
   7          - Addition of attributes for particle deflection, softbodies, and 
   8                  rigidbodies. 
   9          - Objects now increment the Blender user count when they are created and 
  10                  decremented it when they are destroyed.  This means Python scripts can 
  11                  keep the object "alive" if it is deleted in the Blender GUI. 
  12          - L{Object.getData} now accepts two optional bool keyword argument to 
  13                          define (1) if the user wants the data object or just its name 
  14                          and (2) if a mesh object should use NMesh or Mesh. 
  15          - L{Object.clearScriptLinks} accepts a parameter now. 
  16          - Object attributes: renamed Layer to L{Layers<Object.Object.Layers>} and 
  17                  added the easier L{layers<Object.Object.layers>}.  The old form "Layer" 
  18                  will continue to work. 
  19   
  20   
  21  Object 
  22  ====== 
  23   
  24  This module provides access to the B{Objects} in Blender. 
  25   
  26  Example:: 
  27   
  28          import Blender 
  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 
  33   
  34          Blender.Redraw()                      # redraw the scene to show the updates. 
  35   
  36  @type DrawModes: readonly dictionary 
  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). 
  46   
  47  @type DrawTypes: readonly dictionary 
  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 
  54   
  55  @type ParentTypes: readonly dictionary 
  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. 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. 
  64                           
  65   
  66  @type ProtectFlags: readonly dictionary 
  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 
  73   
  74  @type PITypes: readonly dictionary 
  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 
  82   
  83  @type RBFlags: readonly dictionary 
  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) 
  98                  - CHILD: reserved 
  99   
 100  @type IpoKeyTypes: readonly dictionary 
 101  @var IpoKeyTypes: Constant dict used for with L{Object.insertIpoKey} attribute. 
 102          Values can be ORed together. 
 103                  - LOC 
 104                  - ROT 
 105                  - SIZE 
 106                  - LOCROT 
 107                  - LOCROTSIZE 
 108                  - LAYER 
 109                  - PI_STRENGTH 
 110                  - PI_FALLOFF 
 111                  - PI_SURFACEDAMP 
 112                  - PI_RANDOMDAMP 
 113                  - PI_PERM 
 114   
 115  @type RBShapes: readonly dictionary 
 116  @var RBShapes: Constant dict used for with L{Object.rbShapeBoundType} 
 117          attribute.  Only one type can be selected at a time.  Values are 
 118          BOX, SPHERE, CYLINDER, CONE, and POLYHEDERON 
 119   
 120  @type EmptyShapes: readonly dictionary 
 121  @var EmptyShapes: Constant dict used for with L{Object.emptyShape} attribute. 
 122          Only one type can be selected at a time. Values are 
 123          ARROW, ARROWS, AXES, CIRCLE, CONE, CUBE AND SPHERE 
 124  """ 
 125   
126 -def New (type, name='type'):
127 """ 128 Creates a new Object. Deprecated; instead use Scene.objects.new(). 129 @type type: string 130 @param type: The Object type: 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice', 131 'Mball', 'Mesh', 'Surf' or 'Empty'. 132 @type name: string 133 @param name: The name of the object. By default, the name will be the same 134 as the object type. 135 If the name is already in use, this new object will have a number at the end of the name. 136 @return: The created Object. 137 138 I{B{Example:}} 139 140 The example below creates a new Lamp object and puts it at the default 141 location (0, 0, 0) in the current scene:: 142 import Blender 143 144 object = Blender.Object.New('Lamp') 145 lamp = Blender.Lamp.New('Spot') 146 object.link(lamp) 147 sce = Blender.Scene.GetCurrent() 148 sce.link(object) 149 150 Blender.Redraw() 151 @Note: if an object is created but is not linked to object data, and the 152 object is not linked to a scene, it will be deleted when the Python 153 object is deallocated. This is because Blender does not allow objects 154 to exist without object data unless they are Empty objects. Scene.link() 155 will automatically create object data for an object if it has none. 156 """
157
158 -def Get (name = None):
159 """ 160 Get the Object from Blender. 161 @type name: string 162 @param name: The name of the requested Object. 163 @return: It depends on the 'name' parameter: 164 - (name): The Object with the given name; 165 - (): A list with all Objects in the current scene. 166 167 I{B{Example 1:}} 168 169 The example below works on the default scene. The script returns the plane object and prints the location of the plane:: 170 import Blender 171 172 object = Blender.Object.Get ('plane') 173 print object.getLocation() 174 175 I{B{Example 2:}} 176 177 The example below works on the default scene. The script returns all objects 178 in the scene and prints the list of object names:: 179 import Blender 180 181 objects = Blender.Object.Get () 182 print objects 183 @note: Get will return objects from all scenes. 184 Most user tools should only operate on objects from the current scene - Blender.Scene.GetCurrent().getChildren() 185 """
186
187 -def GetSelected ():
188 """ 189 Get the user selection. If no objects are selected, an empty list will be returned. 190 191 @return: A list of all selected Objects in the current scene. 192 193 I{B{Example:}} 194 195 The example below works on the default scene. Select one or more objects and 196 the script will print the selected objects:: 197 import Blender 198 199 objects = Blender.Object.GetSelected() 200 print objects 201 @note: The active object will always be the first object in the list (if selected). 202 @note: The user selection is made up of selected objects from Blender's current scene only. 203 @note: The user selection is limited to objects on visible layers; 204 if the user's last active 3d view is in localview then the selection will be limited to the objects in that localview. 205 """
206 207
208 -def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=0, material=0, texture=0, ipo=0, psys=0):
209 """ 210 Duplicate selected objects on visible layers from Blenders current scene, 211 de-selecting the currently visible, selected objects and making a copy where all new objects are selected. 212 By default no data linked to the object is duplicated; use the keyword arguments to change this. 213 L{Object.GetSelected()<GetSelected>} will return the list of objects resulting from duplication. 214 215 B{Note}: This command will raise an error if used from the command line (background mode) because it uses the 3D view context. 216 217 @type mesh: bool 218 @param mesh: When non-zero, mesh object data will be duplicated with the objects. 219 @type surface: bool 220 @param surface: When non-zero, surface object data will be duplicated with the objects. 221 @type curve: bool 222 @param curve: When non-zero, curve object data will be duplicated with the objects. 223 @type text: bool 224 @param text: When non-zero, text object data will be duplicated with the objects. 225 @type metaball: bool 226 @param metaball: When non-zero, metaball object data will be duplicated with the objects. 227 @type armature: bool 228 @param armature: When non-zero, armature object data will be duplicated with the objects. 229 @type lamp: bool 230 @param lamp: When non-zero, lamp object data will be duplicated with the objects. 231 @type material: bool 232 @param material: When non-zero, materials used by the object or its object data will be duplicated with the objects. 233 @type texture: bool 234 @param texture: When non-zero, texture data used by the object's materials will be duplicated with the objects. 235 @type ipo: bool 236 @param ipo: When non-zero, Ipo data linked to the object will be duplicated with the objects. 237 @type psys: bool 238 @param psys: When non-zero, particle systems used by the object or its object data will be duplicated with the objects. 239 240 I{B{Example:}} 241 242 The example below creates duplicates the active object 10 times 243 and moves each object 1.0 on the X axis:: 244 import Blender 245 246 scn = Scene.GetCurrent() 247 ob_act = scn.objects.active 248 249 # Unselect all 250 scn.objects.selected = [] 251 ob_act.sel = 1 252 253 for x in xrange(10): 254 Blender.Object.Duplicate() # Duplicate linked 255 ob_act = scn.objects.active 256 ob_act.LocX += 1 257 Blender.Redraw() 258 """
259 260 from IDProp import IDGroup, IDArray
261 -class Object:
262 """ 263 The Object object 264 ================= 265 This object gives access to generic data from all objects in Blender. 266 267 B{Note}: 268 When dealing with properties and functions such as LocX/RotY/getLocation(), getSize() and getEuler(), 269 keep in mind that these transformation properties are relative to the object itself, ignoring any other transformations. 270 271 To get these values in worldspace (taking into account vertex parents, constraints, etc.) 272 pass the argument 'worldspace' to these functions. 273 274 @ivar restrictDisplay: Don't display this object in the 3D view: disabled by default, use the outliner to toggle. 275 @type restrictDisplay: bool 276 @ivar restrictSelect: Don't select this object in the 3D view: disabled by default, use the outliner to toggle. 277 @type restrictSelect: bool 278 @ivar restrictRender: Don't render this object: disabled by default, use the outliner to toggle. 279 @type restrictRender: bool 280 @ivar LocX: The X location coordinate of the object. 281 @type LocX: float 282 @ivar LocY: The Y location coordinate of the object. 283 @type LocY: float 284 @ivar LocZ: The Z location coordinate of the object. 285 @type LocZ: float 286 @ivar loc: The (X,Y,Z) location coordinates of the object. 287 @type loc: tuple of 3 floats 288 @ivar dLocX: The delta X location coordinate of the object. 289 This variable applies to IPO Objects only. 290 @type dLocX: float 291 @ivar dLocY: The delta Y location coordinate of the object. 292 This variable applies to IPO Objects only. 293 @type dLocY: float 294 @ivar dLocZ: The delta Z location coordinate of the object. 295 This variable applies to IPO Objects only. 296 @type dLocZ: float 297 @ivar dloc: The delta (X,Y,Z) location coordinates of the object (vector). 298 This variable applies to IPO Objects only. 299 @type dloc: tuple of 3 floats 300 @ivar RotX: The X rotation angle (in radians) of the object. 301 @type RotX: float 302 @ivar RotY: The Y rotation angle (in radians) of the object. 303 @type RotY: float 304 @ivar RotZ: The Z rotation angle (in radians) of the object. 305 @type RotZ: float 306 @ivar rot: The (X,Y,Z) rotation angles (in radians) of the object. 307 @type rot: euler (Py_WRAPPED) 308 @ivar dRotX: The delta X rotation angle (in radians) of the object. 309 This variable applies to IPO Objects only. 310 @type dRotX: float 311 @ivar dRotY: The delta Y rotation angle (in radians) of the object. 312 This variable applies to IPO Objects only. 313 @type dRotY: float 314 @ivar dRotZ: The delta Z rotation angle (in radians) of the object. 315 This variable applies to IPO Objects only. 316 @type dRotZ: float 317 @ivar drot: The delta (X,Y,Z) rotation angles (in radians) of the object. 318 This variable applies to IPO Objects only. 319 @type drot: tuple of 3 floats 320 @ivar SizeX: The X size of the object. 321 @type SizeX: float 322 @ivar SizeY: The Y size of the object. 323 @type SizeY: float 324 @ivar SizeZ: The Z size of the object. 325 @type SizeZ: float 326 @ivar size: The (X,Y,Z) size of the object. 327 @type size: tuple of 3 floats 328 @ivar dSizeX: The delta X size of the object. 329 @type dSizeX: float 330 @ivar dSizeY: The delta Y size of the object. 331 @type dSizeY: float 332 @ivar dSizeZ: The delta Z size of the object. 333 @type dSizeZ: float 334 @ivar dsize: The delta (X,Y,Z) size of the object. 335 @type dsize: tuple of 3 floats 336 @ivar Layers: The object layers (also check the newer attribute 337 L{layers<layers>}). This value is a bitmask with at 338 least one position set for the 20 possible layers starting from the low 339 order bit. The easiest way to deal with these values in in hexadecimal 340 notation. 341 Example:: 342 ob.Layer = 0x04 # sets layer 3 ( bit pattern 0100 ) 343 After setting the Layer value, call Blender.Redraw( -1 ) to update 344 the interface. 345 @type Layers: integer (bitmask) 346 @type layers: list of integers 347 @ivar layers: The layers this object is visible in (also check the older 348 attribute L{Layers<Layers>}). This returns a list of 349 integers in the range [1, 20], each number representing the respective 350 layer. Setting is done by passing a list of ints or an empty list for 351 no layers. 352 Example:: 353 ob.layers = [] # object won't be visible 354 ob.layers = [1, 4] # object visible only in layers 1 and 4 355 ls = o.layers 356 ls.append(10) 357 o.layers = ls 358 print ob.layers # will print: [1, 4, 10] 359 B{Note}: changes will only be visible after the screen (at least 360 the 3d View and Buttons windows) is redrawn. 361 @ivar parent: The parent object of the object (if defined). Read-only. 362 @type parent: Object or None 363 @ivar data: The Datablock object linked to this object. Read-only. 364 @type data: varies 365 @ivar ipo: Contains the Ipo if one is assigned to the object, B{None} 366 otherwise. Setting to B{None} clears the current Ipo. 367 @type ipo: Ipo 368 @ivar mat: The matrix of the object in world space (absolute, takes vertex parents, tracking 369 and Ipos into account). Read-only. 370 @type mat: Matrix 371 @ivar matrix: Same as L{mat}. Read-only. 372 @type matrix: Matrix 373 @ivar matrixLocal: The matrix of the object relative to its parent; if there is no parent, 374 returns the world matrix (L{matrixWorld<Object.Object.matrixWorld>}). 375 @type matrixLocal: Matrix 376 @ivar matrixParentInverse: The inverse if the parents local matrix, set when the objects parent is set (wrapped). 377 @type matrixParentInverse: Matrix 378 @ivar matrixOldWorld: Old-type worldspace matrix (prior to Blender 2.34). 379 Read-only. 380 @type matrixOldWorld: Matrix 381 @ivar matrixWorld: Same as L{mat}. Read-only. 382 @type matrixWorld: Matrix 383 @ivar colbits: The Material usage mask. A set bit #n means: the Material 384 #n in the Object's material list is used. Otherwise, the Material #n 385 of the Objects Data material list is displayed. 386 Example:: 387 object.colbits = (1<<0) + (1<<5) # use mesh materials 0 (1<<0) and 5 (1<<5) 388 # use object materials for all others 389 @ivar sel: The selection state of the object in the current scene. 390 True is selected, False is unselected. Setting makes the object active. 391 @type sel: boolean 392 @ivar effects: The list of particle effects associated with the object. (depricated, will always return an empty list) 393 Read-only. 394 @type effects: list of Effect objects 395 @ivar parentbonename: The string name of the parent bone (if defined). 396 This can be set to another bone in the armature if the object already has a bone parent. 397 @type parentbonename: string or None 398 @ivar parentVertexIndex: A list of vertex parent indicies, with a length of 0, 1 or 3. When there are 1 or 3 vertex parents, the indicies can be assigned to a sequence of the same length. 399 @type parentVertexIndex: list 400 @ivar protectFlags: The "transform locking" bitfield flags for the object. 401 See L{ProtectFlags} const dict for values. 402 @type protectFlags: int 403 @ivar DupGroup: The DupliGroup Animation Property. Assign a group to 404 DupGroup to make this object an instance of that group. 405 This does not enable or disable the DupliGroup option, for that use 406 L{enableDupGroup}. 407 The attribute returns None when this object does not have a dupliGroup, 408 and setting the attrbute to None deletes the object from the group. 409 @type DupGroup: Group or None 410 @ivar DupObjects: The Dupli object instances. Read-only. 411 Returns of list of tuples for object duplicated 412 by dupliframe, dupliverts dupligroups and other animation properties. 413 The first tuple item is the original object that is duplicated, 414 the second is the 4x4 worldspace dupli-matrix. 415 Example:: 416 import Blender 417 from Blender import Object, Scene, Mathutils 418 419 ob= Object.Get('Cube') 420 dupe_obs= ob.DupObjects 421 scn= Scene.GetCurrent() 422 for dupe_ob, dupe_matrix in dupe_obs: 423 print dupe_ob.name 424 empty_ob = scn.objects.new('Empty') 425 empty_ob.setMatrix(dupe_matrix) 426 Blender.Redraw() 427 @type DupObjects: list of tuples containing (object, matrix) 428 @ivar enableNLAOverride: Whether the object uses NLA or active Action for animation. When True the NLA is used. 429 @type enableNLAOverride: boolean 430 @ivar enableDupVerts: The DupliVerts status of the object. 431 Does not indicate that this object has any dupliVerts, 432 (as returned by L{DupObjects}) just that dupliVerts are enabled. 433 @type enableDupVerts: boolean 434 @ivar enableDupFaces: The DupliFaces status of the object. 435 Does not indicate that this object has any dupliFaces, 436 (as returned by L{DupObjects}) just that dupliFaces are enabled. 437 @type enableDupFaces: boolean 438 @ivar enableDupFacesScale: The DupliFacesScale status of the object. 439 @type enableDupFacesScale: boolean 440 @ivar dupFacesScaleFac: Scale factor for dupliface instance, 1.0 by default. 441 @type dupFacesScaleFac: float 442 @ivar enableDupFrames: The DupliFrames status of the object. 443 Does not indicate that this object has any dupliFrames, 444 (as returned by L{DupObjects}) just that dupliFrames are enabled. 445 @type enableDupFrames: boolean 446 @ivar enableDupGroup: The DupliGroup status of the object. 447 Set True to make this object an instance of the object's L{DupGroup}, 448 and set L{DupGroup} to a group for this to take effect, 449 Use L{DupObjects} to get the object data from this instance. 450 @type enableDupGroup: boolean 451 @ivar enableDupRot: The DupliRot status of the object. 452 Use with L{enableDupVerts} to rotate each instance 453 by the vertex normal. 454 @type enableDupRot: boolean 455 @ivar enableDupNoSpeed: The DupliNoSpeed status of the object. 456 Use with L{enableDupFrames} to ignore dupliFrame speed. 457 @type enableDupNoSpeed: boolean 458 @ivar DupSta: The DupliFrame starting frame. Use with L{enableDupFrames}. 459 Value clamped to [1,32767]. 460 @type DupSta: int 461 @ivar DupEnd: The DupliFrame end frame. Use with L{enableDupFrames}. 462 Value clamped to [1,32767]. 463 @type DupEnd: int 464 @ivar DupOn: The DupliFrames in succession between DupOff frames. 465 Value is clamped to [1,1500]. 466 Use with L{enableDupFrames} and L{DupOff} > 0. 467 @type DupOn: int 468 @ivar DupOff: The DupliFrame removal of every Nth frame for this object. 469 Use with L{enableDupFrames}. Value is clamped to [0,1500]. 470 @type DupOff: int 471 @ivar passIndex: Index # for the IndexOB render pass. 472 Value is clamped to [0,1000]. 473 @type passIndex: int 474 @ivar activeMaterial: The active material index for this object. 475 476 The active index is used to select the material to edit in the material buttons, 477 new data created will also use the active material. 478 479 Value is clamped to [1,len(ob.materials)]. - [0,0] when there is no materials applied to the object. 480 @type activeMaterial: int 481 @ivar activeShape: The active shape key index for this object. 482 483 The active index is used to select the material to edit in the material buttons, 484 new data created will also use the active material. 485 486 Value is clamped to [1,len(ob.data.key.blocks)]. - [0,0] when there are no keys. 487 488 @type activeShape: int 489 490 @ivar pinShape: If True, only the activeShape will be displayed. 491 @type pinShape: bool 492 @ivar drawSize: The size to display the Empty. 493 Value clamped to [0.01,10.0]. 494 @type drawSize: float 495 @ivar modifiers: The modifiers associated with the object. 496 Example:: 497 # copy the active objects modifiers to all other visible selected objects 498 from Blender import * 499 scn = Scene.GetCurrent() 500 ob_act = scn.objects.active 501 for ob in scn.objects.context: 502 # Cannot copy modifiers to an object of a different type 503 if ob.type == ob_act.type: 504 ob.modifiers = ob_act.modifiers 505 @type modifiers: L{Modifier Sequence<Modifier.ModSeq>} 506 @ivar constraints: a L{sequence<Constraint.Constraints>} of 507 L{constraints<Constraint.Constraint>} for the object. Read-only. 508 @type constraints: Constraint Sequence 509 @ivar actionStrips: a L{sequence<NLA.ActionStrips>} of 510 L{action strips<NLA.ActionStrip>} for the object. Read-only. 511 @type actionStrips: BPy_ActionStrips 512 @ivar action: The action associated with this object (if defined). 513 @type action: L{Action<NLA.Action>} or None 514 @ivar oopsLoc: Object's (X,Y) OOPs location. Returns None if object 515 is not found in list. 516 @type oopsLoc: tuple of 2 floats 517 @ivar oopsSel: Object OOPs selection flag. 518 @type oopsSel: boolean 519 @ivar game_properties: The object's properties. Read-only. 520 @type game_properties: list of Properties. 521 @ivar timeOffset: The time offset of the object's animation. 522 Value clamped to [-300000.0,300000.0]. 523 @type timeOffset: float 524 @ivar track: The object's tracked object. B{None} is returned if no 525 object is tracked. Also, assigning B{None} clear the tracked object. 526 @type track: Object or None 527 @ivar type: The object's type. Read-only. 528 @type type: string 529 @ivar boundingBox: The bounding box of this object. Read-only. 530 @type boundingBox: list of 8 3D vectors 531 @ivar drawType: The object's drawing type. 532 See L{DrawTypes} constant dict for values. 533 @type drawType: int 534 @ivar emptyShape: The empty drawing shape. 535 See L{EmptyShapes} constant dict for values. 536 @ivar parentType: The object's parent type. Read-only. 537 See L{ParentTypes} constant dict for values. 538 @type parentType: int 539 @ivar axis: Enable display of active object's center and axis. 540 Also see B{AXIS} bit in L{drawMode} attribute. 541 @type axis: boolean 542 @ivar texSpace: Enable display of active object's texture space. 543 Also see B{TEXSPACE} bit in L{drawMode} attribute. 544 @type texSpace: boolean 545 @ivar nameMode: Enable display of active object's name. 546 Also see B{NAME} bit in L{drawMode} attribute. 547 @type nameMode: boolean 548 @ivar wireMode: Enable the active object's wireframe over solid drawing. 549 Also see B{WIRE} bit in L{drawMode} attribute. 550 @type wireMode: boolean 551 @ivar xRay: Enable drawing the active object in front of others. 552 Also see B{XRAY} bit in L{drawMode} attribute. 553 @type xRay: boolean 554 @ivar transp: Enable transparent materials for the active object 555 (mesh only). Also see B{TRANSP} bit in L{drawMode} attribute. 556 @type transp: boolean 557 @ivar color: Object color used by the game engine and optionally for materials, 4 floats for RGBA object color. 558 @type color: tuple of 4 floats between 0 and 1 559 @ivar drawMode: The object's drawing mode bitfield. 560 See L{DrawModes} constant dict for values. 561 @type drawMode: int 562 563 @ivar piType: Type of particle interaction. 564 See L{PITypes} constant dict for values. 565 @type piType: int 566 @ivar piFalloff: The particle interaction falloff power. 567 Value clamped to [0.0,10.0]. 568 @type piFalloff: float 569 @ivar piMaxDist: Max distance for the particle interaction field to work. 570 Value clamped to [0.0,1000.0]. 571 @type piMaxDist: float 572 @ivar piPermeability: Probability that a particle will pass through the 573 mesh. Value clamped to [0.0,1.0]. 574 @type piPermeability: float 575 @ivar piRandomDamp: Random variation of particle interaction damping. 576 Value clamped to [0.0,1.0]. 577 @type piRandomDamp: float 578 @ivar piSoftbodyDamp: Damping factor for softbody deflection. 579 Value clamped to [0.0,1.0]. 580 @type piSoftbodyDamp: float 581 @ivar piSoftbodyIThick: Inner face thickness for softbody deflection. 582 Value clamped to [0.001,1.0]. 583 @type piSoftbodyIThick: float 584 @ivar piSoftbodyOThick: Outer face thickness for softbody deflection. 585 Value clamped to [0.001,1.0]. 586 @type piSoftbodyOThick: float 587 @ivar piStrength: Particle interaction force field strength. 588 Value clamped to [0.0,1000.0]. 589 @type piStrength: float 590 @ivar piSurfaceDamp: Amount of damping during particle collision. 591 Value clamped to [0.0,1.0]. 592 @type piSurfaceDamp: float 593 @ivar piUseMaxDist: Use a maximum distance for the field to work. 594 @type piUseMaxDist: boolean 595 596 @ivar isSoftBody: True if object is a soft body. Read-only. 597 @type isSoftBody: boolean 598 @ivar SBDefaultGoal: Default softbody goal value, when no vertex group used. 599 Value clamped to [0.0,1.0]. 600 @type SBDefaultGoal: float 601 @ivar SBErrorLimit: Softbody Runge-Kutta ODE solver error limit (low values give more precision). 602 Value clamped to [0.01,1.0]. 603 @type SBErrorLimit: float 604 @ivar SBFriction: General media friction for softbody point movements. 605 Value clamped to [0.0,10.0]. 606 @type SBFriction: float 607 @ivar SBGoalFriction: Softbody goal (vertex target position) friction. 608 Value clamped to [0.0,10.0]. 609 @type SBGoalFriction: float 610 @ivar SBGoalSpring: Softbody goal (vertex target position) spring stiffness. 611 Value clamped to [0.0,0.999]. 612 @type SBGoalSpring: float 613 @ivar SBGrav: Apply gravitation to softbody point movement. 614 Value clamped to [0.0,10.0]. 615 @type SBGrav: float 616 @ivar SBInnerSpring: Softbody edge spring stiffness. 617 Value clamped to [0.0,0.999]. 618 @type SBInnerSpring: float 619 @ivar SBInnerSpringFrict: Softbody edge spring friction. 620 Value clamped to [0.0,10.0]. 621 @type SBInnerSpringFrict: float 622 @ivar SBMass: Softbody point mass (heavier is slower). 623 Value clamped to [0.001,50.0]. 624 @type SBMass: float 625 @ivar SBMaxGoal: Softbody goal maximum (vertex group weights scaled to 626 match this range). Value clamped to [0.0,1.0]. 627 @type SBMaxGoal: float 628 @ivar SBMinGoal: Softbody goal minimum (vertex group weights scaled to 629 match this range). Value clamped to [0.0,1.0]. 630 @type SBMinGoal: float 631 @ivar SBSpeed: Tweak timing for physics to control softbody frequency and 632 speed. Value clamped to [0.0,10.0]. 633 @type SBSpeed: float 634 @ivar SBStiffQuads: Softbody adds diagonal springs on 4-gons enabled. 635 @type SBStiffQuads: boolean 636 @ivar SBUseEdges: Softbody use edges as springs enabled. 637 @type SBUseEdges: boolean 638 @ivar SBUseGoal: Softbody forces for vertices to stick to animated position enabled. 639 @type SBUseGoal: boolean 640 641 @ivar rbFlags: Rigid body bitfield. See L{RBFlags} for valid values. 642 @type rbFlags: int 643 @ivar rbMass: Rigid body mass. Must be a positive value. 644 @type rbMass: float 645 @ivar rbRadius: Rigid body bounding sphere size. Must be a positive 646 value. 647 @type rbRadius: float 648 @ivar rbShapeBoundType: Rigid body shape bound type. See L{RBShapes} 649 const dict for values. 650 @type rbShapeBoundType: int 651 @ivar trackAxis: Track axis. Return string 'X' | 'Y' | 'Z' | '-X' | '-Y' | '-Z' (readonly) 652 @type trackAxis: string 653 @ivar upAxis: Up axis. Return string 'Y' | 'Y' | 'Z' (readonly) 654 @type upAxis: string 655 """
656 - def getParticleSystems():
657 """ 658 Return a list of particle systems linked to this object (see Blender.Particle). 659 """
660
661 - def newParticleSystem(name = None):
662 """ 663 Link a particle system (see Blender.Particle). If no name is 664 given, a new particle system is created. If a name is given and a 665 particle system with that name exists, it is linked to the object. 666 @type name: string 667 @param name: The name of the requested Particle system (optional). 668 @return: The particle system linked. 669 """
670
671 - def addVertexGroupsFromArmature(object):
672 """ 673 Add vertex groups from armature using the bone heat method 674 This method can be only used with an Object of the type Mesh when NOT in edit mode. 675 @type object: a bpy armature 676 """
677
678 - def buildParts():
679 """ 680 Recomputes the particle system. This method only applies to an Object of 681 the type Effect. (depricated, does nothing now, use makeDisplayList instead to update the modifier stack) 682 """
683
684 - def insertShapeKey():
685 """ 686 Insert a Shape Key in the current object. It applies to Objects of 687 the type Mesh, Lattice, or Curve. 688 """
689
690 - def getPose():
691 """ 692 Gets the current Pose of the object. 693 @rtype: Pose object 694 @return: the current pose object 695 """
696
697 - def evaluatePose(framenumber):
698 """ 699 Evaluates the Pose based on its currently bound action at a certain frame. 700 @type framenumber: Int 701 @param framenumber: The frame number to evaluate to. 702 """
703
704 - def clearIpo():
705 """ 706 Unlinks the ipo from this object. 707 @return: True if there was an ipo linked or False otherwise. 708 """
709
710 - def clrParent(mode = 0, fast = 0):
711 """ 712 Clears parent object. 713 @type mode: Integer 714 @type fast: Integer 715 @param mode: A mode flag. If mode flag is 2, then the object transform will 716 be kept. Any other value, or no value at all will update the object 717 transform. 718 @param fast: If the value is 0, the scene hierarchy will not be updated. Any 719 other value, or no value at all will update the scene hierarchy. 720 """
721
722 - def getData(name_only=False, mesh=False):
723 """ 724 Returns the Datablock object (Mesh, Lamp, Camera, etc.) linked to this 725 Object. If the keyword parameter B{name_only} is True, only the Datablock 726 name is returned as a string. It the object is of type Mesh, then the 727 B{mesh} keyword can also be used; the data return is a Mesh object if 728 True, otherwise it is an NMesh object (the default). 729 The B{mesh} keyword is ignored for non-mesh objects. 730 @type name_only: bool 731 @param name_only: This is a keyword parameter. If True (or nonzero), 732 only the name of the data object is returned. 733 @type mesh: bool 734 @param mesh: This is a keyword parameter. If True (or nonzero), 735 a Mesh data object is returned. 736 @rtype: specific Object type or string 737 @return: Depends on the type of Datablock linked to the Object. If 738 B{name_only} is True, it returns a string. 739 @note: Mesh is faster than NMesh because Mesh is a thin wrapper. 740 @note: This function is different from L{NMesh.GetRaw} and L{Mesh.Get} 741 because it keeps a link to the original mesh, which is needed if you are 742 dealing with Mesh weight groups. 743 @note: Make sure the object you are getting the data from isn't in 744 EditMode before calling this function; otherwise you'll get the data 745 before entering EditMode. See L{Window.EditMode}. 746 """
747
748 - def getParentBoneName():
749 """ 750 Returns None, or the 'sub-name' of the parent (eg. Bone name) 751 @return: string 752 """
753
754 - def getDeltaLocation():
755 """ 756 Returns the object's delta location in a list (x, y, z) 757 @rtype: A vector triple 758 @return: (x, y, z) 759 """
760
761 - def getDrawMode():
762 """ 763 Returns the object draw mode. 764 @rtype: Integer 765 @return: a sum of the following: 766 - 2 - axis 767 - 4 - texspace 768 - 8 - drawname 769 - 16 - drawimage 770 - 32 - drawwire 771 - 64 - xray 772 """
773
774 - def getDrawType():
775 """ 776 Returns the object draw type 777 @rtype: Integer 778 @return: One of the following: 779 - 1 - Bounding box 780 - 2 - Wire 781 - 3 - Solid 782 - 4 - Shaded 783 - 5 - Textured 784 """
785
786 - def getEuler(space):
787 """ 788 @type space: string 789 @param space: The desired space for the size: 790 - localspace: (default) location without other transformations 791 - worldspace: location taking vertex parents, tracking and 792 Ipos into account 793 Returns the object's localspace rotation as Euler rotation vector (rotX, rotY, rotZ). Angles are in radians. 794 @rtype: Py_Euler 795 @return: A python Euler. Data is wrapped when euler is present. 796 """
797
798 - def getInverseMatrix():
799 """ 800 Returns the object's inverse matrix. 801 @rtype: Py_Matrix 802 @return: A python matrix 4x4 803 """
804
805 - def getIpo():
806 """ 807 Returns the Ipo associated to this object or None if there's no linked ipo. 808 @rtype: Ipo 809 @return: the wrapped ipo or None. 810 """
811 - def isSelected():
812 """ 813 Returns the objects selection state in the current scene as a boolean value True or False. 814 @rtype: Boolean 815 @return: Selection state as True or False 816 """
817
818 - def getLocation(space):
819 """ 820 @type space: string 821 @param space: The desired space for the location: 822 - localspace: (default) location without other transformations 823 - worldspace: location taking vertex parents, tracking and 824 Ipos into account 825 Returns the object's location (x, y, z). 826 @return: (x, y, z) 827 828 I{B{Example:}} 829 830 The example below works on the default scene. It retrieves all objects in 831 the scene and prints the name and location of each object:: 832 import Blender 833 834 sce = Blender.Scene.GetCurrent() 835 836 for ob in sce.objects: 837 print obj.name 838 print obj.loc 839 @note: the worldspace location is the same as ob.matrixWorld[3][0:3] 840 """
841
842 - def getAction():
843 """ 844 Returns an action if one is associated with this object (only useful for armature types). 845 @rtype: Py_Action 846 @return: a python action. 847 """
848
849 - def getMaterials(what = 0):
850 """ 851 Returns a list of materials assigned to the object. 852 @type what: int 853 @param what: if nonzero, empty slots will be returned as None's instead 854 of being ignored (default way). See L{NMesh.NMesh.getMaterials}. 855 @rtype: list of Material Objects 856 @return: list of Material Objects assigned to the object. 857 @warn. Not used much. To get a list of the materials assigned to the object, 858 use mat=ob.getData(mesh=1).materials instead 859 """
860
861 - def getMatrix(space = 'worldspace'):
862 """ 863 Returns the object matrix. 864 @type space: string 865 @param space: The desired matrix: 866 - worldspace (default): absolute, taking vertex parents, tracking and 867 Ipo's into account; 868 - localspace: relative to the object's parent (returns worldspace 869 matrix if the object doesn't have a parent); 870 - old_worldspace: old behavior, prior to Blender 2.34, where eventual 871 changes made by the script itself were not taken into account until 872 a redraw happened, either called by the script or upon its exit. 873 Returns the object matrix. 874 @rtype: Py_Matrix (WRAPPED DATA) 875 @return: a python 4x4 matrix object. Data is wrapped for 'worldspace' 876 """
877
878 - def getName():
879 """ 880 Returns the name of the object 881 @return: The name of the object 882 883 I{B{Example:}} 884 885 The example below works on the default scene. It retrieves all objects in 886 the scene and prints the name of each object:: 887 import Blender 888 889 sce= Blender.Scene.GetCurrent() 890 891 for ob in sce.objects: 892 print ob.getName() 893 """
894
895 - def getParent():
896 """ 897 Returns the object's parent object. 898 @rtype: Object 899 @return: The parent object of the object. If not available, None will be 900 returned. 901 """
902
903 - def getSize(space):
904 """ 905 @type space: string 906 @param space: The desired space for the size: 907 - localspace: (default) location without other transformations 908 - worldspace: location taking vertex parents, tracking and 909 Ipos into account 910 Returns the object's size. 911 @return: (SizeX, SizeY, SizeZ) 912 @note: the worldspace size will not return negative (flipped) scale values. 913 """
914
915 - def getParentBoneName():
916 """ 917 Returns the object's parent object's sub name, or None. 918 For objects parented to bones, this is the name of the bone. 919 @rtype: String 920 @return: The parent object sub-name of the object. 921 If not available, None will be returned. 922 """
923
924 - def getTimeOffset():
925 """ 926 Returns the time offset of the object's animation. 927 @return: TimeOffset 928 """
929
930 - def getTracked():
931 """ 932 Returns the object's tracked object. 933 @rtype: Object 934 @return: The tracked object of the object. If not available, None will be 935 returned. 936 """
937
938 - def getType():
939 """ 940 Returns the type of the object in 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice', 941 'Mball', 'Mesh', 'Surf', 'Empty', 'Wave' (deprecated) or 'unknown' in exceptional cases. 942 943 I{B{Example:}} 944 945 The example below works on the default scene. It retrieves all objects in 946 the scene and updates the location and rotation of the camera. When run, 947 the camera will rotate 180 degrees and moved to the opposite side of the X 948 axis. Note that the number 'pi' in the example is an approximation of the 949 true number 'pi'. A better, less error-prone value of pi is math.pi from the python math module.:: 950 import Blender 951 952 sce = Blender.Scene.GetCurrent() 953 954 for obj in sce.objects: 955 if obj.type == 'Camera': 956 obj.LocY = -obj.LocY 957 obj.RotZ = 3.141592 - obj.RotZ 958 959 Blender.Redraw() 960 961 @return: The type of object. 962 @rtype: String 963 """
964
965 - def insertIpoKey(keytype):
966 """ 967 Inserts keytype values in object ipo at curframe. 968 @type keytype: int 969 @param keytype: A constant from L{IpoKeyTypes<Object.IpoKeyTypes>} 970 @return: None 971 """
972 980
981 - def makeParent(objects, noninverse = 0, fast = 0):
982 """ 983 Makes the object the parent of the objects provided in the argument which 984 must be a list of valid Objects. 985 @type objects: Sequence of Blender Object 986 @param objects: The children of the parent 987 @type noninverse: Integer 988 @param noninverse: 989 0 - make parent with inverse 990 1 - make parent without inverse 991 @type fast: Integer 992 @param fast: 993 0 - update scene hierarchy automatically 994 1 - don't update scene hierarchy (faster). In this case, you must 995 explicitely update the Scene hierarchy. 996 @warn: objects must first be linked to a scene before they can become 997 parents of other objects. Calling this makeParent method for an 998 unlinked object will result in an error. 999 """
1000
1001 - def join(objects):
1002 """ 1003 Uses the object as a base for all of the objects in the provided list to join into. 1004 1005 @type objects: Sequence of Blender Object 1006 @param objects: A list of objects matching the object's type. 1007 @note: Objects in the list will not be removed from the scene. 1008 To avoid overlapping data you may want to remove them manually after joining. 1009 @note: Join modifies the base object's data in place so that 1010 other objects are joined into it. No new object or data is created. 1011 @note: Join will only work for object types Mesh, Armature, Curve and Surface; 1012 an excption will be raised if the object is not of these types. 1013 @note: Objects in the list will be ignored if they to not match the base object. 1014 @note: The base object must be in the current scene to be joined. 1015 @note: This function will not work in background mode (no user interface). 1016 @note: An error in the function input will raise a TypeError or AttributeError, 1017 otherwise an error in the data input will raise a RuntimeError. 1018 For situations where you don't have tight control on the data that is being joined, 1019 you should handle the RuntimeError error, letting the user know the data can't be joined. 1020 """
1021
1022 - def makeParentDeform(objects, noninverse = 0, fast = 0):
1023 """ 1024 Makes the object the deformation parent of the objects provided in the argument 1025 which must be a list of valid Objects. 1026 The parent object must be a Curve or Armature. 1027 @type objects: Sequence of Blender Object 1028 @param objects: The children of the parent 1029 @type noninverse: Integer 1030 @param noninverse: 1031 0 - make parent with inverse 1032 1 - make parent without inverse 1033 @type fast: Integer 1034 @param fast: 1035 0 - update scene hierarchy automatically 1036 1 - don't update scene hierarchy (faster). In this case, you must 1037 explicitely update the Scene hierarchy. 1038 @warn: objects must first be linked to a scene before they can become 1039 parents of other objects. Calling this makeParent method for an 1040 unlinked object will result in an error. 1041 @warn: child objects must be of mesh type to deform correctly. Other object 1042 types will fall back to normal parenting silently. 1043 """
1044
1045 - def makeParentVertex(objects, indices, noninverse = 0, fast = 0):
1046 """ 1047 Makes the object the vertex parent of the objects provided in the argument 1048 which must be a list of valid Objects. 1049 The parent object must be a Mesh, Curve or Surface. 1050 @type objects: Sequence of Blender Object 1051 @param objects: The children of the parent 1052 @type indices: Tuple of Integers 1053 @param indices: The indices of the vertices you want to parent to (1 or 3 values) 1054 @type noninverse: Integer 1055 @param noninverse: 1056 0 - make parent with inverse 1057 1 - make parent without inverse 1058 @type fast: Integer 1059 @param fast: 1060 0 - update scene hierarchy automatically 1061 1 - don't update scene hierarchy (faster). In this case, you must 1062 explicitely update the Scene hierarchy. 1063 @warn: objects must first be linked to a scene before they can become 1064 parents of other objects. Calling this makeParent method for an 1065 unlinked object will result in an error. 1066 """
1067 - def makeParentBone(objects, bonename, noninverse = 0, fast = 0):
1068 """ 1069 Makes one of the object's bones the parent of the objects provided in the argument 1070 which must be a list of valid objects. The parent object must be an Armature. 1071 @type objects: Sequence of Blender Object 1072 @param objects: The children of the parent 1073 @type bonename: string 1074 @param bonename: a valid bone name from the armature 1075 @type noninverse: integer 1076 @param noninverse: 1077 0 - make parent with inverse 1078 1 - make parent without inverse 1079 @type fast: integer 1080 @param fast: 1081 0 - update scene hierarchy automatically 1082 1 - don't update scene hierarchy (faster). In this case, you must 1083 explicitly update the Scene hierarchy. 1084 @warn: Objects must first be linked to a scene before they can become 1085 parents of other objects. Calling this method for an 1086 unlinked object will result in an exception. 1087 """
1088
1089 - def setDeltaLocation(delta_location):
1090 """ 1091 Sets the object's delta location which must be a vector triple. 1092 @type delta_location: A vector triple 1093 @param delta_location: A vector triple (x, y, z) specifying the new 1094 location. 1095 """
1096
1097 - def setDrawMode(drawmode):
1098 """ 1099 Sets the object's drawing mode. The drawing mode can be a mix of modes. To 1100 enable these, add up the values. 1101 @type drawmode: Integer 1102 @param drawmode: A sum of the following: 1103 - 2 - axis 1104 - 4 - texspace 1105 - 8 - drawname 1106 - 16 - drawimage 1107 - 32 - drawwire 1108 - 64 - xray 1109 """
1110
1111 - def setDrawType(drawtype):
1112 """ 1113 Sets the object's drawing type. 1114 @type drawtype: Integer 1115 @param drawtype: One of the following: 1116 - 1 - Bounding box 1117 - 2 - Wire 1118 - 3 - Solid 1119 - 4 - Shaded 1120 - 5 - Textured 1121 """
1122
1123 - def setEuler(euler):
1124 """ 1125 Sets the object's localspace rotation according to the specified Euler angles. 1126 @type euler: Py_Euler or a list of floats 1127 @param euler: a python Euler or x,y,z rotations as floats 1128 """
1129
1130 - def setIpo(ipo):
1131 """ 1132 Links an ipo to this object. 1133 @type ipo: Blender Ipo 1134 @param ipo: an object type ipo. 1135 """
1136
1137 - def setLocation(x, y, z):
1138 """ 1139 Sets the object's location relative to the parent object (if any). 1140 @type x: float 1141 @param x: The X coordinate of the new location. 1142 @type y: float 1143 @param y: The Y coordinate of the new location. 1144 @type z: float 1145 @param z: The Z coordinate of the new location. 1146 """
1147
1148 - def setMaterials(materials):
1149 """ 1150 Sets the materials. The argument must be a list 16 items or less. Each 1151 list element is either a Material or None. Also see L{colbits}. 1152 @type materials: Materials list 1153 @param materials: A list of Blender material objects. 1154 @note: Materials are assigned to the object's data by default. Unless 1155 you know the material is applied to the object or are changing the 1156 object's L{colbits}, you need to look at the object data's materials. 1157 """
1158
1159 - def setMatrix(matrix):
1160 """ 1161 Sets the object's matrix and updates its transformation. If the object 1162 has a parent, the matrix transform is relative to the parent. 1163 @type matrix: Py_Matrix 3x3 or 4x4 1164 @param matrix: a 3x3 or 4x4 Python matrix. If a 3x3 matrix is given, 1165 it is extended to a 4x4 matrix. 1166 @Note: This method is "bad": when called it changes the location, 1167 rotation and size attributes of the object (since Blender uses these 1168 values to calculate the object's transformation matrix). Ton is 1169 not happy having a method which "pretends" to do a matrix operation. 1170 In the future, this method may be replaced with other methods which 1171 make it easier for the user to determine the correct loc/rot/size values 1172 for necessary for the object. 1173 """
1174
1175 - def setName(name):
1176 """ 1177 Sets the name of the object. A string longer than 20 characters will be shortened. 1178 @type name: String 1179 @param name: The new name for the object. 1180 """
1181
1182 - def setSize(x, y, z):
1183 """ 1184 Sets the object's size, relative to the parent object (if any), clamped 1185 @type x: float 1186 @param x: The X size multiplier. 1187 @type y: float 1188 @param y: The Y size multiplier. 1189 @type z: float 1190 @param z: The Z size multiplier. 1191 """
1192
1193 - def setTimeOffset(timeOffset):
1194 """ 1195 Sets the time offset of the object's animation. 1196 @type timeOffset: float 1197 @param timeOffset: The new time offset for the object's animation. 1198 """
1199
1200 - def shareFrom(object):
1201 """ 1202 Link data of a specified argument with this object. This works only 1203 if both objects are of the same type. 1204 @type object: Blender Object 1205 @param object: A Blender Object of the same type. 1206 @note: This function is faster than using L{getData()} and setData() 1207 because it skips making a Python object from the object's data. 1208 """
1209
1210 - def select(boolean):
1211 """ 1212 Sets the object's selection state in the current scene. 1213 setting the selection will make this object the active object of this scene. 1214 @type boolean: Integer 1215 @param boolean: 1216 - 0 - unselected 1217 - 1 - selected 1218 """
1219
1220 - def getBoundBox(worldspace=1):
1221 """ 1222 Returns the worldspace bounding box of this object. This works for meshes (out of 1223 edit mode) and curves. 1224 @type worldspace: int 1225 @param worldspace: An optional argument. When zero, the bounding values will be localspace. 1226 @rtype: list of 8 (x,y,z) float coordinate vectors (WRAPPED DATA) 1227 @return: The coordinates of the 8 corners of the bounding box. Data is wrapped when 1228 bounding box is present. 1229 """
1230
1231 - def makeDisplayList():
1232 """ 1233 Forces an update to the objects display data. If the object isn't modified, 1234 there's no need to recalculate this data. 1235 This method is here for the *few cases* where it is needed. 1236 1237 Example:: 1238 import Blender 1239 1240 scn = Blender.Scene.GetCurrent() 1241 object = scn.objects.active 1242 object.modifiers.append(Blender.Modifier.Type.SUBSURF) 1243 object.makeDisplayList() 1244 Blender.Window.RedrawAll() 1245 1246 If you try this example without the line to update the display list, the 1247 object will disappear from the screen until you press "SubSurf". 1248 @warn: If after running your script objects disappear from the screen or 1249 are not displayed correctly, try this method function. But if the script 1250 works properly without it, there's no reason to use it. 1251 """
1252 1262 1270 1279
1280 - def makeTrack (tracked, fast = 0):
1281 """ 1282 Make this Object track another. 1283 @type tracked: Blender Object 1284 @param tracked: the object to be tracked. 1285 @type fast: int (bool) 1286 @param fast: if zero, the scene hierarchy is updated automatically. If 1287 you set 'fast' to a nonzero value, don't forget to update the scene 1288 yourself (see L{Scene.Scene.update}). 1289 @note: you also need to clear the rotation (L{setEuler}) of this object 1290 if it was not (0,0,0) already. 1291 """
1292
1293 - def clearTrack (mode = 0, fast = 0):
1294 """ 1295 Make this Object not track another anymore. 1296 @type mode: int (bool) 1297 @param mode: if nonzero the matrix transformation used for tracking is kept. 1298 @type fast: int (bool) 1299 @param fast: if zero, the scene hierarchy is updated automatically. If 1300 you set 'fast' to a nonzero value, don't forget to update the scene 1301 yourself (see L{Scene.Scene.update}). 1302 """
1303
1304 - def getAllProperties ():
1305 """ 1306 Return a list of all game properties from this object. 1307 @rtype: PyList 1308 @return: List of Property objects. 1309 """
1310
1311 - def getProperty (name):
1312 """ 1313 Return a game property from this object matching the name argument. 1314 @type name: string 1315 @param name: the name of the property to get. 1316 @rtype: Property object 1317 @return: The first property that matches name. 1318 """
1319
1320 - def addProperty (name_or_property, data, type):
1321 """ 1322 Add or create a game property for an object. If called with only a 1323 property object, the property is assigned to the object. If called 1324 with a property name string and data object, a new property is 1325 created and added to the object. 1326 @type name_or_property: string or Property object 1327 @param name_or_property: the property name, or a property object. 1328 @type data: string, int or float 1329 @param data: Only valid when I{name_or_property} is a string. 1330 Value depends on what is passed in: 1331 - string: string type property 1332 - int: integer type property 1333 - float: float type property 1334 @type type: string (optional) 1335 @param type: Only valid when I{name_or_property} is a string. 1336 Can be the following: 1337 - 'BOOL' 1338 - 'INT' 1339 - 'FLOAT' 1340 - 'TIME' 1341 - 'STRING' 1342 @warn: If a type is not declared string data will 1343 become string type, int data will become int type 1344 and float data will become float type. Override type 1345 to declare bool type, and time type. 1346 @warn: A property object can be added only once to an object; 1347 you must remove the property from an object to add it elsewhere. 1348 """
1349
1350 - def removeProperty (property):
1351 """ 1352 Remove a game property from an object. 1353 @type property: Property object or string 1354 @param property: Property object or property name to be removed. 1355 """
1356
1357 - def removeAllProperties():
1358 """ 1359 Removes all game properties from an object. 1360 """
1361
1362 - def copyAllPropertiesTo (object):
1363 """ 1364 Copies all game properties from one object to another. 1365 @type object: Object object 1366 @param object: Object that will receive the properties. 1367 """
1368
1369 - def getPIStregth():
1370 """ 1371 Get the Object's Particle Interaction Strength. 1372 @rtype: float 1373 """
1374
1375 - def setPIStrength(strength):
1376 """ 1377 Set the Object's Particle Interaction Strength. 1378 Values between -1000.0 to 1000.0 1379 @rtype: None 1380 @type strength: float 1381 @param strength: the Object's Particle Interaction New Strength. 1382 """
1383
1384 - def getPIFalloff():
1385 """ 1386 Get the Object's Particle Interaction falloff. 1387 @rtype: float 1388 """
1389
1390 - def setPIFalloff(falloff):
1391 """ 1392 Set the Object's Particle Interaction falloff. 1393 Values between 0 to 10.0 1394 @rtype: None 1395 @type falloff: float 1396 @param falloff: the Object's Particle Interaction New falloff. 1397 """
1398
1399 - def getPIMaxDist():
1400 """ 1401 Get the Object's Particle Interaction MaxDist. 1402 @rtype: float 1403 """
1404
1405 - def setPIMaxDist(MaxDist):
1406 """ 1407 Set the Object's Particle Interaction MaxDist. 1408 Values between 0 to 1000.0 1409 @rtype: None 1410 @type MaxDist: float 1411 @param MaxDist: the Object's Particle Interaction New MaxDist. 1412 """
1413
1414 - def getPIType():
1415 """ 1416 Get the Object's Particle Interaction Type. 1417 @rtype: int 1418 """
1419
1420 - def setPIType(type):
1421 """ 1422 Set the Object's Particle Interaction type. 1423 Use Module Constants 1424 - NONE 1425 - WIND 1426 - FORCE 1427 - VORTEX 1428 - MAGNET 1429 @rtype: None 1430 @type type: int 1431 @param type: the Object's Particle Interaction Type. 1432 """
1433
1434 - def getPIUseMaxDist():
1435 """ 1436 Get the Object's Particle Interaction if using MaxDist. 1437 @rtype: int 1438 """
1439
1440 - def setPIUseMaxDist(status):
1441 """ 1442 Set the Object's Particle Interaction MaxDist. 1443 0 = Off, 1 = on 1444 @rtype: None 1445 @type status: int 1446 @param status: the new status 1447 """
1448
1449 - def getPIDeflection():
1450 """ 1451 Get the Object's Particle Interaction Deflection Setting. 1452 @rtype: int 1453 """
1454
1455 - def setPIDeflection(status):
1456 """ 1457 Set the Object's Particle Interaction Deflection Setting. 1458 0 = Off, 1 = on 1459 @rtype: None 1460 @type status: int 1461 @param status: the new status 1462 """
1463
1464 - def getPIPermf():
1465 """ 1466 Get the Object's Particle Interaction Permeability. 1467 @rtype: float 1468 """
1469
1470 - def setPIPerm(perm):
1471 """ 1472 Set the Object's Particle Interaction Permeability. 1473 Values between 0 to 10.0 1474 @rtype: None 1475 @type perm: float 1476 @param perm: the Object's Particle Interaction New Permeability. 1477 """
1478
1479 - def getPIRandomDamp():
1480 """ 1481 Get the Object's Particle Interaction RandomDamp. 1482 @rtype: float 1483 """
1484
1485 - def setPIRandomDamp(damp):
1486 """ 1487 Set the Object's Particle Interaction RandomDamp. 1488 Values between 0 to 10.0 1489 @rtype: None 1490 @type damp: float 1491 @param damp: the Object's Particle Interaction New RandomDamp. 1492 """
1493
1494 - def getPISurfaceDamp():
1495 """ 1496 Get the Object's Particle Interaction SurfaceDamp. 1497 @rtype: float 1498 """
1499
1500 - def setPISurfaceDamp(damp):
1501 """ 1502 Set the Object's Particle Interaction SurfaceDamp. 1503 Values between 0 to 10.0 1504 @rtype: None 1505 @type damp: float 1506 @param damp: the Object's Particle Interaction New SurfaceDamp. 1507 """
1508
1509 - def getSBMass():
1510 """ 1511 Get the Object's SoftBody Mass. 1512 @rtype: float 1513 """
1514
1515 - def setSBMass(mass):
1516 """ 1517 Set the Object's SoftBody Mass. 1518 Values between 0 to 50.0 1519 @rtype: None 1520 @type mass: float 1521 @param mass: the Object's SoftBody New mass. 1522 """
1523
1524 - def getSBGravity():
1525 """ 1526 Get the Object's SoftBody Gravity. 1527 @rtype: float 1528 """
1529
1530 - def setSBGravity(grav):
1531 """ 1532 Set the Object's SoftBody Gravity. 1533 Values between 0 to 10.0 1534 @rtype: None 1535 @type grav: float 1536 @param grav: the Object's SoftBody New Gravity. 1537 """
1538
1539 - def getSBFriction():
1540 """ 1541 Get the Object's SoftBody Friction. 1542 @rtype: float 1543 """
1544
1545 - def setSBFriction(frict):
1546 """ 1547 Set the Object's SoftBody Friction. 1548 Values between 0 to 10.0 1549 @rtype: None 1550 @type frict: float 1551 @param frict: the Object's SoftBody New Friction. 1552 """
1553
1554 - def getSBErrorLimit():
1555 """ 1556 Get the Object's SoftBody ErrorLimit. 1557 @rtype: float 1558 """
1559
1560 - def setSBErrorLimit(err):
1561 """ 1562 Set the Object's SoftBody ErrorLimit. 1563 Values between 0 to 1.0 1564 @rtype: None 1565 @type err: float 1566 @param err: the Object's SoftBody New ErrorLimit. 1567 """
1568
1569 - def getSBGoalSpring():
1570 """ 1571 Get the Object's SoftBody GoalSpring. 1572 @rtype: float 1573 """
1574
1575 - def setSBGoalSpring(gs):
1576 """ 1577 Set the Object's SoftBody GoalSpring. 1578 Values between 0 to 0.999 1579 @rtype: None 1580 @type gs: float 1581 @param gs: the Object's SoftBody New GoalSpring. 1582 """
1583
1584 - def getSBGoalFriction():
1585 """ 1586 Get the Object's SoftBody GoalFriction. 1587 @rtype: float 1588 """
1589
1590 - def setSBGoalFriction(gf):
1591 """ 1592 Set the Object's SoftBody GoalFriction. 1593 Values between 0 to 10.0 1594 @rtype: None 1595 @type gf: float 1596 @param gf: the Object's SoftBody New GoalFriction. 1597 """
1598
1599 - def getSBMinGoal():
1600 """ 1601 Get the Object's SoftBody MinGoal. 1602 @rtype: float 1603 """
1604
1605 - def setSBMinGoal(mg):
1606 """ 1607 Set the Object's SoftBody MinGoal. 1608 Values between 0 to 1.0 1609 @rtype: None 1610 @type mg: float 1611 @param mg: the Object's SoftBody New MinGoal. 1612 """
1613
1614 - def getSBMaxGoal():
1615 """ 1616 Get the Object's SoftBody MaxGoal. 1617 @rtype: float 1618 """
1619
1620 - def setSBMaxGoal(mg):
1621 """ 1622 Set the Object's SoftBody MaxGoal. 1623 Values between 0 to 1.0 1624 @rtype: None 1625 @type mg: float 1626 @param mg: the Object's SoftBody New MaxGoal. 1627 """
1628
1629 - def getSBInnerSpring():
1630 """ 1631 Get the Object's SoftBody InnerSpring. 1632 @rtype: float 1633 """
1634
1635 - def setSBInnerSpring(sprr):
1636 """ 1637 Set the Object's SoftBody InnerSpring. 1638 Values between 0 to 0.999 1639 @rtype: None 1640 @type sprr: float 1641 @param sprr: the Object's SoftBody New InnerSpring. 1642 """
1643
1645 """ 1646 Get the Object's SoftBody InnerSpringFriction. 1647 @rtype: float 1648 """
1649
1650 - def setSBInnerSpringFriction(sprf):
1651 """ 1652 Set the Object's SoftBody InnerSpringFriction. 1653 Values between 0 to 10.0 1654 @rtype: None 1655 @type sprf: float 1656 @param sprf: the Object's SoftBody New InnerSpringFriction. 1657 """
1658
1659 - def getSBDefaultGoal():
1660 """ 1661 Get the Object's SoftBody DefaultGoal. 1662 @rtype: float 1663 """
1664
1665 - def setSBDefaultGoal(goal):
1666 """ 1667 Set the Object's SoftBody DefaultGoal. 1668 Values between 0 to 1.0 1669 @rtype: None 1670 @type goal: float 1671 @param goal: the Object's SoftBody New DefaultGoal. 1672 """
1673
1674 - def isSB():
1675 """ 1676 Returns the Object's SoftBody enabled state. 1677 @rtype: boolean 1678 """
1679
1680 - def getSBPostDef():
1681 """ 1682 get SoftBodies PostDef option 1683 @rtype: int 1684 """
1685
1686 - def setSBPostDef(switch):
1687 """ 1688 Enable / Disable SoftBodies PostDef option 1689 1: on 1690 0: off 1691 @rtype: None 1692 @type switch: int 1693 @param switch: the Object's SoftBody New PostDef Value. 1694 """
1695
1696 - def getSBUseGoal():
1697 """ 1698 get SoftBodies UseGoal option 1699 @rtype: int 1700 """
1701
1702 - def setSBUseGoal(switch):
1703 """ 1704 Enable / Disable SoftBodies UseGoal option 1705 1: on 1706 0: off 1707 @rtype: None 1708 @type switch: int 1709 @param switch: the Object's SoftBody New UseGoal Value. 1710 """
1711 - def getSBUseEdges():
1712 """ 1713 get SoftBodies UseEdges option 1714 @rtype: int 1715 """
1716
1717 - def setSBUseEdges(switch):
1718 """ 1719 Enable / Disable SoftBodies UseEdges option 1720 1: on 1721 0: off 1722 @rtype: None 1723 @type switch: int 1724 @param switch: the Object's SoftBody New UseEdges Value. 1725 """
1726
1727 - def getSBStiffQuads():
1728 """ 1729 get SoftBodies StiffQuads option 1730 @rtype: int 1731 """
1732
1733 - def setSBStiffQuads(switch):
1734 """ 1735 Enable / Disable SoftBodies StiffQuads option 1736 1: on 1737 0: off 1738 @rtype: None 1739 @type switch: int 1740 @param switch: the Object's SoftBody New StiffQuads Value. 1741 """
1742 1743
1744 -class Property:
1745 """ 1746 The Property object 1747 =================== 1748 This property gives access to object property data in Blender, used by the game engine. 1749 @ivar name: The property name. 1750 @ivar data: Data for this property. Depends on property type. 1751 @ivar type: The property type. 1752 @warn: Comparisons between properties will only be true when 1753 both the name and data pairs are the same. 1754 """ 1755
1756 - def getName ():
1757 """ 1758 Get the name of this property. 1759 @rtype: string 1760 @return: The property name. 1761 """
1762
1763 - def setName (name):
1764 """ 1765 Set the name of this property. 1766 @type name: string 1767 @param name: The new name of the property 1768 """
1769
1770 - def getData():
1771 """ 1772 Get the data for this property. 1773 @rtype: string, int, or float 1774 """
1775
1776 - def setData(data):
1777 """ 1778 Set the data for this property. 1779 @type data: string, int, or float 1780 @param data: The data to set for this property. 1781 @warn: See object.setProperty(). Changing data 1782 which is of a different type then the property is 1783 set to (i.e. setting an int value to a float type' 1784 property) will change the type of the property 1785 automatically. 1786 """
1787
1788 - def getType ():
1789 """ 1790 Get the type for this property. 1791 @rtype: string 1792 """
1793 1794 import id_generics 1795 Object.__doc__ += id_generics.attributes 1796