Module Ipo :: Class Ipo

Class Ipo

source code

The Ipo object

This object gives access to Ipo data from all objects in Blender.


Note:

Blender Materials, Lamps and Worlds have texture channels which allow the user to assign textures to them. The Blender Ipo Window allows the user to access the IpoCurves for these channels by specifying a number between 0 and 9 (the number appears next to the Ipo type in the window header). Prior to Version 2.42, the BPy API did not allow users to access these texture channels in a predictable manner. A new attribute named channel was added to the API in Version 2.42 to correct this problem.

The current channel setting has an effect on the operators [], len() and others. For example, suppose a Material has three IpoCurves (R, G, and B), and two texture channels (numbered 0 and 1), and furthermore channel 0 has one Ipocurve (Col). The IpoCurve Col can only be "seen" through the API when ipo.channel is 0. Setting ipo.channel to 1 will cause this curve to be ignored by len(ipo):
       from Blender import Ipo

       ipo = Ipo.Get('MatIpo')
       for channel in xrange(2):
                       ipo.channel = channel
                       print 'channel is',channel
                       print ' len is',len(ipo)
                       names = dict([(x[1],x[0]) for x in ipo.curveConsts.items()])
                       for curve in [Ipo.MA_R,Ipo.MA_COL]:
                                       print ' ',names[curve],'is',curve in ipo
will output:
       channel is 0
       len is 4
               MA_R is True
               MA_COL is True
       channel is 1
       len is 3
               MA_R is True
               MA_COL is False

Instance Methods
Boolean
__contains__()
The "in" operator for Ipos.
source code
IpoCurve or None
__getitem__()
This operator is similar to the Python dictionary mapping operator [], except that the user cannot assign arbitrary keys.
source code
IpoCurve
__iter__()
Iterator for Ipos.
source code
int
__len__()
Returns the number of curves defined for the Ipo.
source code
string
getName()
Gets the name of the Ipo (deprecated).
source code
None
setName(newname)
Sets the name of the Ipo (deprecated).
source code
list of IpoCurves
getCurves()
Gets all the IpoCurves of the Ipo (deprecated).
source code
IpoCurve object
getCurve(curve)
Return the specified IpoCurve (deprecated).
source code
IpoCurve object
addCurve(curvename)
Add a new curve to the Ipo object.
source code
None
delCurve(curvename)
Delete an existing curve from the Ipo object (deprecated).
source code
int
getBlocktype()
Gets the blocktype of the Ipo.
source code
None
setBlocktype(newblocktype)
Sets the blocktype of the Ipo.
source code
list of floats
getRctf()
Gets the rctf of the Ipo.
source code
None
setRctf(newrctf)
Sets the rctf of the Ipo.
source code
int
getNcurves()
Gets the number of curves of the Ipo (deprecated).
source code
 
getCurveBP(curvepos)
This method is unsupported.
source code
list of 9 floats
getBeztriple(curvepos, pointpos)
Gets a beztriple of the Ipo (deprecated).
source code
None
setBeztriple(curvepos, pointpos, newbeztriple)
Sets the beztriple of the Ipo (deprecated).
source code
float
getCurveCurval(curvepos)
Gets the current value of a curve of the Ipo (deprecated).
source code
float
EvaluateCurveOn(curvepos, time)
Gets the value at a specific time of a curve of the Ipo (deprecated).
source code
Instance Variables
int or None channel
the current texture channel for Blender object which support textures (materials, lamps and worlds).
constant or list of strings. Read-only. curveConsts
The valid Ipo curves for this Ipo.
list of Ipocurves. curves
Ipo curves currently defined for the Ipo.
bool fakeUser
When set to True, this datablock wont be removed, even if nothing is using it.
string or None lib
path to the blend file this datablock is stored in (readonly).
string name
unique name within each blend file.
IDGroup properties
Returns an IDGroup reference to this datablocks's ID Properties.
bool tag
A temporary tag that to flag data as being used within a loop.
int users
The number of users this datablock has.
Method Details

__contains__()
(In operator)

