[Bf-python] Bone module simplification

Yann Vernier yann at algonet.se
Tue Jan 4 11:45:49 CET 2005


I've now reworked Bone.c, and because of structure changes some bits of 
Bone.h and Armature.c as well. Mainly it's a simplification by always
using Bone structures, not duplicating the fields in BPy_Bone.

http://donkey.dyndns.org/~yann/blender/patches/bonewrap.diff

Please try these changes out.  I think the code is more robust, and I
hope it may be more readable as well.  In particular I'd like to know if
this breaks any scripts that currently create hierarchic armatures (i.e.
armatures where the bones are parented).

Changes include: 
- Fewer memory leaks. For instance the functions to create strings, 
  matrices and vectors all duplicate their data. 
- No more duplicate references (causing references to freed memory). 
  To see what I mean, try parenting bones after adding them into an
  armature with the old code. This is what got me started.
- More efficient code in some cases, for instance clearChildren
  does not move listbase entries one by one. 
- Consistent Python exceptions - most of those thrown were unnecessary 
  and in addition threw the wrong exception type.  Python API functions 
  tend to set appropriate exceptions. 
- Perhaps some inconsistencies were resolved - I think bone parent 
  transformations were doubly applied if you parented before adding 
  bones to armatures.  Doing it the other way would cause memory
  corruption. 
Some weirdness remains, such as whether bone attributes are relative
to their parent or not (they are if both bones are in an armature),
and children not yet added to armatures aren't tracked.

Functionality lost is the probably unintended method to move bones from
one armature to another by reparenting them. I



More information about the Bf-python mailing list