[Bf-committers] Proposal for Python IPO Curve module changes (source/blender/python/api2_2x/Ipo.c)

Ken Hughes khughes at pacific.edu
Sat Jan 22 00:12:34 CET 2005

This follows up on my previous thoughts on changing the
Python interface to Ipo.getCurve() and Ipo.addCurve()
to use dicts for the curve names.

I've played around with adding a dict for camera curves,
and interfacing this to the curve functions.  I based
this on some code for the Texture module.  Example:

    import Blender

     x = Blender.Ipo.Get ('CaIpo')
     x = Blender.Ipo.New ('Camera','CaIpo')
   print x
   c1 = x.addCurve(Blender.Ipo.CurveTypes.CAM_STA)
   c2 = x.getCurve(Blender.Ipo.CurveTypes.CAM_STA)
   print c1.name
   print c2.name

Seems to work OK.  My concern still remains how
to handle the material and world channel IPO curves,
and how to handle "type checking" of curves for
each curve type (i.e., only allow CAM_STA to be
used for Camera IPOs).  My proposal is this:

(1) Include dict entries for MA_MAP1 through
MA_MAP10, and allow ORing of entries to achieve
material and world channel curve names:

    from Blender.Ipo import Curvetypes
    c = x.addCurve(CurveTypes.MA_MAP1 | CurveTypes.MAP_OFS_X)

This avoids having a huge dictionary just to accomodate all
the parameters of the 10 channels.

(2) Encode the ID and curve type into the dict entry to
identify each type of curve.  So the C declaration for
each dict entry would look something like:

    #define EXPP_IPO_CAM_LENS   (((ID_CA)<<16) | CAM_LENS)

and the test would compare
    if ((((icu->blocktype)<<16)|icu->adrcode) == type) {...
to verify the dict entry is correct for the curve type.
These values don't conflict with the MA_MAP codes,
which currently are 0x20 - 0x4000.

If this sounds reasonable, should I go ahead and implement
it, then submit to the list for review?


More information about the Bf-committers mailing list