[Bf-extensions-cvs] [41522ab5] master: New feature: UV Offset for copy paste uvs

Eugenio Pignataro noreply at git.blender.org
Wed Feb 28 16:17:54 CET 2018


Commit: 41522ab50f4451968a31fb125ba594d8a7ad7a46
Author: Eugenio Pignataro
Date:   Wed Feb 28 12:17:46 2018 -0300
Branches: master
https://developer.blender.org/rBA41522ab50f4451968a31fb125ba594d8a7ad7a46

New feature: UV Offset for copy paste uvs

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

M	oscurart_tools/oscurart_meshes.py

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

diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index ea899d53..6754ac78 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from mathutils import Vector
 from bpy.types import Operator
 from bpy.props import (
         IntProperty,
@@ -580,7 +581,7 @@ def defCopyUvsIsland(self, context):
 
     bpy.ops.object.mode_set(mode="EDIT")        
     
-def defPasteUvsIsland(self, context):
+def defPasteUvsIsland(self, uvOffset, context):
     bpy.ops.object.mode_set(mode="OBJECT")
     selPolys = [poly.index for poly in bpy.context.object.data.polygons if poly.select]
 
@@ -601,8 +602,8 @@ def defPasteUvsIsland(self, context):
                     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.context.object.data.uv_layers.active.data[target].uv = bpy.context.object.data.uv_layers.active.data[source].uv + Vector((uvOffset,0))
+              
         bpy.ops.object.mode_set(mode="EDIT")   
         
 
@@ -628,6 +629,11 @@ class PasteUvIsland(Operator):
     bl_idname = "mesh.uv_island_paste"
     bl_label = "Paste Uv Island"
     bl_options = {"REGISTER", "UNDO"}
+    
+    uvOffset = BoolProperty(
+            name="Uv Offset",
+            default=False
+            )    
 
     @classmethod
     def poll(cls, context):
@@ -636,7 +642,7 @@ class PasteUvIsland(Operator):
                 context.active_object.mode == "EDIT")
 
     def execute(self, context):
-        defPasteUvsIsland(self, context)
+        defPasteUvsIsland(self, self.uvOffset, context)
         return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list