Module Effect :: Class Effect
[frames] | no frames]

Class Effect

The Effect object

This object gives access to particle effect data in Blender.

Instance Methods
int
getType()
Retrieves the type of an effect object.
None
setType(name)
Deprecated, since only particle effects are supported.
int
getFlag()
Retrieves the flag of an effect object.
None
setFlag(newflag)
Sets the flag of an effect object.
float
getStartTime()
Retrieves the starting time of a particle effect object
None
setSta(newstart)
Sets the starting time of an particle effect object
float
getEndTime()
Retrieves the end time of a particle effect object
None
setEnd(newendrt)
Sets the end time of an particle effect object
float
getLifetime()
Retrieves the lifetime of a particle effect object
None
setLifetime(newlifetime)
Sets the lifetime of a particle effect object
float
getNormfac()
Retrieves the normal strength of the particles (relatively to mesh).
None
setNormfac(newnormfac)
Sets the normal strength of the particles (relatively to mesh).
float
getObfac()
Retrieves the initial strength of the particles relatively to objects.
None
setObfac(newobfac)
Sets the initial strength of the particles relatively to objects.
float
getRandfac()
Retrieves the random strength applied to the particles.
None
setRandfac(newrandfac)
Sets the random strength applied to the particles.
int
getStype()
Retrieves the vect state of an effect object.
None
setStype(int)
Returns: None
float
getTexfac()
Retrieves the strength applied to the particles from the texture of the object.
None
setTexfac(newtexfac)
Sets the strength applied to the particles from the texture of the object.
float
getRandlife()
Retrieves the variability of the life of the particles.
None
setRandlife(newrandlife)
Sets the variability of the life of the particles.
float
getNabla()
Retrieves the sensibility of the particles to the variations of the texture.
None
setNabla(newnabla)
Sets the sensibility of the particles to the variations of the texture.
float
getVectsize()
Retrieves the size of the vector which is associated to the particles.
None
setVectsize(newvectsize)
Sets the size of the vector which is associated to the particles.
int
getTotpart()
Retrieves the total number of particles.
None
setTotpart(newtotpart)
Sets the the total number of particles.
int
getTotkey()
Retrieves the number of keys associated to the particles (kind of degree of freedom)
None
setTotkey(newtotkey)
Sets the number of keys associated to the particles.
int
getSeed()
Retrieves the random number generator seed.
None
setSeed(newseed)
Sets the random number generator seed.
tuple of three floats
getForce()
Retrieves the force applied to the particles.
None
setForce(newforce)
Sets the force applied to the particles.
tuple of 4 floats
getMult()
Retrieves the probabilities of a particle having a child.
None
setMult(newmult)
Sets the probabilities of a particle having a child.
tuple of 4 floats
getLife()
Retrieves the average life of the particles (4 generations)
None
setLife(newlife)
Sets the average life of the particles (4 generations).
tuple of 4 ints
getChild()
Retrieves the average number of children of the particles (4 generations).
None
setChild(newchild)
Sets the average number of children of the particles (4 generations).
tuple of 4 ints
getMat()
Retrieves the indexes of the materials associated to the particles (4 generations).
None
setMat(newmat)
Sets the indexes of the materials associated to the particles (4 generations).
tuple of 3 floats
getDefvec()
Retrieves the x, y and z components of the force defined by the texture.
None
setDefvec(newdefvec)
Sets the x, y and z components of the force defined by the texture.
A list of vector or a list of vector lists.
getParticlesLoc()
Gets the location of each particle at the current time in worldspace.
Instance Variables
tuple of 4 ints child
The number of children a particle may have.
tuple of 4 ints childMat
The materials used by the 4 generation particles.
float damping
The particle damping factor.
tuple of 3 floats defvec
The x, y and z axis of the force defined by the texture.
int disp
The percentage of particles displayed.
int dispMat
The material used for the particles.
int emissionTex
The texture used for texture emission.
float end
The end time of the effect.
int flag
The flag bitfield.
tuple of 3 floats force
The constant force applied to the parts.
int forceTex
The texture used for force.
int jitter
Jitter table distribution: maximum particles per face.
tuple of 4 floats life
The lifetime of of the next generation of particles.
float lifetime
The lifetime of the effect.
tuple of 4 floats mult
The probabilities of a particle having a child.
float nabla
The nabla value.
float normfac
The normal strength of the particles relative to mesh.
float obfac
The strength of the particles relative to objects.
float randfac
The initial random speed of the particles.
float randlife
The variability of the life of the particles.
int seed
The seed of the random number generator.
int speedType
Controls which texture property affects particle speeds.
str speedVGroup
The name of the vertex group used for speed control.
float sta
The start time of the effect.
int staticStep
percentage of skipped particles in static display.
int stype
The bitfield for vector.
float texfac
The initial speed of the particles caused by the texture.
int totkey
The total number of key positions.
int totpart
The total number of particles.
int type
The type of the effect.
str vGroup
The name of the vertex group used for emitted particles.
float vectsize
The size of vectors associated to the particles (if any).
Method Details

