diff options
author | meta-androcto <meta.androcto1@gmail.com> | 2019-06-01 06:42:17 +0300 |
---|---|---|
committer | meta-androcto <meta.androcto1@gmail.com> | 2019-06-01 06:42:17 +0300 |
commit | 4aa3f51bbae93a7a2c410730401e0764ba9dba88 (patch) | |
tree | 29096af8d52dabf88424f080df1641f0b32d75c0 /space_view3d_pie_menus/pie_select_menu.py | |
parent | a5f2de962763f9c4a037fad0ab2ddf049d73686a (diff) |
space_view3d_pie_menus: fix edit selection modes
Diffstat (limited to 'space_view3d_pie_menus/pie_select_menu.py')
-rw-r--r-- | space_view3d_pie_menus/pie_select_menu.py | 98 |
1 files changed, 78 insertions, 20 deletions
diff --git a/space_view3d_pie_menus/pie_select_menu.py b/space_view3d_pie_menus/pie_select_menu.py index 4f5f8c0b..48819c13 100644 --- a/space_view3d_pie_menus/pie_select_menu.py +++ b/space_view3d_pie_menus/pie_select_menu.py @@ -31,7 +31,11 @@ bl_info = { } import bpy -from bpy.types import Menu +from bpy.types import ( + Menu, + Operator +) + # Pie Selection Object Mode - A @@ -106,7 +110,7 @@ class PIE_MT_SelectionsEM(Menu): pie.operator("view3d.select_circle", text="Circle Select", icon='NONE') # 3 - BOTTOM - RIGHT - pie.menu("PIE_MT_selectallbyselection", text="Multi Select Menu", icon='SNAP_EDGE') + pie.menu("PIE_MT_selectallbyselection", text="Edit Modes", icon='VERTEXSEL') # Select All By Selection @@ -117,28 +121,78 @@ class PIE_MT_SelectAllBySelection(Menu): def draw(self, context): layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' + pie = layout.menu_pie() + box = pie.split().column() + + box.operator("class.vertexop", text="Vertex", icon='VERTEXSEL') + box.operator("class.edgeop", text="Edge", icon='EDGESEL') + box.operator("class.faceop", text="Face", icon='FACESEL') + box.operator("verts.edgesfacesop", text="Vertex/Edges/Faces", icon='OBJECT_DATAMODE') + + +# Edit Selection Modes +class PIE_OT_classvertexop(Operator): + bl_idname = "class.vertexop" + bl_label = "Class Vertex" + bl_description = "Vert Select Mode" + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + if context.object.mode != "EDIT": + bpy.ops.object.mode_set(mode="EDIT") + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') + if bpy.ops.mesh.select_mode != "EDGE, FACE": + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') + return {'FINISHED'} - prop = layout.operator("wm.context_set_value", text="Vertex Select", - icon='VERTEXSEL') - prop.value = "(True, False, False)" - prop.data_path = "tool_settings.mesh_select_mode" - prop = layout.operator("wm.context_set_value", text="Edge Select", - icon='EDGESEL') - prop.value = "(False, True, False)" - prop.data_path = "tool_settings.mesh_select_mode" +class PIE_OT_classedgeop(Operator): + bl_idname = "class.edgeop" + bl_label = "Class Edge" + bl_description = "Edge Select Mode" + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + if context.object.mode != "EDIT": + bpy.ops.object.mode_set(mode="EDIT") + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE') + if bpy.ops.mesh.select_mode != "VERT, FACE": + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE') + return {'FINISHED'} + + +class PIE_OT_classfaceop(Operator): + bl_idname = "class.faceop" + bl_label = "Class Face" + bl_description = "Face Select Mode" + bl_options = {'REGISTER', 'UNDO'} - prop = layout.operator("wm.context_set_value", text="Face Select", - icon='FACESEL') - prop.value = "(False, False, True)" - prop.data_path = "tool_settings.mesh_select_mode" + def execute(self, context): + if context.object.mode != "EDIT": + bpy.ops.object.mode_set(mode="EDIT") + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE') + if bpy.ops.mesh.select_mode != "VERT, EDGE": + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE') + return {'FINISHED'} + + +# Combined Selection Mode +class PIE_OT_vertsedgesfacesop(Operator): + bl_idname = "verts.edgesfacesop" + bl_label = "Verts Edges Faces" + bl_description = "Vert/Edge/Face Select Mode" + bl_options = {'REGISTER', 'UNDO'} - prop = layout.operator("wm.context_set_value", - text="Vertex & Edge & Face Select", - icon='SNAP_VOLUME') - prop.value = "(True, True, True)" - prop.data_path = "tool_settings.mesh_select_mode" + def execute(self, context): + if context.object.mode != "EDIT": + bpy.ops.object.mode_set(mode="EDIT") + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') + if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE": + bpy.ops.object.mode_set(mode="EDIT") + bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') + bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='EDGE') + bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE') + return {'FINISHED'} class PIE_MT_SelectLoopSelection(Menu): @@ -161,6 +215,10 @@ classes = ( PIE_MT_SelectAllBySelection, PIE_MT_SelectionsMore, PIE_MT_SelectLoopSelection, + PIE_OT_classvertexop, + PIE_OT_classedgeop, + PIE_OT_classfaceop, + PIE_OT_vertsedgesfacesop ) addon_keymaps = [] |