[Bf-extensions-cvs] [d86b57b] master: New Tool: Objects to Groups. This is a simple tool for improve the overrides tools

Eugenio Pignataro noreply at git.blender.org
Tue Oct 6 03:18:25 CEST 2015


Commit: d86b57b9f46ac218d74690aa556254629cbb6622
Author: Eugenio Pignataro
Date:   Mon Oct 5 22:18:15 2015 -0300
Branches: master
https://developer.blender.org/rBACd86b57b9f46ac218d74690aa556254629cbb6622

New Tool: Objects to Groups. This is a simple tool for improve the overrides tools

===================================================================

M	oscurart_tools/__init__.py
M	oscurart_tools/oscurart_objects.py

===================================================================

diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 1298e49..1e3e461 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -159,6 +159,8 @@ class OscPanelObject(OscPollObject, bpy.types.Panel):
         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.operator("object.objects_to_groups", icon="GROUP")
+        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)
diff --git a/oscurart_tools/oscurart_objects.py b/oscurart_tools/oscurart_objects.py
index bd4b15e..1a6d214 100644
--- a/oscurart_tools/oscurart_objects.py
+++ b/oscurart_tools/oscurart_objects.py
@@ -413,3 +413,26 @@ class oscDuplicateSymmetricalOp (bpy.types.Operator):
         duplicateSymmetrical(self, self.desconecta)
 
         return {'FINISHED'}
+
+
+
+
+
+##------------------------ OBJECTS TO GROUPS ------------------------
+
+def DefObjectToGroups():
+    scgr = bpy.data.groups.new("%s_MSH" % (os.path.basename(bpy.data.filepath).replace(".blend","")))
+    for ob in bpy.data.objects:
+        if ob.type == "MESH":
+            gr = bpy.data.groups.new(ob.name)
+            gr.objects.link(ob)
+            scgr.objects.link(ob)
+    
+class ObjectsToGroups (bpy.types.Operator):
+    bl_idname = "object.objects_to_groups"
+    bl_label = "Objects to Groups"
+    bl_options = {"REGISTER", "UNDO"}
+    def execute (self, context):
+        DefObjectToGroups()
+        return {'FINISHED'}
+            
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list