[Bf-extensions-cvs] [5672605] master: [UV Utility] added RemoveUVByName and RenameActiveUV features.

mifth noreply at git.blender.org
Mon Apr 20 19:48:16 CEST 2015


Commit: 5672605e750b217cbd227318c8dc293fb420c270
Author: mifth
Date:   Mon Apr 20 20:48:26 2015 +0300
Branches: master
https://developer.blender.org/rBAC5672605e750b217cbd227318c8dc293fb420c270

[UV Utility] added RemoveUVByName and RenameActiveUV features.

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

M	uv_utility.py

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

diff --git a/uv_utility.py b/uv_utility.py
index 79b8a82..61f7796 100644
--- a/uv_utility.py
+++ b/uv_utility.py
@@ -97,7 +97,9 @@ class UV_IC_Base(UV_IC_Panel, Panel):
         row = layout.row(align=True)
         row = layout.row(align=True)
         col = layout.column()
-        col.operator("uvutil.select_name", text="Select UV Name")
+        col.operator("uvutil.select_name", text="SelectUVName")
+        col.operator("uvutil.rename_active", text="RenameActiveName")
+        col.operator("uvutil.remove_uv_by_name", text="RemoveUVByName")
         col.prop(scene, "UVTexGetName", text="")
         row = layout.row(align=True)
         col = layout.column()
@@ -154,6 +156,42 @@ class UV_IC_SelectIndex(Operator):
         return{'FINISHED'}
 
 
+class UV_IC_RenameActiveUV(Operator):
+    bl_idname = "uvutil.rename_active"
+    bl_label = "Rename Active UV"
+
+    def execute(self, context):
+        scene = context.scene
+
+        for theObj in context.selected_objects:
+            meshData = theObj.data
+
+            if theObj.type == 'MESH':
+                if meshData.uv_textures:
+                    activeIndex = meshData.uv_textures.active_index
+                    meshData.uv_textures[activeIndex].name = scene.UVTexGetName
+
+        return{'FINISHED'}
+
+
+class UV_IC_RemoveUVByName(Operator):
+    bl_idname = "uvutil.remove_uv_by_name"
+    bl_label = "Remove UV By Name"
+
+    def execute(self, context):
+        scene = context.scene
+
+        for theObj in context.selected_objects:
+            meshData = theObj.data
+
+            if theObj.type == 'MESH':
+                if meshData.uv_textures and scene.UVTexGetName in meshData.uv_textures:
+                    tmpuvmap = meshData.uv_textures[scene.UVTexGetName]
+                    meshData.uv_textures.remove(tmpuvmap)
+
+        return{'FINISHED'}
+
+
 class UV_IC_SelectName(Operator):
     bl_idname = "uvutil.select_name"
     bl_label = "Select Name"



More information about the Bf-extensions-cvs mailing list