getType()

 

Retrieves the type of an effect object. Deprecated, since only particle effects are supported.

Returns: int
the type of an effect object : should always return 1 (particle effect)

setType(name)

 

Deprecated, since only particle effects are supported.

Parameters:
  • name (int) - the new type.
Returns: None
None

getFlag()

 

Retrieves the flag of an effect object. The flag is a bit-mask.

Returns: int
The flag of the effect is a combination of parameters. See Flags for values.

setFlag(newflag)

 

Sets the flag of an effect object. See Flags for values.

Parameters:
  • newflag (int) - the new flag.
Returns: None
None

getStartTime()

 

Retrieves the starting time of a particle effect object

Returns: float
the starting time of the effect.

setSta(newstart)

 

Sets the starting time of an particle effect object

Parameters:
  • newstart (float) - the new starting time.
Returns: None
None

getEndTime()

 

Retrieves the end time of a particle effect object

Returns: float
the end time of the effect.

setEnd(newendrt)

 

Sets the end time of an particle effect object

Parameters:
  • newendrt (float) - the new end time.
Returns: None
None

getLifetime()

 

Retrieves the lifetime of a particle effect object

Returns: float
the lifetime of the effect.

setLifetime(newlifetime)

 

Sets the lifetime of a particle effect object

Parameters:
  • newlifetime (float) - the new lifetime.
Returns: None
None

getNormfac()

 

Retrieves the normal strength of the particles (relatively to mesh).

Returns: float
normal strength of the particles (relatively to mesh).

setNormfac(newnormfac)

 

Sets the normal strength of the particles (relatively to mesh).

Parameters:
  • newnormfac (float) - the normal strength of the particles (relatively to mesh).
Returns: None
None

getObfac()

 

Retrieves the initial strength of the particles relatively to objects.

Returns: float
initial strength of the particles (relatively to mesh).

setObfac(newobfac)

 

Sets the initial strength of the particles relatively to objects.

Parameters:
  • newobfac (float) - the initial strength of the particles relatively to objects.
Returns: None
None

getRandfac()

 

Retrieves the random strength applied to the particles.

Returns: float
random strength applied to the particles.

setRandfac(newrandfac)

 

Sets the random strength applied to the particles.

Parameters:
  • newrandfac (float) - the random strength applied to the particles.
Returns: None
None

getStype()

 

Retrieves the vect state of an effect object.

Returns: int
the Stype (Vect) of an effect object : 0 , Vect is not enabled, 1, Vect is enabled (particle effect)

setStype(int)

 
Parameters:
  • int (int) - state of the Stype : 0 not enabled, 1 enabled.
Returns: None
None

getTexfac()

 

Retrieves the strength applied to the particles from the texture of the object.

Returns: float
strength applied to the particles from the texture of the object.

setTexfac(newtexfac)

 

Sets the strength applied to the particles from the texture of the object.

Parameters:
  • newtexfac (float) - the strength applied to the particles from the texture of the object.
Returns: None
None

getRandlife()

 

Retrieves the variability of the life of the particles.

Returns: float
variability of the life of the particles.

setRandlife(newrandlife)

 

Sets the variability of the life of the particles.