source code 
The "in" operator for Ipos. It returns True if the specified IpoCurve exists for the Ipo. This operator should not be used to test for whether a curve constant is valid for a particular Ipo type. Many constants for different Ipo types have the same value, and it is the constant's value used internally. No exceptions are raised if the argument is not a valid curve constant or or string, nor does the operator return True when the curve constant is valid but does not currently exist. As such, it should only be used to test for specific curves when the Ipo type is known:
       ipo = Object.Get('Cube').ipo # get Object-type Ipo 
       if ipo:
               print Ipo.OB_LOCX in ipo # prints "True" if 'LocX' curve exists
               print Ipo.MA_R in ipo    # also prints "True" since MA_R and OB_LOCX are have the same value
               print 'hiccup' in ipo    # always prints "False" since argument is not a constant
Returns: Boolean
see above.

__getitem__()
(Indexing operator)

source code 
This operator is similar to the Python dictionary mapping operator [], except that the user cannot assign arbitrary keys. Each Ipo type has a pre-defined set of IpoCurves which may or may not exist at a given time. This operator will either return an IpoCurve object if the specified curve exists, return None if the curve does not exists, or throws a KeyError exception if the curve is not valid for this Ipo type.
Returns: IpoCurve or None
an IpoCurve object if it exists
Raises:
  • KeyError - an undefined IpoCurve was specified for the Ipo

__iter__()

source code 
Iterator for Ipos. It returns all the defined IpoCurve objects associated with the Ipo. For example:
       from Blender import Ipo

       ipo = Ipo.Get()
       if len(ipo) > 0:
               ipo = ipo[0]
               print 'ipo name is',ipo.name
               for icu in ipo:
                       print ' curve name is',icu.name
might result in:
       ipo name is ObIpo
               curve name is LocX
               curve name is LocY
               curve name is LocZ
Returns: IpoCurve
an IpoCurve object

__len__()
(Length operator)

source code 
Returns the number of curves defined for the Ipo.
Returns: int
number of defined IpoCurves

getName()

source code 
Gets the name of the Ipo (deprecated). See the name attribute.
Returns: string
the name of the Ipo.

setName(newname)

source code 
Sets the name of the Ipo (deprecated). See the name attribute.
Returns: None
None

getCurves()

source code 
Gets all the IpoCurves of the Ipo (deprecated). Use the iterator operator [] instead.
Returns: list of IpoCurves
A list (possibly empty) containing all the IpoCurves associated to the Ipo object.

getCurve(curve)

source code 
Return the specified IpoCurve (deprecated). Use the mapping operator [] instead. If the curve does not exist in the Ipo, None is returned. curve can be either a string or an integer, denoting either the name of the Ipo curve or its internal adrcode. The possible Ipo curve names are:
  1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
  2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref, Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu, RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY, OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var, Disp.
  3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ, dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ, Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping, RDamp, Perm.
  4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
  5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi, MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ, SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
  1. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi, MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
  2. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4, MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct, MgOff, MgGain, NBase1, NBase2.
  3. Curve Ipo: Speed.
  4. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, QuatZ, QuatW.
  5. Sequence Ipo: Fac.
  6. Constraint Ipo: Inf.
The adrcode for the Ipo curve can also be given; this is useful for accessing curves for Shape Key Ipos. The adrcodes for Shape Key Ipo are numbered consecutively starting at 0.
Returns: IpoCurve object
the corresponding IpoCurve, or None.
Raises:
  • ValueError - curve is not a valid name or adrcode for this Ipo type.

addCurve(curvename)

source code 
Add a new curve to the Ipo object. The possible values for curvename are:
  1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
  2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref, Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu, RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY, OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var, Disp.
  3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ, dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ, Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping, RDamp, Perm.
  4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
  5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi, MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ, SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
  1. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi, MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
  2. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4, MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct, MgOff, MgGain, NBase1, NBase2.
  3. Curve Ipo: Speed.
  4. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY, QuatZ, QuatW.
  5. Sequence Ipo: Fac.
  6. Constraint Ipo: Inf.
For Key IPOs, the name must be an existing KeyBlock name. Use curveConsts to determine the set of valid names.
Returns: IpoCurve object
the corresponding IpoCurve, or None.
Raises:
  • ValueError - curvename is not valid or already exists

