[Bf-committers] Deleting objects when scene is deleted

Ken Hughes khughes at pacific.edu
Fri Sep 8 21:27:05 CEST 2006


I'm posting this on the main list since, although Python related, has 
more to do with general Blender functionality.

While tracking down a Python bug (which I introduced) related to 
unlinking objects from scenes, I discovered two things:

(1) It's not possible to "delete" a Blender object from Python.  All 
recent releases (at least back to 2.35, I think) only decrement id.us 
when they probably should be calling free_libblock_us().  As of 2.40, 
it's more complicated since Python itself can now be a user, making it 
impossible in the current API to get the user count to zero unless it's 
done when the Python object is deallocated.

(2) When a scene is deleted in the UI -- specifically, when free_scene() 
is called -- objects are not deleted either.  There are some specific 
comment in the code there which say "don't delete objects".  No one on 
IRC this morning seemed to know why this should be true.  Since the 
objects aren't deleted, their datablock user counts also aren't 
decremented.  Is there some reason NOT to delete the objects?

Ken


More information about the Bf-committers mailing list