diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-10-11 07:02:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-10-11 07:02:35 +0400 |
commit | 0ed327f1628520672a6b1b0f5821ff867d3aade2 (patch) | |
tree | 73cf6ea6e89eaf4d7379701c7ba1dfecb5ec2baa /source/blender/python/api2_2x/Scene.c | |
parent | ee831a341165dacd51e330df55990e2b2d36b2f8 (diff) |
Setting new objects scenes layers is & (1<<21)-1
the scenes active object is only unset when unlinking - if the active object is being removed.
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r-- | source/blender/python/api2_2x/Scene.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index 56ffa07bf25..8296fb5d0d4 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -841,8 +841,10 @@ static PyObject *Scene_unlink( BPy_Scene * self, PyObject * args ) base = object_in_scene( bpy_obj->object, scene ); if( base ) { /* if it is, remove it */ + if (scene->basact==base) + scene->basact= NULL; /* in case the object was selected */ + free_and_unlink_base_from_scene( scene, base ); - scene->basact = NULL; /* in case the object was selected */ Py_RETURN_TRUE; } else @@ -1420,7 +1422,7 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args ) base->object = object; /* link object to the new base */ - base->lay= object->lay = scene->lay; /* Layer, by default visible*/ + base->lay= object->lay = scene->lay & (1<<20)-1; /* Layer, by default visible*/ base->flag = SELECT; object->id.us = 1; /* we will exist once in this scene */ @@ -1462,11 +1464,13 @@ static PyObject *SceneObSeq_remove( BPy_SceneObSeq * self, PyObject *args ) else if( blen_ob->type != OB_EMPTY ) return EXPP_ReturnPyObjError( PyExc_RuntimeError, "Object has no data!" ); - + + if (self->bpyscene->scene->basact==base) + self->bpyscene->scene->basact= NULL; /* in case the object was selected */ + BLI_remlink( &(self->bpyscene->scene)->base, base ); blen_ob->id.us--; MEM_freeN( base ); - self->bpyscene->scene->basact = 0; /* in case the object was selected */ } Py_RETURN_NONE; } |