diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-09-08 22:31:09 +0400 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-09-08 22:31:09 +0400 |
commit | f108325904c2d93e003f748c17bb6ba2b909fb0d (patch) | |
tree | 4929310b38f9cfa530c370ea6869f0becb52d518 /source/blender/src/editobject.c | |
parent | 1b6cf3e6eed4cd57e6c870ea6fcb389bda659ba5 (diff) |
===Python API===
Bugfix for #4971: Scene.unlink() was incorrectly decrementing the datablock
user count whenever an object was removed from a scene, instead of only when
the object's count reached 0. The Python code was modified to use the
existing free_and_unlink_base() function (with some modifications to allow
specifying a scene). Also fixed a bug with the undocumented return codes
from the method; it now returns True if the object was found in the scene.
Diffstat (limited to 'source/blender/src/editobject.c')
-rw-r--r-- | source/blender/src/editobject.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 98230db32ab..c8301f07ec8 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -233,15 +233,21 @@ void add_objectLamp(short type) allqueue(REDRAWALL, 0); } +/* remove base from a specific scene */ /* note: now unlinks constraints as well */ +void free_and_unlink_base_from_scene(Scene *scene, Base *base) +{ + BLI_remlink(&scene->base, base); + free_libblock_us(&G.main->object, base->object); + MEM_freeN(base); +} + +/* remove base from the current scene */ void free_and_unlink_base(Base *base) { if (base==BASACT) BASACT= NULL; - - BLI_remlink(&G.scene->base, base); - free_libblock_us(&G.main->object, base->object); - MEM_freeN(base); + free_and_unlink_base_from_scene(G.scene, base); } void delete_obj(int ok) |