2.5
authorTon Roosendaal <ton@blender.org>
Sun, 19 Jul 2009 16:53:57 +0000 (16:53 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 19 Jul 2009 16:53:57 +0000 (16:53 +0000)
Bugfix: the 'active 3d view layer' was never set, causing issues when
adding new objects. Reported by Martin, thanks!

source/blender/editors/space_view3d/view3d_header.c

index 8cceb46c5597246574fc9d432190332dba1bca31..677d3c20de1d5f33c7573cf9c2bb901a4a8bbbbf 100644 (file)
@@ -284,6 +284,21 @@ static int layers_exec(bContext *C, wmOperator *op)
        else 
                v3d->lay = (1<<nr);
        
+       /* set active layer, ensure to always have one */
+       if(v3d->lay & (1<<nr))
+          v3d->layact= 1<<nr;
+       else if((v3d->lay & v3d->layact)==0) {
+               int bit= 0;
+               
+               while(bit<32) {
+                       if(v3d->lay & (1<<bit)) {
+                               v3d->layact= 1<<bit;
+                               break;
+                       }
+                       bit++;
+               }
+       }
+       
        if(v3d->scenelock) handle_view3d_lock(C);
        
        /* new layers might need unflushed events events */