[Bf-python] Final Ipo/IpoCurve API revisit

Stephen Swaney sswaney at centurytel.net
Sat Apr 15 17:06:13 CEST 2006


On Thu, Apr 13, 2006 at 09:25:35AM -0700, Ken Hughes wrote:
> OK, this is the last step prior to my Ipo update:  it's actually a 
> two-part question.
> 
> antont, stivs and I discussed on IRC two weeks ago whether Ipo curves 
> should be accessed by a string ("ipo['LocX']") or a constant 
> ("ipo[LOCX]").  The disadvantage of strings is... well, they're strings, 
> while the disadvantage of constants here is where to get them from.  As 
> I see it, we would have to declare constants in the Ipo module for every 
> possible Ipocurve type (which as I count them is at least 160 constants) 
> or have a per-Ipo attribute which provides a dict or list of just the 
> constants for that Ipo type.  I already have something like this for the 
> string implementation.
> 
> The real sticking point of using constants are Key/Shapo Ipos:  they do 
> not have a specific name or number, and can be renamed by the user, so a 
> constant would not work naturally for them.  Shape Ipos can be accessed 
> through the Key API, however, and are currently broken in the Ipo API of 
> 2.41, so one solution would be to remove access for them thru the Ipo 
> API completely.  However, using strings to access the Key Ipocurves 
> would be simple to implement.


In general, constants are preferable to strings for reasons we have
already discussed.

A couple thoughts:

 One solution to the string/constant problem is to support constants
 for most IPOs and strings for Key/Shapes.  We can do this by
 overloading the methods to take both types, something we already to
 in other cases.

 Another possibility is to ask Blender to create the Key/Shape
 dictionary for us.  We can then merge it into our execution
 dictionaries with Py_Dict_Update when we run scripts.  Remember that
 one of our long-term goals is to make a true python extension.

A side thought:

 For the different IPO types, it should be possible for the user to
 tell what curves are available for that IPO type.

Ken, would you like to put up a brief design document for your work
on the wiki?

-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list