[Bf-python] Making IK flag writable in the Bone class

Gilbert, Joseph jgilbert at tigr.org
Mon Oct 25 16:07:29 CEST 2004


Throwing an error is prob a bit extreme. It should prob do nothing and
send a console warning imo, but others might have a better idea.

Yes getIK() is not really applicable in this case as there is nothing
really to get other than a bool value. We could change hasIK() to
getIK() however, this kind of stuff usually ends up breaking the API so
it would be better to leave hasIK() alone and then put a deprecation
warning in hasIK() and reroute it to getIK() if that's better.

Yes Bone class must have an ik variable that calls the get/set
functions.

Hmm.. I don't thing that setIKFlag would be good as you are not only
setting the flag but also setting a new position for the bones. However
getIKFlag might be more descriptive than getIK() (although they may not
be an identifiable pair this way).

Patches go either way. Guess it depends on the size of the code added.

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Jonas
Petersen
Sent: Friday, October 22, 2004 10:09 PM
To: Blender Foundation Python list
Subject: Re: [Bf-python] Making IK flag writable in the Bone class

Ok, good news! :)

I added a Bone_setIK() function which takes an int as parameter.
Question: what should happen if the bone has no parent? Warning / Error 
/ Nothing.
Now it throws a runtime error. But I thought it might be a bit too
strict...

Bone_hasIK() has already functionality of Bone_getIK() so this is no 
problem. Maybe good would be renaming Bone_hasIK() to Bone_getIK() and 
have Bone_hasIK() call Bone_getIK() for campatibility?

I also modified the 'ik' member variable to add write access!

Now the IK flag can be modified in the following ways:

  bone.ik = True
  bone.setIK(True)

I tested it and observed the resulting matrices and other attributes 
(also of child and parent bones) compared to the IK switch in the UI 
panel and everythink looks fine (same results).

Btw. speaking of confusion and misleading... Perhaps it would be more 
clear and appropriate to call the functions getIKFlag() and setIKFlag() 
instead of getIK() / setIK(). What's your opinion?

Last question: if I post a patch to the list, do I paste it in the mail 
body or make an attachment?

Jonas
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list