[Bf-python] Python API patch for IPO texture channels

Ken Hughes khughes at pacific.edu
Wed Mar 16 15:57:32 CET 2005


Johnny Matthews wrote:
> I was thinking about an easy way to expose IPO baking to the casual
> python user. What if at the object level there was an InsertIPO( )
> call, and you could use it much like in the modeler. Like
> InsertIPO("Loc") or InsertIPO("LocRot") etc.  I have not looked at the
> code that is called in the modeler yet, so I don't know if this would
> work. But it would certainly make adding IPO's a lot more simple and
> let people do it without worrying about curves or beziers or anything
> like that unless they wanted to. I am going to look at this this a
> little and perhaps present a patch if I get something that works.
> Thoughts?

I've only come across the term "baked IPO" before but never heard
a definition, but I think I may understand now based on your
description.  Would a Python function like this do what you're
thinking?

def InsertIPO(kind):
     obj = Blender.Object.GetSelected()[0]
     ipo = obj.getIpo()
     time = Blender.Get('curtime')
     if kind = "Loc" or kind = "LocRot" or kind = "LocRotSize":
         obj.addCurve('LocX').addBezier((curtime,obj.LocX))
         obj.addCurve('LocY').addBezier((curtime,obj.LocY))
         obj.addCurve('LocZ').addBezier((curtime,obj.LocZ))
     if kind = "Rot" or kind = "LocRot" or kind = "LocRotSize":
         obj.addCurve('RotX').addBezier((curtime,obj.RotX/10.0))
         obj.addCurve('RotY').addBezier((curtime,obj.RotY/10.0))
         obj.addCurve('RotZ').addBezier((curtime,obj.RotZ/10.0))
     if kind = "Size" or kind = "LocRotSize":
         obj.addCurve('SizeX').addBezier((curtime,obj.SizeX))
         obj.addCurve('SizeY').addBezier((curtime,obj.SizeY))
         obj.addCurve('SizeZ').addBezier((curtime,obj.SizeZ))

Ken



More information about the Bf-python mailing list