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

Class Effect

source code

The Effect object

This object gives access to particle effect data in Blender.

Instance Methods [hide private]
int
getType()
Retrieves the type of an effect object.
source code
None
setType(name)
Deprecated, since only particle effects are supported.
source code
int
getFlag()
Retrieves the flag of an effect object.
source code
None
setFlag(newflag)
Sets the flag of an effect object.
source code
float
getStartTime()
Retrieves the starting time of a particle effect object
source code
None
setSta(newstart)
Sets the starting time of an particle effect object
source code
float
getEndTime()
Retrieves the end time of a particle effect object
source code
None
setEnd(newendrt)
Sets the end time of an particle effect object
source code
float
getLifetime()
Retrieves the lifetime of a particle effect object
source code
None
setLifetime(newlifetime)
Sets the lifetime of a particle effect object
source code
float
getNormfac()
Retrieves the normal strength of the particles (relatively to mesh).
source code
None
setNormfac(newnormfac)
Sets the normal strength of the particles (relatively to mesh).
source code
float
getObfac()
Retrieves the initial strength of the particles relatively to objects.
source code
None
setObfac(newobfac)
Sets the initial strength of the particles relatively to objects.
source code
float
getRandfac()
Retrieves the random strength applied to the particles.
source code
None
setRandfac(newrandfac)
Sets the random strength applied to the particles.
source code
int
getStype()
Retrieves the vect state of an effect object.
source code
None
setStype(int)
Returns: None
source code
float
getTexfac()
Retrieves the strength applied to the particles from the texture of the object.
source code
None
setTexfac(newtexfac)
Sets the strength applied to the particles from the texture of the object.
source code
float
getRandlife()
Retrieves the variability of the life of the particles.
source code
None
setRandlife(newrandlife)
Sets the variability of the life of the particles.
source code
float
getNabla()
Retrieves the sensibility of the particles to the variations of the texture.
source code
None
setNabla(newnabla)
Sets the sensibility of the particles to the variations of the texture.
source code
float
getVectsize()
Retrieves the size of the vector which is associated to the particles.
source code
None
setVectsize(newvectsize)
Sets the size of the vector which is associated to the particles.
source code
int
getTotpart()
Retrieves the total number of particles.
source code
None
setTotpart(newtotpart)
Sets the the total number of particles.
source code
int
getTotkey()
Retrieves the number of keys associated to the particles (kind of degree of freedom)
source code
None
setTotkey(newtotkey)
Sets the number of keys associated to the particles.
source code
int
getSeed()
Retrieves the random number generator seed.
source code
None
setSeed(newseed)
Sets the random number generator seed.
source code
tuple of three floats
getForce()
Retrieves the force applied to the particles.
source code
None
setForce(newforce)
Sets the force applied to the particles.
source code
tuple of 4 floats
getMult()
Retrieves the probabilities of a particle having a child.
source code
None
setMult(newmult)
Sets the probabilities of a particle having a child.
source code
tuple of 4 floats
getLife()
Retrieves the average life of the particles (4 generations)
source code
None
setLife(newlife)
Sets the average life of the particles (4 generations).
source code
tuple of 4 ints
getChild()
Retrieves the average number of children of the particles (4 generations).
source code
None
setChild(newchild)
Sets the average number of children of the particles (4 generations).
source code
tuple of 4 ints
getMat()
Retrieves the indexes of the materials associated to the particles (4 generations).
source code
None
setMat(newmat)
Sets the indexes of the materials associated to the particles (4 generations).
source code
tuple of 3 floats
getDefvec()
Retrieves the x, y and z components of the force defined by the texture.
source code
None
setDefvec(newdefvec)
Sets the x, y and z components of the force defined by the texture.
source code
A list of vector or a list of vector lists.
getParticlesLoc()
Gets the location of each particle at the current time in worldspace.
source code
Instance Variables [hide private]
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 [hide private]

getType()

source code 
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)

source code 
Deprecated, since only particle effects are supported.
Parameters:
  • name (int) - the new type.
Returns: None
None

getFlag()

source code 
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)

source code 
Sets the flag of an effect object. See Flags for values.
Parameters:
  • newflag (int) - the new flag.
Returns: None
None

getStartTime()

source code 
Retrieves the starting time of a particle effect object
Returns: float
the starting time of the effect.

setSta(newstart)

source code 
Sets the starting time of an particle effect object
Parameters:
  • newstart (float) - the new starting time.
Returns: None
None

getEndTime()

source code 
Retrieves the end time of a particle effect object
Returns: float
the end time of the effect.

setEnd(newendrt)

source code 
Sets the end time of an particle effect object
Parameters:
  • newendrt (float) - the new end time.
Returns: None
None

getLifetime()

source code 
Retrieves the lifetime of a particle effect object
Returns: float
the lifetime of the effect.

setLifetime(newlifetime)

source code 
Sets the lifetime of a particle effect object
Parameters:
  • newlifetime (float) - the new lifetime.
Returns: None
None

getNormfac()

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

setNormfac(newnormfac)

source code 
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()

source code 
Retrieves the initial strength of the particles relatively to objects.
Returns: float
initial strength of the particles (relatively to mesh).

setObfac(newobfac)

source code 
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()

source code 
Retrieves the random strength applied to the particles.
Returns: float
random strength applied to the particles.

setRandfac(newrandfac)

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

getStype()

source code 
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)

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

getTexfac()

source code 
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)

source code 
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()

source code 
Retrieves the variability of the life of the particles.
Returns: float
variability of the life of the particles.

setRandlife(newrandlife)

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

getNabla()

source code 
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)

source code 
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()

source code 
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)

source code 
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()

source code 
Retrieves the total number of particles.
Returns: int
the total number of particles.

setTotpart(newtotpart)

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

getTotkey()

source code 
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)

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

getSeed()

source code 
Retrieves the random number generator seed.
Returns: int
current seed value.

setSeed(newseed)

source code 
Sets the random number generator seed.
Parameters:
  • newseed (int) - new seed value.
Returns: None
None

getForce()

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

setForce(newforce)

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

getMult()

source code 
Retrieves the probabilities of a particle having a child.
Returns: tuple of 4 floats
probabilities of a particle having a child.

setMult(newmult)

source code 
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()

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

setLife(newlife)

source code 
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()

source code 
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)

source code 
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()

source code 
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)

source code 
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()

source code 
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)

source code 
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()

source code 
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 [hide private]

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