Bug fix
authorAlfonso Annarumma <anfeo@libero.it>
Tue, 18 Sep 2012 14:22:02 +0000 (14:22 +0000)
committerAlfonso Annarumma <anfeo@libero.it>
Tue, 18 Sep 2012 14:22:02 +0000 (14:22 +0000)
ui_layer_manager.py

index c0137e6cdd1ceb4219c1c29e6902587c2c680cd6..e74eada79d19412ebee67c274128ffe9be52c559 100644 (file)
@@ -235,31 +235,42 @@ class MergeSelected(bpy.types.Operator):
     def execute(self, context):
         
         layerN = self.layerN
-
+        
+        scene= context.scene
            
         #cyecle all object in the layer 
-        for obj in context.scene.objects:
+        
+        for obj in scene.objects:
+            
             if obj.select:
-                if self.shift:
-                    
-                    if obj.layers[layerN]:
-                        toggle = False
-                    else:
-                
+                visible=False
                 
-                        toggle= True                            
-                    obj.layers[layerN]=toggle
-                
-                else:
+                for i in range(0,20):
+                    if obj.layers[i] and scene.layers[i]:
+                        visible=True
+                        break
+               
+                if visible:
+                    if self.shift:
+                        
+                        if obj.layers[layerN]:
+                            toggle = False
+                        else:
                     
-                  
-                    layer = [False]*20
-                    layer[layerN]=True
-                    obj.layers=layer
-#                   
                     
-                    if obj.layers[layerN]:
-                        toggle = False   
+                            toggle= True                            
+                        obj.layers[layerN]=toggle
+                    
+                    else:
+                        
+                      
+                        layer = [False]*20
+                        layer[layerN]=True
+                        obj.layers=layer
+    #                   
+                        
+                        if obj.layers[layerN]:
+                            toggle = False