delCurve(curvename)

source code 
Delete an existing curve from the Ipo object (deprecated). Use the mapping operator [] instead:
        from Blender import Ipo

        ipo = Ipo.Get('ObIpo')
        ipo[Ipo.LOCX] = None
Returns: None
None.

getBlocktype()

source code 
Gets the blocktype of the Ipo.
Returns: int
the blocktype of the Ipo.

setBlocktype(newblocktype)

source code 
Sets the blocktype of the Ipo.
Returns: None
None

Warning: 'newblocktype' should not be changed unless you really know what you are doing ...

getRctf()

source code 
Gets the rctf of the Ipo. Kind of bounding box...
Returns: list of floats
the rctf of the Ipo.

setRctf(newrctf)

source code 
Sets the rctf of the Ipo.
Returns: None
None

Warning: rctf should not be changed unless you really know what you are doing ...

getNcurves()

source code 
Gets the number of curves of the Ipo (deprecated). Use len(ipo) instead.
Returns: int
the number of curve of the Ipo.

getCurveBP(curvepos)

source code 
This method is unsupported. BPoint Ipo curves are not implemented. Calling this method throws a NotImplementedError exception.
Raises:
  • NotImplementedError - this method always raises an exception

getBeztriple(curvepos, pointpos)

source code 
Gets a beztriple of the Ipo (deprecated). Note: Use IpoCurve.bezierPoints instead.
Parameters:
  • curvepos (int) - the position of the curve in the Ipo.
  • pointpos (int) - the position of the point in the curve.
Returns: list of 9 floats
the beztriple of the Ipo, or an error is raised.

setBeztriple(curvepos, pointpos, newbeztriple)

source code 
Sets the beztriple of the Ipo (deprecated). Note: use IpoCurve.bezierPoints to get a BezTriple point, then use the BezTriple API to set the point's attributes.
Parameters:
  • curvepos (int) - the position of the curve in the Ipo.
  • pointpos (int) - the position of the point in the curve.
  • newbeztriple (list of 9 floats) - the new value for the point
Returns: None
None

getCurveCurval(curvepos)

source code 
Gets the current value of a curve of the Ipo (deprecated). Note: new scripts should use IpoCurve.evaluate().
Parameters:
  • curvepos (int or string) - the position of the curve in the Ipo or the name of the curve
Returns: float
the current value of the selected curve of the Ipo.

EvaluateCurveOn(curvepos, time)

source code 
Gets the value at a specific time of a curve of the Ipo (deprecated). Note: new scripts should use IpoCurve.evaluate().
Parameters:
  • curvepos (int) - the position of the curve in the Ipo.
  • time (float) - the desired time.
Returns: float
the current value of the selected curve of the Ipo at the given time.

Instance Variable Details

channel

the current texture channel for Blender object which support textures (materials, lamps and worlds). Returns None if the Ipo does not support texture channels. Value must be in the range [0,9].
Type:
int or None

curveConsts

The valid Ipo curves for this Ipo. These can be used by the [] mapping operator. The value depends on the Ipo curve type. If the Ipo is any type other than a Key or Shape Ipo, this attribute returns a set of constants that can be used to specify a particular curve. For Key or Shape Ipos, the attribute returns a list of all defined keys by name.
Type:
constant or list of strings. Read-only.

fakeUser

When set to True, this datablock wont be removed, even if nothing is using it. All data has this disabled by default except for Actions.
Type:
bool

lib

path to the blend file this datablock is stored in (readonly).

lib will be None unless you are using external blend files with (File, Append/Link)

Note: the path may be relative, to get the full path use Blender.sys.expandpath
Type:
string or None

name

unique name within each blend file.

The name is case sensitive and 21 characters maximum length.

Note: a blend file may have naming collisions when external library data is used, be sure to check the value of lib.

Note: Setting a value longer then 21 characters will be shortened
Type:
string

tag

A temporary tag that to flag data as being used within a loop. always set all tags to True or False before using since blender uses this flag for its own internal operations.
Type:
bool

users

The number of users this datablock has. (readonly) Zero user datablocks are de-allocated after reloading and saving.
Type:
int