[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4380] contrib/py/scripts/addons/ oscurart_tools: Add new option: Copy Layers from active object to other Scenes in the BlendFile.

Eugenio Pignataro info at oscurart.com.ar
Fri Mar 15 16:56:49 CET 2013


Revision: 4380
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4380
Author:   oscurart
Date:     2013-03-15 15:56:48 +0000 (Fri, 15 Mar 2013)
Log Message:
-----------
Add new option: Copy Layers from active object to other Scenes in the BlendFile.

Modified Paths:
--------------
    contrib/py/scripts/addons/oscurart_tools/__init__.py
    contrib/py/scripts/addons/oscurart_tools/oscurart_objects.py

Modified: contrib/py/scripts/addons/oscurart_tools/__init__.py
===================================================================
--- contrib/py/scripts/addons/oscurart_tools/__init__.py	2013-03-15 12:11:08 UTC (rev 4379)
+++ contrib/py/scripts/addons/oscurart_tools/__init__.py	2013-03-15 15:56:48 UTC (rev 4380)
@@ -132,9 +132,11 @@
         row = col.row()
 
         colrow = col.row(align=1)
-        colrow.operator("objects.relink_objects_between_scenes", icon="LINKED")
-        colrow.operator("objects.copy_objects_groups_layers", icon="LINKED")
+        colrow.operator("object.relink_objects_between_scenes", icon="LINKED")
         colrow = col.row(align=1)
+        colrow.operator("object.copy_objects_groups_layers", icon="LINKED")        
+        colrow.operator("object.set_layers_to_other_scenes", icon="LINKED")
+        colrow = col.row(align=1)
         colrow.prop(bpy.context.scene, "SearchAndSelectOt", text="")
         colrow.operator("object.search_and_select_osc", icon="ZOOM_SELECTED")
         colrow = col.row(align=1)

Modified: contrib/py/scripts/addons/oscurart_tools/oscurart_objects.py
===================================================================
--- contrib/py/scripts/addons/oscurart_tools/oscurart_objects.py	2013-03-15 12:11:08 UTC (rev 4379)
+++ contrib/py/scripts/addons/oscurart_tools/oscurart_objects.py	2013-03-15 15:56:48 UTC (rev 4380)
@@ -200,7 +200,7 @@
         OBJ.select=True
 
 class OscRelinkObjectsBetween (bpy.types.Operator):
-    bl_idname = "objects.relink_objects_between_scenes"
+    bl_idname = "object.relink_objects_between_scenes"
     bl_label = "Relink Objects Between Scenes"
     bl_options = {"REGISTER", "UNDO"}
 
@@ -243,7 +243,7 @@
     bpy.context.scene.objects.active=ACTOBJ
     
 class OscCopyObjectGAL (bpy.types.Operator):
-    bl_idname = "objects.copy_objects_groups_layers"
+    bl_idname = "object.copy_objects_groups_layers"
     bl_label = "Copy Groups And Layers"
     bl_options = {"REGISTER", "UNDO"}
 
@@ -335,3 +335,30 @@
 
 
 
+## ======================== SET LAYERS TO OTHER SCENES =====================================
+
+
+def DefSetLayersToOtherScenes():
+    actsc = bpy.context.screen.scene
+    for object in bpy.context.selected_objects[:]:
+        lyrs = object.layers[:]
+        for scene in bpy.data.scenes[:]:
+            if object in scene.objects[:]:
+                bpy.context.screen.scene = scene
+                object.layers = lyrs  
+            else:
+                print ("* %s is not in %s" % (object.name, scene.name))    
+  
+        
+    bpy.context.screen.scene = actsc        
+    
+    
+class SetLayersToOtherScenes (bpy.types.Operator):
+    bl_idname = "object.set_layers_to_other_scenes"
+    bl_label = "Copy actual Layers to Other Scenes"
+    bl_options = {"REGISTER", "UNDO"}
+
+
+    def execute (self, context):
+        DefSetLayersToOtherScenes()
+        return {'FINISHED'}
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list