[Bf-committers] Proposal for Python IPO Curve module changes

Ken Hughes khughes at pacific.edu
Tue Jan 25 00:51:49 CET 2005


OK, I posted a follow-up yesterday to my previous patch, but
it exceeded the max length for the list.  So this is a
condensed version for discussion:

I added a new dictionary to the BPython IPO module called
CurveTypes.  It enumerated almost all of the IPO curve types,
including world and material texture channels.  A sample
is shown below:

#-----------------------------
import Blender
from Blender.Ipo import CurveTypes

ipo1 = Blender.Ipo.New('Object','ObIpo')
c1 = ipo1.addCurve(CurveTypes.OBJ_LOC_X)        # add "LocX" curve to object IPO
c2 = ipo1.getCurve(CurveTypes.OBJ_LOC_X)        # get "LocX" curve for object IPO

ipo2 = Blender.Ipo.New('Material','MaIpo')
c3 = ipo2.addCurve(CurveTypes.MAT_ALPHA)        # add "Alpha" curve to material IPO
c4 = ipo2.addCurve(CurveTypes['MATT_COLF'])     # add "ColF" texture channel curve
                                                 # (channel 0) to material IPO
c5 = ipo2.addCurve(CurveTypes.MATT_VARF
                    | CurveTypes.TCH_9)          # add "VarF" texture channel curve
                                                 # (channel 9) to material IPO

ipo3 = Blender.Ipo.New('Key','KeIpo')
c6 = ipo3.addCurve(CurveTypes.KEY_SPEED)        # add "Speed" curve to vertex IPO
c7 = ipo3.addCurve(CurveTypes.KEY_SPEED+1)      # add "Key 1" curve to vertex IPO
#-----------------------------

I've modified getCurve() and getCurveCurval() to accept this
type of parameters in addition to curve numbers and text
strings, but as of now addCurve() isn't backward compatible
(it no longer accepts strings).

I've tested it with a script that adds and gets one of each
type of curve (and attempts to get curves which don't exist
or are of the wrong type for the IPO) and it all seems to
work.

So, if this seems like something worthwhile, I'd like to
propose submitting it for some testing while I either add
backward-compatibility for addCurve(), or start working on
deprecating the previous curve number/text string parameters
from getCurve(), getCurveCurval() and others.  Or I can just
turn this over to someone else who wants to run with it.

Ken


More information about the Bf-committers mailing list