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-10-02 22:32:41 +0300
committerEugenio Pignataro <info@oscurart.com.ar>2017-10-02 22:32:41 +0300
commitbbe7d59307469ec2c52273136d4dfab336485ad4 (patch)
treeca57f3b69da8b9e5c3332852eb00b7c6a53eb3ab
parentdfdf55714c8536c6f8ecac5ce865fe932d6d4308 (diff)
New Tool Copy Paste Uv Island
-rw-r--r--oscurart_tools/__init__.py3
-rw-r--r--oscurart_tools/oscurart_meshes.py66
2 files changed, 69 insertions, 0 deletions
diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 72a40a3d..367e7475 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -197,6 +197,9 @@ class OscPanelMesh(Panel):
colrow = col.row(align=1)
colrow.operator("mesh.overlap_uv_faces", icon="UV_FACESEL")
colrow = col.row(align=1)
+ 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 = 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 f6ba46ff..9b1314b3 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -562,3 +562,69 @@ class LatticeMirror(Operator):
def execute(self, context):
defLatticeMirror(self, context)
return {'FINISHED'}
+
+
+# -------------------------- OVERLAP UV ISLANDS
+
+def defCopyUvsIsland(self, context):
+ bpy.ops.object.mode_set(mode="OBJECT")
+ global obLoop
+ global islandFaces
+ obLoop = []
+ islandFaces = []
+ for poly in bpy.context.object.data.polygons:
+ if poly.select:
+ islandFaces.append(poly.index)
+ for li in poly.loop_indices:
+ obLoop.append(li)
+
+ bpy.ops.object.mode_set(mode="EDIT")
+
+def defPasteUvsIsland(self, context):
+ bpy.ops.object.mode_set(mode="OBJECT")
+ TobLoop = []
+ TislandFaces = []
+ for poly in bpy.context.object.data.polygons:
+ if poly.select:
+ TislandFaces.append(poly.index)
+ for li in poly.loop_indices:
+ TobLoop.append(li)
+
+ for source,target in zip(range(min(obLoop),max(obLoop)+1),range(min(TobLoop),max(TobLoop)+1)):
+ bpy.context.object.data.uv_layers.active.data[target].uv = bpy.context.object.data.uv_layers.active.data[source].uv
+
+ bpy.ops.object.mode_set(mode="EDIT")
+
+
+
+class CopyUvIsland(Operator):
+ """Copy Uv Island"""
+ bl_idname = "mesh.uv_island_copy"
+ bl_label = "Copy Uv Island"
+ bl_options = {"REGISTER", "UNDO"}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.active_object is not None and
+ context.active_object.type == 'MESH' and
+ context.active_object.mode == "EDIT")
+
+ def execute(self, context):
+ defCopyUvsIsland(self, context)
+ return {'FINISHED'}
+
+class PasteUvIsland(Operator):
+ """Paste Uv Island"""
+ bl_idname = "mesh.uv_island_paste"
+ bl_label = "Paste Uv Island"
+ bl_options = {"REGISTER", "UNDO"}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.active_object is not None and
+ context.active_object.type == 'MESH' and
+ context.active_object.mode == "EDIT")
+
+ def execute(self, context):
+ defPasteUvsIsland(self, context)
+ return {'FINISHED'} \ No newline at end of file