[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32327] trunk/blender: patch [#24146] UV layout selection menu in UV editor ala CTRL+TAB in edit mode

Campbell Barton ideasman42 at gmail.com
Tue Oct 5 17:29:07 CEST 2010


Revision: 32327
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32327
Author:   campbellbarton
Date:     2010-10-05 17:29:06 +0200 (Tue, 05 Oct 2010)

Log Message:
-----------
patch [#24146] UV layout selection menu in UV editor ala CTRL+TAB in edit mode

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/editors/mesh/mesh_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c

Modified: trunk/blender/release/scripts/ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/ui/space_image.py	2010-10-05 13:39:45 UTC (rev 32326)
+++ trunk/blender/release/scripts/ui/space_image.py	2010-10-05 15:29:06 UTC (rev 32327)
@@ -250,8 +250,49 @@
         layout.separator()
 
         layout.menu("IMAGE_MT_uvs_showhide")
+        
+class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
+    bl_label = "UV Select Mode"
 
+    def draw(self, context):
+        layout = self.layout
 
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        toolsettings = context.tool_settings
+        
+        # do smart things depending on whether uv_select_sync is on
+        
+        if toolsettings.use_uv_select_sync:
+            prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
+            prop.value = "(True, False, False)"
+            prop.data_path = "tool_settings.mesh_select_mode"
+
+            prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
+            prop.value = "(False, True, False)"
+            prop.data_path = "tool_settings.mesh_select_mode"
+
+            prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
+            prop.value = "(False, False, True)"
+            prop.data_path = "tool_settings.mesh_select_mode"
+
+        else:
+            prop = layout.operator("wm.context_set_string", text="Vertex", icon='UV_VERTEXSEL')
+            prop.value = "VERTEX"
+            prop.data_path = "tool_settings.uv_select_mode"
+
+            prop = layout.operator("wm.context_set_string", text="Edge", icon='UV_EDGESEL')
+            prop.value = "EDGE"
+            prop.data_path = "tool_settings.uv_select_mode"
+
+            prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL')
+            prop.value = "FACE"
+            prop.data_path = "tool_settings.uv_select_mode"
+        
+            prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL')
+            prop.value = "ISLAND"
+            prop.data_path = "tool_settings.uv_select_mode"
+
+
 class IMAGE_HT_header(bpy.types.Header):
     bl_space_type = 'IMAGE_EDITOR'
 

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2010-10-05 13:39:45 UTC (rev 32326)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2010-10-05 15:29:06 UTC (rev 32327)
@@ -1370,7 +1370,7 @@
         layout.operator("mesh.select_vertex_path")
 
 
-class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu):
+class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
     bl_label = "Mesh Select Mode"
 
     def draw(self, context):
@@ -1397,7 +1397,7 @@
     @staticmethod
     def extrude_options(context):
         mesh = context.object.data
-        selection_mode = context.tool_settings.mesh_select_mode
+        select_mode = context.tool_settings.mesh_select_mode
 
         totface = mesh.total_face_sel
         totedge = mesh.total_edge_sel
@@ -1405,7 +1405,7 @@
 
         # the following is dependent on selection modes
         # we don't really want that
-#        if selection_mode[0]: # vert
+#        if select_mode[0]: # vert
 #            if totvert == 0:
 #                return ()
 #            elif totvert == 1:
@@ -1418,7 +1418,7 @@
 #                return (0, 2, 3)
 #            else:
 #                return (0, 1, 2, 3)
-#        elif selection_mode[1]: # edge
+#        elif select_mode[1]: # edge
 #            if totedge == 0:
 #                return ()
 #            elif totedge == 1:
@@ -1429,7 +1429,7 @@
 #                return (0, 2)
 #            else:
 #                return (0, 1, 2)
-#        elif selection_mode[2]: # face
+#        elif select_mode[2]: # face
 #            if totface == 0:
 #                return ()
 #            elif totface == 1:
@@ -1479,17 +1479,17 @@
 
     def execute(self, context):
         mesh = context.object.data
-        selection_mode = context.tool_settings.mesh_select_mode
+        select_mode = context.tool_settings.mesh_select_mode
 
         totface = mesh.total_face_sel
         totedge = mesh.total_edge_sel
         totvert = mesh.total_vert_sel
 
-        if selection_mode[2] and totface == 1:
+        if select_mode[2] and totface == 1:
             return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]})
-        elif selection_mode[2] and totface > 1:
+        elif select_mode[2] and totface > 1:
             return bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
-        elif selection_mode[1] and totedge >= 1:
+        elif select_mode[1] and totedge >= 1:
             return bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
         else:
             return bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')

Modified: trunk/blender/source/blender/editors/mesh/mesh_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_ops.c	2010-10-05 13:39:45 UTC (rev 32326)
+++ trunk/blender/source/blender/editors/mesh/mesh_ops.c	2010-10-05 15:29:06 UTC (rev 32327)
@@ -251,7 +251,7 @@
 	WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
 	
 	/* selection mode */
-	WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_selection_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
+	WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
 	
 	/* hide */
 	WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_ops.c	2010-10-05 13:39:45 UTC (rev 32326)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_ops.c	2010-10-05 15:29:06 UTC (rev 32327)
@@ -3239,6 +3239,7 @@
 	
 	/* menus */
 	WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
+	WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
 
 	ED_object_generic_keymap(keyconf, keymap, 2);
 





More information about the Bf-blender-cvs mailing list