[Bf-python] Bone module simplification

Yann Vernier yann at algonet.se
Sun Jan 23 21:31:08 CET 2005


On Wed, Jan 05, 2005 at 10:09:36AM +0100, Yann Vernier wrote:
> On Tue, Jan 04, 2005 at 11:22:48AM -0500, Gilbert, Joseph wrote:
> > This way all python objects reside in python and when a script exits -
> > python cleans up the mess (for bones that were nonsense). If you make
> > the Bone class a wrapper for C objects directly people may not use them
> > (maybe only as temporary objects) and they will occupy memory until
> > Blender exits - since datastructs in blender are not 'freed' till exit()
> > is called. 

I asked Ton about this, and unless we misunderstood each other
guardedalloc reuses memory. Two things about the modified Bone module
make this work properly:
 1. In the dealloc function, the Bone is freed iff it has not been placed
    in an Armature.
 2. There is no way to use the Python interface to remove a Bone from
    an Armature, thus it will never attempt to free a Bone with Blender
    references.
This is the reason that the function to create a pybone from a Bone
pointer also requires a pointer to the Armature the bone is in.



More information about the Bf-python mailing list