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

Gilbert, Joseph jgilbert at tigr.org
Mon Feb 21 23:12:07 CET 2005


Do you willian or stephen know more than I do about the curve/IPO
modules? :))  

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Ken Hughes
Sent: Wednesday, February 16, 2005 7:02 PM
To: bf-python at projects.blender.org; Ken Hughes
Subject: [Bf-python] Proposal for Python IPO Curve module changes


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


I sent this to the bf-committers list about three weeks ago and
have received no response whatsoever, so since it's about Python
I decided maybe it was politely being implied I should send it
somewhere else.  Hopefully the maintainers here can tell me
whether to proceed or not.  I've found these modifications
very useful since I do a lot of script programming which uses
IPOs for animations that's just too tedious to do by hand.

Thanks -- Ken



More information about the Bf-python mailing list