Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Pignataro <info@oscurart.com.ar>2017-07-21 01:01:41 +0300
committerEugenio Pignataro <info@oscurart.com.ar>2017-07-21 01:01:41 +0300
commitd3211ca6a367044bc3f597004472aa39dc50a92c (patch)
tree1e62d1e022c802ed74986f162dd75351e46dc769 /oscurart_tools
parent12ff437f3a623fb5f070c029eb60c7d8c4b85b5b (diff)
New Feature: Mirror Lattices
Diffstat (limited to 'oscurart_tools')
-rw-r--r--oscurart_tools/__init__.py2
-rw-r--r--oscurart_tools/oscurart_meshes.py44
2 files changed, 46 insertions, 0 deletions
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'}