Bug fix
[blender-addons-contrib.git] / ui_layer_manager.py
old mode 100755 (executable)
new mode 100644 (file)
index c0137e6..e74eada
@@ -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