Index: source/blender/python/api2_2x/Scene.c =================================================================== --- source/blender/python/api2_2x/Scene.c (revision 10892) +++ source/blender/python/api2_2x/Scene.c (working copy) @@ -245,8 +245,11 @@ static int Scene_setLayerMask( BPy_Scene * self, PyObject * value ) { - int laymask = 0; - + int laymask = 0, val, bit; + View3D *vd; + ScrArea *sa; + SpaceLink *sl; + SCENE_DEL_CHECK_INT(self); if (!PyInt_CheckExact(value)) { @@ -263,17 +266,30 @@ self->scene->lay = laymask; /* if this is the current scene then apply the scene layers value * to the view layers value: */ - if (G.vd && (self->scene == G.scene)) { - int val, bit = 0; - G.vd->lay = laymask; + if (self->scene == G.scene) { + sa= G.curscreen->areabase.first; + while(sa) { + sl= sa->spacedata.first; + while(sl) { + if(sl->spacetype==SPACE_VIEW3D) { + vd= (View3D *) sl; + if(vd->scenelock) { + vd->lay= laymask; + bit= 0; - while( bit < 20 ) { - val = 1 << bit; - if( laymask & val ) { - G.vd->layact = val; - break; + while( bit < 20 ) { + val = 1 << bit; + if( laymask & val ) { + vd->layact = val; + break; + } + bit++; + } + } + } + sl= sl->next; } - bit++; + sa= sa->next; } } @@ -310,8 +326,11 @@ static int Scene_setLayerList( BPy_Scene * self, PyObject * value ) { PyObject *item = NULL; - int layers = 0, val, i, len_list; - + int layers = 0, val, i, len_list, bit; + View3D *vd; + ScrArea *sa; + SpaceLink *sl; + SCENE_DEL_CHECK_INT(self); if( !PySequence_Check( value ) ) @@ -344,17 +363,29 @@ } self->scene->lay = layers; - if (G.vd && (self->scene == G.scene)) { - int bit = 0; - G.vd->lay = layers; - - while( bit < 20 ) { - val = 1 << bit; - if( layers & val ) { - G.vd->layact = val; - break; + if (self->scene == G.scene) { + sa= G.curscreen->areabase.first; + while(sa) { + sl= sa->spacedata.first; + while(sl) { + if(sl->spacetype==SPACE_VIEW3D) { + vd= (View3D *) sl; + if(vd->scenelock) { + vd->lay= layers; + bit= 0; + while( bit < 20 ) { + val = 1 << bit; + if( layers & val ) { + vd->layact = val; + break; + } + bit++; + } + } + } + sl= sl->next; } - bit++; + sa= sa->next; } }