patch [#24146] UV layout selection menu in UV editor ala CTRL+TAB in edit mode
This commit is contained in:
parent
31ff2a6da2
commit
e1878f7142
@ -251,6 +251,47 @@ class IMAGE_MT_uvs(bpy.types.Menu):
|
||||
|
||||
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'
|
||||
|
@ -1370,7 +1370,7 @@ class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
|
||||
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 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
@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 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
|
||||
# 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 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
# 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 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
# 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 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
|
||||
|
||||
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')
|
||||
|
@ -251,7 +251,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
|
||||
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);
|
||||
|
@ -3239,6 +3239,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
|
||||
|
||||
/* 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user