Parameters:
  • newrandlife (float) - the variability of the life of the particles.
Returns: None
None

getNabla()

 

Retrieves the sensibility of the particles to the variations of the texture.

Returns: float
sensibility of the particles to the variations of the texture.

setNabla(newnabla)

 

Sets the sensibility of the particles to the variations of the texture.

Parameters:
  • newnabla (float) - the sensibility of the particles to the variations of the texture.
Returns: None
None

getVectsize()

 

Retrieves the size of the vector which is associated to the particles.

Returns: float
size of the vector which is associated to the particles.

setVectsize(newvectsize)

 

Sets the size of the vector which is associated to the particles.

Parameters:
  • newvectsize (float) - the size of the vector which is associated to the particles.
Returns: None
None

getTotpart()

 

Retrieves the total number of particles.

Returns: int
the total number of particles.

setTotpart(newtotpart)

 

Sets the the total number of particles.

Parameters:
  • newtotpart (int) - the the total number of particles.
Returns: None
None

getTotkey()

 

Retrieves the number of keys associated to the particles (kind of degree of freedom)

Returns: int
number of keys associated to the particles.

setTotkey(newtotkey)

 

Sets the number of keys associated to the particles.

Parameters:
  • newtotkey (int) - number of keys associated to the particles.
Returns: None
None

getSeed()

 

Retrieves the random number generator seed.

Returns: int
current seed value.

setSeed(newseed)

 

Sets the random number generator seed.

Parameters:
  • newseed (int) - new seed value.
Returns: None
None

getForce()

 

Retrieves the force applied to the particles.

Returns: tuple of three floats
force applied to the particles.

setForce(newforce)

 

Sets the force applied to the particles.

Parameters:
  • newforce (tuple of 3 floats) - force applied to the particles.
Returns: None
None

getMult()

 

Retrieves the probabilities of a particle having a child.

Returns: tuple of 4 floats
probabilities of a particle having a child.

setMult(newmult)

 

Sets the probabilities of a particle having a child.

Parameters:
  • newmult (tuple of 4 floats) - probabilities of a particle having a child.
Returns: None
None

getLife()

 

Retrieves the average life of the particles (4 generations)

Returns: tuple of 4 floats
average life of the particles (4 generations)

setLife(newlife)

 

Sets the average life of the particles (4 generations).

Parameters:
  • newlife (tuple of 4 floats) - average life of the particles (4 generations).
Returns: None
None

getChild()

 

Retrieves the average number of children of the particles (4 generations).

Returns: tuple of 4 ints
average number of children of the particles (4 generations).

setChild(newchild)

 

Sets the average number of children of the particles (4 generations).

Parameters:
  • newchild (tuple of 4 ints) - average number of children of the particles (4 generations).
Returns: None
None

getMat()

 

Retrieves the indexes of the materials associated to the particles (4 generations).

Returns: tuple of 4 ints
indexes of the materials associated to the particles (4 generations).

setMat(newmat)

 

Sets the indexes of the materials associated to the particles (4 generations).

Parameters:
  • newmat (tuple of 4 ints) - the indexes of the materials associated to the particles (4 generations).
Returns: None
None

getDefvec()

 

Retrieves the x, y and z components of the force defined by the texture.

Returns: tuple of 3 floats
x, y and z components of the force defined by the texture.

setDefvec(newdefvec)

 

Sets the x, y and z components of the force defined by the texture.

Parameters:
  • newdefvec (tuple of 3 floats) - the x, y and z components of the force defined by the texture.
Returns: None
None

getParticlesLoc()

 

Gets the location of each particle at the current time in worldspace.

Returns: A list of vector or a list of vector lists.
The coordinates of each particle at the current time. If the "Vect" option is enabled a list Vector pairs will be returned with a start and end point for each particle. When static particles are enabled, a list of lists will be returned, each item a strand of particles.

