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

Source Code for Module Particle

  1  # Blender.Object module and the Object PyType object 
  2   
  3  """ 
  4  The Blender.Particle submodule 
  5   
  6   
  7  Particle 
  8  ======== 
  9   
 10  This module provides access to the B{Particle} in Blender. 
 11   
 12  @type TYPE: readonly dictionary 
 13  @var TYPE: Constant dict used for with L{Particle.TYPE} 
 14                  - HAIR: set particle system to hair mode. 
 15                  - REACTOR: set particle system to reactor mode. 
 16                  - EMITTER: set particle system to emitter mode. 
 17  @type DISTRIBUTION: readonly dictionary 
 18  @var DISTRIBUTION: Constant dict used for with L{Particle.DISTRIBUTION} 
 19                  - GRID: set grid distribution. 
 20                  - RANDOM: set random distribution. 
 21                  - JITTERED: set jittered distribution. 
 22  @type EMITFROM: readonly dictionary 
 23  @var EMITFROM: Constant dict used for with L{Particle.EMITFROM} 
 24                  - VERTS: set particles emit from vertices 
 25                  - FACES: set particles emit from faces 
 26                  - VOLUME: set particles emit from volume 
 27                  - PARTICLE: set particles emit from particles 
 28  @type REACTON: readonly dictionary 
 29  @var REACTON: Constant dict used for with L{Particle.REACTON} 
 30                  - NEAR: react on near 
 31                  - COLLISION: react on collision 
 32                  - DEATH: react on death 
 33  @type DRAWAS: readonly dictionary 
 34  @var DRAWAS: Constant dict used for with L{Particle.DRAWAS} 
 35                  - NONE: Don't draw 
 36                  - POINT: Draw as point 
 37                  - CIRCLE: Draw as circles 
 38                  - CROSS: Draw as crosses 
 39                  - AXIS: Draw as axis 
 40                  - LINE: Draw as lines 
 41                  - PATH: Draw pathes 
 42                  - OBJECT: Draw object 
 43                  - GROUP: Draw group 
 44                  - BILLBOARD: Draw as billboard  
 45  @type PHYSICS: readonly dictionary 
 46  @var PHYSICS: Constant dict used for with L{Particle.PHYSICS} 
 47                  - NONE: No physics 
 48                  - NEWTONIAN: Use newtonian physics 
 49                  - KEYED: Use keyed physics 
 50                  - BOIDS: Use Boids physics 
 51  @type INTEGRATOR: readonly dictionary 
 52  @var INTEGRATOR: Constant dict used for with L{Particle.INTEGRATOR} 
 53                  - EULER: Use Euler integrator 
 54                  - MIDPOINT: Use Midpoint integrator 
 55                  - RK4: Use RK4 integrator 
 56  @type ROTATION: readonly dictionary 
 57  @var ROTATION: Constant dict used for with L{Particle.ROTATION} 
 58                  - NONE: No particle initial rotation 
 59                  - NOR: Rotate along the normal 
 60                  - VEL: Rotate affect to velocity 
 61                  - GLX: Rotate along global X-Axis 
 62                  - GLY: Rotate along global Y-Axis 
 63                  - GLZ: Rotate along global Z-Axis 
 64                  - OBX: Rotate along local X-Axis 
 65                  - OBY: Rotate along local Y-Axis 
 66                  - OBZ: Rotate along local Z-Axis 
 67  @type ANGULARV: readonly dictionary 
 68  @var ANGULARV: Constant dict used for with L{Particle.ANGULARV} 
 69                  - NONE: No particle angular velocity 
 70                  - SPIN: Spin particle angular velocity 
 71                  - RANDOM: Random particle angular velocity 
 72  @type VERTEXGROUPS: readonly dictionary 
 73  @var VERTEXGROUPS: Constant dict used for with L{Particle.getVertGroup} and L{Particle.setVertGroup} 
 74                  - DENSITY: VertexGroup affect to particles density 
 75                  - VELOCITY: VertexGroup affect to particles velocity 
 76                  - LENGHT: VertexGroup affect to particles lenght 
 77                  - CLUMP: VertexGroup affect to particles clump 
 78                  - KINK: VertexGroup affect to particles kink 
 79                  - ROUGH1: VertexGroup affect to particles rough1 
 80                  - ROUGH2: VertexGroup affect to particles rough2 
 81                  - ROUGHE: VertexGroup affect to particles roughE 
 82                  - SIZE: VertexGroup affect to particles size 
 83                  - TANVEL: VertexGroup affect to particles tangent velocity 
 84                  - TANROT: VertexGroup affect to particles tangent rotation 
 85                  - EFFECTOR: VertexGroup affect to particles effector 
 86  @type CHILDTYPE: readonly dictionary 
 87  @var CHILDTYPE: Constant dict used for with L{Particle.CHILDTYPE} 
 88                  - NONE: set no children 
 89                  - PARTICLES: set children born from particles 
 90                  - FACES: set children born from faces 
 91  @type CHILDKINK: readonly dictionary 
 92  @var CHILDKINK: Type of periodic offset on the path 
 93                  - NOTHING: set no offset on the path  
 94                  - CURL: set curl offset on the path 
 95                  - RADIAL: set radial offset on the path 
 96                  - WAVE: set wave offset on the path 
 97                  - BRAID: set braid offset on the path 
 98  @type CHILDKINKAXIS: readonly dictionary 
 99  @var CHILDKINKAXIS: Which axis to use for offset 
100                  - X: set X axis for offset 
101                  - Y: set Y axis for offset 
102                  - Z: set Z axis for offset 
103  """ 
104   
105 -def New(object):
106 """ 107 Create a new particle system applied to L{object} 108 @type object: string or L{Blender.Object.Object} 109 @param object: The existing object to add the particle system to. 110 @rtype: L{Particle} 111 @return: a new Particle system. 112 """
113
114 -class Particle:
115 """ 116 The Particle object 117 =================== 118 This object gives access to paticles data. 119 120 @ivar seed: Set an offset in the random table. 121 @type seed: int 122 @ivar type: Type of particle system ( Particle.TYPE[ 'HAIR' | 'REACTOR' | 'EMITTER' ] ). 123 @type type: int 124 @ivar resolutionGrid: The resolution of the particle grid. 125 @type resolutionGrid: int 126 @ivar startFrame: Frame number to start emitting particles. 127 @type startFrame: float 128 @ivar endFrame: Frame number to stop emitting particles. 129 @type endFrame: float 130 @ivar editable: Finalize hair to enable editing in particle mode. 131 @type editable: int 132 @ivar amount: The total number of particles. 133 @type amount: int 134 @ivar multireact: React multiple times ( Particle.REACTON[ 'NEAR' | 'COLLISION' | 'DEATH' ] ). 135 @type multireact: int 136 @ivar reactshape: Power of reaction strength, dependent on distance to target. 137 @type reactshape: float 138 @ivar hairSegments: Amount of hair segments. 139 @type hairSegments: int 140 @ivar lifetime: Specify the life span of the particles. 141 @type lifetime: float 142 @ivar randlife: Give the particle life a random variation. 143 @type randlife: float 144 @ivar randemission: Emit particles in random order. 145 @type randemission: int 146 @ivar particleDistribution: Where to emit particles from ( Particle.EMITFROM[ 'PARTICLE' | 'VOLUME' | 'FACES' | 'VERTS' ] ) 147 @type particleDistribution: int 148 @ivar evenDistribution: Use even distribution from faces based on face areas or edge lengths. 149 @type evenDistribution: int 150 @ivar distribution: How to distribute particles on selected element ( Particle.DISTRIBUTION[ 'GRID' | 'RANDOM' | 'JITTERED' ] ). 151 @type distribution: int 152 @ivar jitterAmount: Amount of jitter applied to the sampling. 153 @type jitterAmount: float 154 @ivar pf: Emission locations / face (0 = automatic). 155 @type pf:int 156 @ivar invert: Invert what is considered object and what is not. 157 @type invert: int 158 @ivar targetObject: The object that has the target particle system (empty if same object). 159 @type targetObject: Blender object 160 @ivar targetpsys: The target particle system number in the object. 161 @type targetpsys: int 162 @ivar 2d: Constrain boids to a surface. 163 @type 2d: float 164 @ivar maxvel: Maximum velocity. 165 @type maxvel: float 166 @ivar avvel: The usual speed % of max velocity. 167 @type avvel: float 168 @ivar latacc: Lateral acceleration % of max velocity 169 @type latacc: float 170 @ivar tanacc: Tangential acceleration % of max velocity 171 @type tanacc: float 172 @ivar groundz: Default Z value. 173 @type groundz: float 174 @ivar object: Constrain boids to object's surface. 175 @type object: Blender Object 176 @ivar renderEmitter: Render emitter object. 177 @type renderEmitter: int 178 @ivar renderMatCol: Draw particles using material's diffuse color. 179 @type renderMatCol: int 180 @ivar renderParents: Render parent particles. 181 @type renderParents: int 182 @ivar renderUnborn: Show particles before they are emitted. 183 @type renderUnborn: int 184 @ivar renderDied: Show particles after they have died. 185 @type renderDied: int 186 @ivar renderMaterial: Specify material used for the particles. 187 @type renderMaterial: int 188 @ivar strandRender: Use the strand primitive to render. 189 @type strandRender: int 190 @ivar strandRenderAngle: How many degrees path has to curve to make another render segment. 191 @type strandRenderAngle: int 192 @ivar displayPercentage: Particle display percentage. 193 @type displayPercentage: int 194 @ivar hairDisplayStep: How many steps paths are drawn with (power of 2) in visu mode. 195 @type hairDisplayStep: int 196 @ivar hairRenderStep: How many steps paths are rendered with (power of 2) in render mode." 197 @type hairRenderStep: int 198 @ivar duplicateObject: Get the duplicate object. 199 @type duplicateObject: Blender Object 200 @ivar drawAs: Draw type Particle.DRAWAS([ 'NONE' | 'OBJECT' | 'POINT' | ... ]). 201 @type drawAs: int 202 @ivar physics: Select particle physics type Particle.PHYSICS([ 'BOIDS' | 'KEYED' | 'NEWTONIAN' | 'NONE' ]) 203 @type physics: int 204 @ivar integration: Select physics integrator type Particle.INTEGRATOR([ 'RK4' | 'MIDPOINT' | 'EULER' ]) 205 @type integration: int 206 @ivar inVelObj: Let the object give the particle a starting speed 207 @type inVelObj: float 208 @ivar inVelNor: Let the surface normal give the particle a starting speed 209 @type inVelNor: float 210 @ivar inVelRan: Give the starting speed a random variation 211 @type inVelRan: float 212 @ivar inVelTan: Let the surface tangent give the particle a starting speed 213 @type inVelTan: float 214 @ivar inVelRot: Rotate the surface tangent 215 @type inVelRot: float 216 @ivar inVelPart: Let the target particle give the particle a starting speed 217 @type inVelPart: float 218 @ivar inVelReact: Let the vector away from the target particles location give the particle a starting speed 219 @type inVelReact: float 220 @ivar rotation: Particles initial rotation Particle.ROTATION([ 'OBZ' | 'OBY' | 'OBX' | 'GLZ' | 'GLY' | 'GLX' | 'VEL' | 'NOR' | 'NONE' ]) 221 @type rotation: int 222 @ivar rotDyn: Sets rotation to dynamic/constant 223 @type rotDyn: int 224 @ivar rotRand: Randomize rotation 225 @type rotRand: float 226 @ivar rotPhase: Initial rotation phase 227 @type rotPhase: float 228 @ivar rotPhaseR: Randomize rotation phase 229 @type rotPhaseR: float 230 @ivar rotAnV: Select particle angular velocity mode Particle.ANGULARV([ 'RANDOM' | 'SPIN' | 'NONE' ]) 231 @type rotAnV: int 232 @ivar rotAnVAm: Angular velocity amount 233 @type rotAnVAm: float 234 @ivar glAccX: Specify a constant acceleration along the X-axis 235 @type glAccX: float 236 @ivar glAccY: Specify a constant acceleration along the Y-axis 237 @type glAccY: float 238 @ivar glAccZ: Specify a constant acceleration along the Z-axis 239 @type glAccZ: float 240 @ivar glDrag: Specify the amount of air-drag 241 @type glDrag: float 242 @ivar glBrown: Specify the amount of brownian motion 243 @type glBrown: float 244 @ivar glDamp: Specify the amount of damping 245 @type glDamp: float 246 @ivar childAmount: The total number of children 247 @type childAmount: int 248 @ivar childType: Type of childrens ( Particle.CHILDTYPE[ 'FACES' | 'PARTICLES' | 'NONE' ] ) 249 @type childType: int 250 @ivar childRenderAmount: Amount of children/parent for rendering 251 @type childRenderAmount: int 252 @ivar childRadius: Radius of children around parent 253 @type childRadius: float 254 @ivar childRound: Roundness of children around parent 255 @type childRound: float 256 @ivar childClump: Amount of clumpimg 257 @type childClump: float 258 @ivar childShape: Shape of clumpimg 259 @type childShape: float 260 @ivar childSize: A multiplier for the child particle size 261 @type childSize: float 262 @ivar childRand: Random variation to the size of the child particles 263 @type childRand: float 264 @ivar childRough1: Amount of location dependant rough 265 @type childRough1: float 266 @ivar childRough1Size: Size of location dependant rough 267 @type childRough1Size: float 268 @ivar childRough2: Amount of random rough 269 @type childRough2: float 270 @ivar childRough2Size: Size of random rough 271 @type childRough2Size: float 272 @ivar childRough2Thresh: Amount of particles left untouched by random rough 273 @type childRough2Thresh: float 274 @ivar childRoughE: Amount of end point rough 275 @type childRoughE: float 276 @ivar childRoughEShape: Shape of end point rough 277 @type childRoughEShape: float 278 @ivar childKink: Type of periodic offset on the path (Particle.CHILDKINK[ 'BRAID' | 'WAVE' | 'RADIAL' | 'CURL' | 'NOTHING' ]) 279 @type childKink: int 280 @ivar childKinkAxis: Which axis to use for offset (Particle.CHILDKINKAXIS[ 'Z' | 'Y' | 'X' ]) 281 @type childKinkAxis: int 282 @ivar childKinkFreq: The frequency of the offset (1/total length) 283 @type childKinkFreq: float 284 @ivar childKinkShape: Adjust the offset to the beginning/end 285 @type childKinkShape: float 286 @ivar childKinkAmp: The amplitude of the offset 287 @type childKinkAmp: float 288 @ivar childBranch: Branch child paths from eachother 289 @type childBranch: int 290 @ivar childBranchAnim: Animate branching 291 @type childBranchAnim: int 292 @ivar childBranchSymm: Start and end points are the same 293 @type childBranchSymm: int 294 @ivar childBranchThre: Threshold of branching 295 @type childBranchThre: float 296 """
297 - def getName():
298 """ 299 Get the name of this Particle System object. 300 @rtype: string 301 """
302
303 - def setName(name):
304 """ 305 Set the name of this Particle System object. 306 @type name: string 307 @param name: The new name. 308 """
309
310 - def freeEdit():
311 """ 312 Free edit mode. 313 @return: None 314 """
315
316 - def getLoc(all=0,id=0):
317 """ 318 Get the particles locations. 319 A list of tuple is returned in particle mode. 320 A list of list of tuple is returned in hair mode. 321 The tuple is a vector of 3 or 4 floats in world space (x,y,z, optionally the particle's id). 322 @type all: int 323 @param all: if not 0 export all particles (uninitialized (unborn or died)particles exported as None). 324 @type id: int 325 @param id: add the particle id in the end of the vector tuple 326 @rtype: list of vectors (tuple of 3 floats and optionally the id) or list of list of vectors 327 @return: list of vectors or list of list of vectors (hair mode) or None if system is disabled 328 """
329 - def getRot(all=0,id=0):
330 """ 331 Get the particles' rotations as quaternion. 332 A list of tuple is returned in particle mode. 333 The tuple is vector of 4 or 5 floats (x,y,z,w, optionally the id of the particle). 334 335 @type all: int 336 @param all: if not 0, export all particles (uninitialized (unborn or died) particles exported as None). 337 @type id: int 338 @param id: add the particle id in the return tuple 339 @rtype: list of tuple of 4 or 5 elements (if id is not zero) 340 @return: list of 4-tuples or None if system is disabled 341 """
342
343 - def setMat(mat):
344 """ 345 Set the particles' material. This method checks if the argument 346 given is really a material, imposes a limit of 16 materials and adds 347 the material if it wasn't already in the list of the object. 348 @type mat: Blender Material 349 @param mat: The material to be assigned to particles 350 """
351
352 - def getMat():
353 """ 354 Get the particles' material. 355 @rtype: Blender Material 356 @return: The material assigned to particles 357 """
358
359 - def getSize(all=0,id=0):
360 """ 361 Get the particles' size. 362 A list of float or list of tuple (particle's size,particle's id). 363 @type all: int 364 @param all: if not 0, export all particles (uninitialized (unborn or died) particles exported as None). 365 @type id: int 366 @param id: add the particle id in the return tuple 367 @rtype: list of floats 368 @return: list of floats or list of tuples if id is not zero (size,id) or None if system is disabled. 369 """
370
371 - def getAge(all=0,id=0):
372 """ 373 Get the particles' age. 374 A list of float or list of tuple (particle's age, particle's id). 375 @type all: int 376 @param all: if not 0, export all particles (uninitialized (unborn or died) particles exported as None). 377 @type id: int 378 @param id: add the particle id in the return tuple 379 @rtype: list of floats 380 @return: list of floats or list of tuples if id is not zero (size,id) or None if system is disabled. 381 """
382
383 - def getVertGroup(attribute):
384 """ 385 Get vertex group name and negation bit assigned to affect parameter attribute. 386 A list of string and integer (vertex group name, negation bit). 387 @type attribute: int 388 @param attribute: Particle.VERTEXGROUPS([ 'DENSITY' | 'VELOCITY' | ... ]) 389 @rtype: list of objects 390 @return: first element is the vg name and second the negation bit 391 """
392 - def setVertGroup(name,attribute,negated):
393 """ 394 Set vertex group and negation bit to affect particles system attribute. 395 @type name: string 396 @param name: Name of the vertex group 397 @type attribute: int 398 @param attribute: Particle.VERTEXGROUPS([ 'DENSITY' | 'VELOCITY' | ... ]) 399 @type negated: int 400 @param negated: Negate the effect of the vertex group 401 @return: None 402 """
403