[Bf-python] delCurve()

Ken Hughes khughes at pacific.edu
Mon Oct 31 02:40:13 CET 2005


Johnny Matthews wrote:
> I have this function
>  
>  
> def verifyIpocurve(ky,index):
>   ipo = ky.getIpo()
>   idx = "Key " + str(index)
>   crv = ipo.getCurve(idx)
>   if crv != None:
>     ipo.delCurve(idx)
>   crv = ipo.addCurve(idx)
>   crv.setInterpolation ("Linear")
>   return crv
> where ky is a Mesh.getKey() object and index is a shape key index
>  
> The first time I run this on an object all goes well, but the 2nd time 
> on the same key and index gives "ValueError: Ipo curve already exists" 
> But if the curve already exists, it is supposed to delete it 
> first....any ideas?

Talked this over on IRC, but the bottom like is Key IPOs don't behave 
like other IPOs.  They currently all return "Key" as their name, so you 
can't use getCurve() or delCurve() and have it do what you expect.

Seems like the only way to handle is to pass an integer adrcode to it, 
since that's maybe the only way to uniquely identify the curve (BTW, 
Shape Keys can be named anything, so you *could* name them all "Key" or 
"Bruce" if you wanted to).

Ken



More information about the Bf-python mailing list