Example:

     import Blender
     from Blender import Effect, Object
     scn= Blender.Scene.GetCurrent()
     ob= scn.getActiveObject()
     effect= ob.effects[0]
     particles= effect.getParticlesLoc()

     # Check that particles are points only (not static and not vectors)
     if not effect.getFlag() & Effect.Flags.STATIC or not effect.getStype():
       for pt in particles: 
         ob_empty= scn.objects.new('Empty')
         ob_empty.setLocation(pt)
     
     else: # Particles will be a list
       for pt in particles:
         for pt_item in pt:
           ob_empty= scn.objects.new('Empty')
           ob_empty.setLocation(pt_item)

Example:

     # Converts particles into a mesh with edges for strands
     from Blender import Scene, Mathutils, Effect, Mesh, Object
     scn= Scene.GetCurrent()
     ob= scn.getActiveObject()
     me= Mesh.New()
     
     effects= Effect.Get()
     for eff in effects:
         for p in eff.getParticlesLoc():
             # p is either a vector or a list of vectors. me.verts.extend() will deal with either
             print p
             me.verts.extend(p)
     
             if type(p)==list: # Are we a strand or a pair, then add edges.
                 if len(p)>1:
                     edges= [(i, i+1) for i in range(len(me.verts)-len(p), len(me.verts)-1)]
                     me.edges.extend( edges )
     
     print len(me.verts)
     ob= scn.objects.new(me)

Instance Variable Details

child

The number of children a particle may have. Values are clamped to the range [1,600].
Type:
tuple of 4 ints

childMat

The materials used by the 4 generation particles. Values are clamped to the range [1,16].
Type:
tuple of 4 ints

damping

The particle damping factor. This controls the rate at which particles decelerate. Values are clamped to the range [0.0,1.0].
Type:
float

defvec

The x, y and z axis of the force defined by the texture. Values are clamped to the range [-1.0,1.0].
Type:
tuple of 3 floats

disp

The percentage of particles displayed. Value is clamped to the range [0,100].
Type:
int

dispMat

The material used for the particles. Value is clamped to the range [1,16].
Type:
int

emissionTex

The texture used for texture emission. Value is clamped to the range [1,10].
Type:
int

end

The end time of the effect. Value is clamped to the range [1.0,30000.0].
Type:
float

flag

The flag bitfield. See Flags for values.
Type:
int

force

The constant force applied to the parts. Values are clamped to the range [-1.0,1.0].
Type:
tuple of 3 floats

forceTex

The texture used for force. Value is clamped to the range [1,10].
Type:
int

jitter

Jitter table distribution: maximum particles per face. Values are clamped to the range [0,200].
Type:
int

life

The lifetime of of the next generation of particles. Values are clamped to the range [1.0,30000.0].
Type:
tuple of 4 floats

lifetime

The lifetime of the effect. Value is clamped to the range [1.0,30000.0].
Type:
float

mult

The probabilities of a particle having a child. Values are clamped to the range [0.0,1.0].
Type:
tuple of 4 floats

nabla

The nabla value. Value is clamped to the range [0.0001,1.0].
Type:
float

normfac

The normal strength of the particles relative to mesh. Value is clamped to the range [-2.0,2.0].
Type:
float

obfac

The strength of the particles relative to objects. Value is clamped to the range [-1.0,1.0].
Type:
float

randfac

The initial random speed of the particles. Value is clamped to the range [0.0,2.0].
Type:
float

randlife

The variability of the life of the particles. Value is clamped to the range [0.0,2.0].
Type:
float

seed

The seed of the random number generator. Value is clamped to the range [0,255].
Type:
int

speedType

Controls which texture property affects particle speeds. See SpeedTypes for values and their meanings.
Type:
int

sta

The start time of the effect. Value is clamped to the range [-250.0,30000.0].
Type:
float

staticStep

percentage of skipped particles in static display. Value is clamped to the range [1,100].
Type:
int

texfac

The initial speed of the particles caused by the texture. Value is clamped to the range [0.0,2.0].
Type:
float

totkey

The total number of key positions. Value is clamped to the range [1,100].
Type:
int

totpart

The total number of particles. Value is clamped to the range [1,100000].
Type:
int

type

The type of the effect. Deprecated.
Type:
int

vectsize

The size of vectors associated to the particles (if any). Value is clamped to the range [0.0,1.0].
Type:
float