diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-03-10 15:37:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-03-10 15:37:03 +0300 |
commit | 36eba6eb6c733bae0283758e7689595af023c401 (patch) | |
tree | b844393a1326114ac9ef61ecd9aa7d263aa9baef /source/blender/python/api2_2x/Scene.c | |
parent | a8695b1c6e61acaf5fde5b7c5188d361a3ba4ebb (diff) |
PyApi: fix for own bad bug, obdata was having a user removed when the object was removed with (scene.objects.unlink(ob))
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r-- | source/blender/python/api2_2x/Scene.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index c8a1e7d3102..4924cc8c9e4 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -1561,29 +1561,18 @@ static PyObject *SceneObSeq_unlink( BPy_SceneObSeq * self, PyObject *args ) blen_ob = ( ( BPy_Object * ) pyobj )->object; scene = self->bpyscene->scene; - + /* is the object really in the scene? */ base = object_in_scene( blen_ob, scene); - if( base ) { /* if it is, remove it */ - /* check that there is a data block before decrementing refcount */ - if( (ID *)base->object->data ) - ((ID *)base->object->data)->us--; - else if( blen_ob->type != OB_EMPTY ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "Object has no data!" ); - if (scene->basact==base) scene->basact= NULL; /* in case the object was selected */ - - BLI_remlink( &scene->base, base ); - base->object->id.us--; - MEM_freeN( base ); + free_and_unlink_base_from_scene(scene, base); + Py_RETURN_TRUE; } - Py_RETURN_NONE; + Py_RETURN_FALSE; } - PyObject *SceneObSeq_getActive(BPy_SceneObSeq *self) { PyObject *pyob; |