[Bf-committers] Python API Flaw
Campbell Barton
cbarton at metavr.com
Tue Oct 10 08:19:40 CEST 2006
theres a flaw in the current python API with Object's
At the moment the python type increases the ID's user count when
allocated and removes the user when decreffed
The problem with this is that we cant know if the object is used in any
scenes, so you can for instance.
set a parent object that is not in a scene.
The other problem is blender its self cant know if an objects user count
reflects how many scenes use it (Im assuming only scenes should be
object users, is this right???)
objects that have a python user are displayed with a blue point to
signify usage in multiple scenes.
This is needed for objects and only because objects are unlinked when
they have no users unlike other datatypes, so removing an object would
otherwise remove the python objects data.
Im not sure this solution is ideal but heres one possibility.
What if we add a short to the Object struct to store python users?
theres a few padding values that could be used without growing the
struct. - pad3 for eg.
That way, if an objects py_user > 0, its not removed on user deletion.
Another alternative is to change blenders functionality not to remove OB
Datablocks on deleation with zero users, but Id prefer not to change this.
- Cam
More information about the Bf-committers
mailing list