diff options
author | William Reynish <billrey@me.com> | 2019-03-20 12:51:37 +0300 |
---|---|---|
committer | William Reynish <billrey@me.com> | 2019-03-20 12:51:37 +0300 |
commit | 3e790e760763df8a46f3d49b8abc2f013928a893 (patch) | |
tree | 99ade905be4e9c21f735f125361dad6b642d5a36 | |
parent | 21cd575e88a253c14348c68b6b2def8289fcfd76 (diff) |
UI: Add context menus to Metaball Edit, Lattice Edit and Text Edit modes
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 3 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 79 |
2 files changed, 77 insertions, 5 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 136637f95f8..c9b271c57ca 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -4026,6 +4026,7 @@ def km_metaball(params): *_template_items_select_actions(params, "mball.select_all"), ("mball.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None), *_template_items_proportional_editing(connected=True), + op_menu("VIEW3D_MT_edit_metaball_context_menu", params.context_menu_event), ]) return keymap @@ -4047,6 +4048,7 @@ def km_lattice(params): ("object.vertex_parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), ("lattice.flip", {"type": 'F', "value": 'PRESS', "alt": True}, None), op_menu("VIEW3D_MT_hook", {"type": 'H', "value": 'PRESS', "ctrl": True}), + op_menu("VIEW3D_MT_edit_lattice_context_menu", params.context_menu_event), *_template_items_proportional_editing(connected=False), ]) @@ -4175,6 +4177,7 @@ def km_font(params): ("font.text_insert", {"type": 'TEXTINPUT', "value": 'ANY', "any": True}, None), ("font.text_insert", {"type": 'BACK_SPACE', "value": 'PRESS', "alt": True}, {"properties": [("accent", True)]}), + op_menu("VIEW3D_MT_edit_text_context_menu", params.context_menu_event), ]) if params.apple: diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 8b9c879199c..ef0e71f4251 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1133,6 +1133,29 @@ class VIEW3D_MT_select_edit_surface(Menu): layout.operator("curve.select_less") +class VIEW3D_MT_edit_text_context_menu(Menu): + bl_label = "Text Context Menu" + + def draw(self, context): + layout = self.layout + + layout = self.layout + + layout.operator_context = 'INVOKE_DEFAULT' + + layout.operator("font.text_cut", text="Cut") + layout.operator("font.text_copy", text="Copy", icon='COPYDOWN') + layout.operator("font.text_paste", text="Paste", icon='PASTEDOWN') + + layout.separator() + + layout.operator("font.select_all") + + layout.separator() + + layout.menu("VIEW3D_MT_edit_font") + + class VIEW3D_MT_select_edit_text(Menu): # intentional name mismatch # select menu for 3d-text doesn't make sense @@ -1153,6 +1176,8 @@ class VIEW3D_MT_select_edit_text(Menu): layout.operator("font.select_all") + layout.menu("VIEW3D_MT_edit_font") + class VIEW3D_MT_select_edit_metaball(Menu): bl_label = "Select" @@ -1178,6 +1203,23 @@ class VIEW3D_MT_select_edit_metaball(Menu): layout.operator_menu_enum("mball.select_similar", "type", text="Similar") +class VIEW3D_MT_edit_lattice_context_menu(Menu): + bl_label = "Lattice Context Menu" + + def draw(self, context): + layout = self.layout + + layout = self.layout + + layout.menu("VIEW3D_MT_mirror") + layout.operator_menu_enum("lattice.flip", "axis") + layout.menu("VIEW3D_MT_snap") + + layout.separator() + + layout.operator("lattice.make_regular") + + class VIEW3D_MT_select_edit_lattice(Menu): bl_label = "Select" @@ -1423,6 +1465,30 @@ class VIEW3D_MT_surface_add(Menu): layout.operator("surface.primitive_nurbs_surface_torus_add", text="Nurbs Torus", icon='SURFACE_NTORUS') +class VIEW3D_MT_edit_metaball_context_menu(Menu): + bl_label = "Metaball Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + + # Add + layout.operator("mball.duplicate_move") + + layout.separator() + + # Modify + layout.menu("VIEW3D_MT_mirror") + layout.menu("VIEW3D_MT_snap") + + layout.separator() + + # Remove + layout.operator_context = 'EXEC_DEFAULT' + layout.operator("mball.delete_metaelems", text="Delete") + + class VIEW3D_MT_metaball_add(Menu): bl_idname = "VIEW3D_MT_metaball_add" bl_label = "Metaball" @@ -3609,15 +3675,11 @@ class VIEW3D_MT_edit_surface(Menu): class VIEW3D_MT_edit_font(Menu): - bl_label = "Text" + bl_label = "Font" def draw(self, context): layout = self.layout - layout.menu("VIEW3D_MT_edit_text_chars") - - layout.separator() - layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD' layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC' @@ -3626,6 +3688,10 @@ class VIEW3D_MT_edit_font(Menu): layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE' layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS' + layout.separator() + + layout.menu("VIEW3D_MT_edit_text_chars") + class VIEW3D_MT_edit_text_chars(Menu): bl_label = "Special Characters" @@ -5807,8 +5873,10 @@ classes = ( VIEW3D_MT_select_edit_mesh, VIEW3D_MT_select_edit_curve, VIEW3D_MT_select_edit_surface, + VIEW3D_MT_edit_text_context_menu, VIEW3D_MT_select_edit_text, VIEW3D_MT_select_edit_metaball, + VIEW3D_MT_edit_lattice_context_menu, VIEW3D_MT_select_edit_lattice, VIEW3D_MT_select_edit_armature, VIEW3D_MT_select_gpencil, @@ -5818,6 +5886,7 @@ classes = ( VIEW3D_MT_mesh_add, VIEW3D_MT_curve_add, VIEW3D_MT_surface_add, + VIEW3D_MT_edit_metaball_context_menu, VIEW3D_MT_metaball_add, TOPBAR_MT_edit_curve_add, TOPBAR_MT_edit_armature_add, |