Module Object

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