[Bf-python] makeparent()

Stephen Swaney sswaney at swbell.net
Tue Nov 11 11:22:39 CET 2003


models at paposo.com wrote:
> 
> The '2' usercount is also on the datablocks. It's because when you call
> add_xxxblock() the usercount get's incremented by 1. However, with python it
> should be set back to 0.  The lamp module does this already.
> 
>  /* let's return user count to zero, because ... */
>  bl_lamp->id.us = 0; /* ... add_lamp() incref'ed it */

Nice work catching this!  When I was doing some testing
earlier, I had noticed that some data objects were not 
getting cleaned up after a save/reload - blender's version
of garbage collection.  At the time, I just put it in the
"Isn't That Strange!" category and didn't look into it further.

> But there are other modules in their xxx_NEW() functions don't.
> Armature.c
> Curve.c
> Ipo.c
> Metaball.c
> Object.c
> Scene.c
> Text.c
> World.c

I went ahead and fixed these.  I figured if I was going to do
one, I might as well do them all.

-- 
Stephen Swaney			
sswaney at swbell.net



More information about the Bf-python mailing list