[Bf-extensions-cvs] [36190021] master: New Tool: multi mesh edit

Eugenio Pignataro noreply at git.blender.org
Wed Dec 13 16:29:16 CET 2017


Commit: 36190021e9293d647aeb5171dd16e668845199e6
Author: Eugenio Pignataro
Date:   Wed Dec 13 12:29:08 2017 -0300
Branches: master
https://developer.blender.org/rBA36190021e9293d647aeb5171dd16e668845199e6

New Tool: multi mesh edit

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

M	oscurart_tools/__init__.py
M	oscurart_tools/oscurart_meshes.py

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

diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 367e7475..de285c15 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -178,6 +178,7 @@ class OscPanelMesh(Panel):
         return context.scene.oscurart.osc_mesh_tools
 
     def draw(self, context):
+        scene = context.scene
         layout = self.layout
         col = layout.column(align=1)
 
@@ -200,10 +201,15 @@ class OscPanelMesh(Panel):
         colrow.operator("mesh.uv_island_copy", icon="COPYDOWN")
         colrow.operator("mesh.uv_island_paste", icon="PASTEDOWN")        
         colrow = col.row(align=1)
-        colrow.operator("view3d.modal_operator", icon="STICKY_UVS_DISABLE")
+        colrow.operator("view3d.modal_operator", icon="STICKY_UVS_DISABLE")       
         colrow = col.row(align=1)
         colrow.operator("lattice.mirror_selected", icon="LATTICE_DATA")
-
+        colrow = col.row(align=1)
+        colrow.label(text="Multimesh")
+        colrow.prop_search(scene, "multimeshedit", bpy.data, "groups", text="")   
+        colrow = col.row(align=1)
+        colrow.operator("mesh.create_edit_multimesh", icon="IMPORT")
+        colrow.operator("mesh.apply_edit_multimesh", icon="EXPORT")
 
 class OscPanelShapes(Panel):
     bl_idname = "Oscurart Shapes Tools"
@@ -225,8 +231,8 @@ class OscPanelShapes(Panel):
         col.operator("mesh.create_lmr_groups_osc", icon="GROUP_VERTEX")
         col.operator("mesh.split_lr_shapes_osc", icon="SHAPEKEY_DATA")
         colrow = col.row(align=1)
-        colrow.operator("mesh.create_symmetrical_layout_osc", icon="SETTINGS")
-        colrow.operator("mesh.create_asymmetrical_layout_osc", icon="SETTINGS")
+        colrow.operator("mesh.create_symmetrical_layout_osc", icon="IMPORT")
+        colrow.operator("mesh.create_asymmetrical_layout_osc", icon="EXPORT")
 
 
 class OscPanelRender(Panel):
@@ -436,6 +442,7 @@ class OscurartToolsAddonPreferences(AddonPreferences):
 
 
 def register():
+    from bpy.types import Scene
     bpy.utils.register_module(__name__)
 
     bpy.types.Scene.oscurart = PointerProperty(type=View3DOscPanel)
@@ -445,6 +452,8 @@ def register():
     bpy.types.Scene.quick_animation_in = IntProperty(default=1)
     bpy.types.Scene.quick_animation_out = IntProperty(default=250)
 
+    Scene.multimeshedit = StringProperty()
+
     # SETEO VARIABLE DE ENTORNO
     bpy.types.Scene.SearchAndSelectOt = StringProperty(
                                             default="Object name initials"
diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index 55181446..1b0d9d3c 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -637,4 +637,61 @@ class PasteUvIsland(Operator):
 
     def execute(self, context):
         defPasteUvsIsland(self, context)
-        return {'FINISHED'}    
\ No newline at end of file
+        return {'FINISHED'}    
+    
+    
+
+class createEditMultimesh(Operator):
+    """Create Edit Multi Mesh"""
+    bl_idname = "mesh.create_edit_multimesh"
+    bl_label = "Create edit multimesh"
+    bl_options = {"REGISTER", "UNDO"}
+    
+    
+    # creo el merge para editar
+    def execute(self,context):    
+        global relvert
+        global me    
+        global ob 
+        temp = [[ob , [vert.co for vert in ob.data.vertices]]for ob in bpy.data.groups[bpy.context.scene.multimeshedit].objects]
+        vi = 0
+        pi = 0
+        relvert = {}
+        vertlist = []
+        polylist = []
+        for ob in temp:
+            for vert in ob[0].data.vertices:
+                #print(vert.co[:])
+                vertlist.append(vert.co+ob[0].location)    
+            for poly in ob[0].data.polygons:
+                #print(poly.vertices[:])    
+                polylist.append(tuple([vert+vi for vert in poly.vertices[:]]))
+            relvert[ob[0]] = {vert.index:vert.index+vi for vert in  ob[0].data.vertices}
+            vi += len(ob[0].data.vertices)  
+            ob[0].hide = 1
+        me = bpy.data.meshes.new("editMesh")
+        ob = bpy.data.objects.new("editMesh", me)
+        bpy.context.scene.objects.link(ob)
+        me.from_pydata(vertlist,[],polylist)
+        bpy.ops.object.select_all(action="DESELECT")
+        bpy.context.scene.objects.active = ob
+        bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+        return {'FINISHED'}  
+
+
+class ApplyEditMultimesh(Operator):
+    """Apply Edit Multi Mesh"""
+    bl_idname = "mesh.apply_edit_multimesh"
+    bl_label = "Apply edit multimesh"
+    bl_options = {"REGISTER", "UNDO"}
+   
+    def execute(self,context):    
+        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+        for object,rv in relvert.items():
+            for source, target in rv.items():
+                object.data.vertices[source].co = me.vertices[target].co-object.location
+            object.hide = 0    
+        bpy.context.scene.objects.unlink(ob) 
+        return {'FINISHED'} 
+        
+           
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list