[Bf-extensions-cvs] [d3211ca6] master: New Feature: Mirror Lattices

Eugenio Pignataro noreply at git.blender.org
Fri Jul 21 00:01:50 CEST 2017


Commit: d3211ca6a367044bc3f597004472aa39dc50a92c
Author: Eugenio Pignataro
Date:   Thu Jul 20 19:01:41 2017 -0300
Branches: master
https://developer.blender.org/rBAd3211ca6a367044bc3f597004472aa39dc50a92c

New Feature: Mirror Lattices

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

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

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

diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 6ecf2178..0df0e06b 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -187,6 +187,8 @@ class OscPanelMesh(Panel):
         colrow.operator("mesh.overlap_uv_faces", icon="UV_FACESEL")
         colrow = col.row(align=1)
         colrow.operator("view3d.modal_operator", icon="STICKY_UVS_DISABLE")
+        colrow = col.row(align=1)
+        colrow.operator("lattice.mirror_selected", icon="LATTICE_DATA")
 
 
 
diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index 37ebe5c4..8fd86db1 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -516,3 +516,47 @@ class SelectDoubles(Operator):
     def execute(self, context):
         SelDoubles(self, context)
         return {'FINISHED'}
+
+# -------------------------- SELECT DOUBLES
+
+def defLatticeMirror(self, context):
+
+    ob = bpy.context.object
+    u = ob.data.points_u
+    v = ob.data.points_v
+    w = ob.data.points_w
+    row = u*v
+    total = u*v*w
+    column = 2
+    
+    #guardo indices a cada punto
+    libIndex = {point:index for point, index in zip(bpy.context.object.data.points,range(0,total))}
+
+    #guardo puntos seleccionados
+    selectionPoint = [libIndex[i] for i in ob.data.points if i.select]
+
+    for point in selectionPoint:        
+        rango = list(range(int(point/u)*u,int(point/u)*u+(u)))
+        rango.reverse()        
+        indPorcion = range(int(point/u)*u,int(point/u)*u+(u)).index(point)            
+        ob.data.points[rango[indPorcion]].co_deform.x = -ob.data.points[point].co_deform.x
+        ob.data.points[rango[indPorcion]].co_deform.y = ob.data.points[point].co_deform.y
+        ob.data.points[rango[indPorcion]].co_deform.z = ob.data.points[point].co_deform.z    
+
+
+class LatticeMirror(Operator):
+    """Mirror Lattice"""
+    bl_idname = "lattice.mirror_selected"
+    bl_label = "Mirror Lattice"
+    bl_options = {"REGISTER", "UNDO"}
+
+    @classmethod
+    def poll(cls, context):
+        return (context.active_object is not None and
+                context.active_object.type == 'LATTICE' and
+                context.active_object.mode == "EDIT")
+
+
+    def execute(self, context):
+        defLatticeMirror(self, context)
+        return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list