From ede675705e2746ddedf56ffdbdfc8cead980a04d Mon Sep 17 00:00:00 2001 From: Nika Kutsniashvili Date: Mon, 13 May 2024 16:27:23 +0200 Subject: [PATCH] UI: Reorganize 'Select' menus in editors Reorganizes (and in some cases add missing operators to) all 'Select' menus in all editors except 3D Viewport (done in a separate patch). The goal of this change is to make menus as consistent as possible, and to group & sort items according to a certain logic, which should be easy to remember and users can always expect certain items to be always at same place in every editor. More details and images in the pull request. Pull Request: https://projects.blender.org/blender/blender/pulls/121337 --- scripts/startup/bl_ui/space_clip.py | 27 ++++++++++++++++---- scripts/startup/bl_ui/space_dopesheet.py | 19 +++++++------- scripts/startup/bl_ui/space_filebrowser.py | 2 +- scripts/startup/bl_ui/space_graph.py | 15 ++++++----- scripts/startup/bl_ui/space_image.py | 7 +++--- scripts/startup/bl_ui/space_node.py | 16 +++++++----- scripts/startup/bl_ui/space_sequencer.py | 29 ++++++++-------------- 7 files changed, 64 insertions(+), 51 deletions(-) diff --git a/scripts/startup/bl_ui/space_clip.py b/scripts/startup/bl_ui/space_clip.py index 65036fccfd9..8a27efd7f0d 100644 --- a/scripts/startup/bl_ui/space_clip.py +++ b/scripts/startup/bl_ui/space_clip.py @@ -304,6 +304,8 @@ class CLIP_MT_tracking_editor_menus(Menu): layout.menu("CLIP_MT_reconstruction") else: layout.menu("CLIP_MT_clip") + elif sc.view == 'GRAPH': + layout.menu("CLIP_MT_select_graph") class CLIP_MT_masking_editor_menus(Menu): @@ -1592,21 +1594,35 @@ class CLIP_MT_select(Menu): def draw(self, _context): layout = self.layout + layout.operator("clip.select_all", text="All").action = 'SELECT' + layout.operator("clip.select_all", text="None").action = 'DESELECT' + layout.operator("clip.select_all", text="Inverse").action = 'INVERT' + + layout.separator() + layout.operator("clip.select_box") layout.operator("clip.select_circle") layout.operator_menu_enum("clip.select_lasso", "mode") layout.separator() - layout.operator("clip.select_all").action = 'TOGGLE' - layout.operator("clip.select_all", text="Inverse").action = 'INVERT' - layout.menu("CLIP_MT_select_grouped") layout.separator() - layout.operator("clip.stabilize_2d_select") - layout.operator("clip.stabilize_2d_rotation_select") + layout.operator("clip.stabilize_2d_select", text="Stabilization Tracks") + layout.operator("clip.stabilize_2d_rotation_select", text="Stabilization Rotation Tracks") + + +class CLIP_MT_select_graph(Menu): + bl_label = "Select" + + def draw(self, _context): + layout = self.layout + + layout.operator("clip.graph_select_all_markers", text="All").action="SELECT" + layout.operator("clip.graph_select_all_markers", text="None").action="DESELECT" + layout.operator("clip.graph_select_all_markers", text="Invert").action="INVERT" class CLIP_MT_tracking_context_menu(Menu): @@ -1995,6 +2011,7 @@ classes = ( CLIP_MT_track_visibility, CLIP_MT_track_cleanup, CLIP_MT_select, + CLIP_MT_select_graph, CLIP_MT_select_grouped, CLIP_MT_tracking_context_menu, CLIP_MT_plane_track_image_context_menu, diff --git a/scripts/startup/bl_ui/space_dopesheet.py b/scripts/startup/bl_ui/space_dopesheet.py index ee72f45b035..a9d26efbc49 100644 --- a/scripts/startup/bl_ui/space_dopesheet.py +++ b/scripts/startup/bl_ui/space_dopesheet.py @@ -454,10 +454,18 @@ class DOPESHEET_MT_select(Menu): layout.separator() layout.operator("action.select_box").axis_range = False layout.operator("action.select_box", text="Box Select (Axis Range)").axis_range = True - layout.operator("action.select_circle") layout.operator_menu_enum("action.select_lasso", "mode") + # FIXME: grease pencil mode isn't supported for these yet, so skip for that mode only + if context.space_data.mode != 'GPENCIL': + layout.separator() + layout.operator("action.select_more", text="More") + layout.operator("action.select_less", text="Less") + + layout.separator() + layout.operator("action.select_linked") + layout.separator() layout.operator("action.select_column", text="Columns on Selected Keys").mode = 'KEYS' layout.operator("action.select_column", text="Column on Current Frame").mode = 'CFRA' @@ -473,15 +481,6 @@ class DOPESHEET_MT_select(Menu): props.extend = False props.mode = 'RIGHT' - # FIXME: grease pencil mode isn't supported for these yet, so skip for that mode only - if context.space_data.mode != 'GPENCIL': - layout.separator() - layout.operator("action.select_more") - layout.operator("action.select_less") - - layout.separator() - layout.operator("action.select_linked") - class DOPESHEET_MT_marker(Menu): bl_label = "Marker" diff --git a/scripts/startup/bl_ui/space_filebrowser.py b/scripts/startup/bl_ui/space_filebrowser.py index 198407aaefa..18900765936 100644 --- a/scripts/startup/bl_ui/space_filebrowser.py +++ b/scripts/startup/bl_ui/space_filebrowser.py @@ -680,7 +680,7 @@ class ASSETBROWSER_MT_select(AssetBrowserMenu, Menu): layout.operator("file.select_all", text="All").action = 'SELECT' layout.operator("file.select_all", text="None").action = 'DESELECT' - layout.operator("file.select_all", text="Inverse").action = 'INVERT' + layout.operator("file.select_all", text="Invert").action = 'INVERT' layout.separator() diff --git a/scripts/startup/bl_ui/space_graph.py b/scripts/startup/bl_ui/space_graph.py index fb4f3ffa309..330a16dc664 100644 --- a/scripts/startup/bl_ui/space_graph.py +++ b/scripts/startup/bl_ui/space_graph.py @@ -205,10 +205,16 @@ class GRAPH_MT_select(Menu): props.axis_range = True props = layout.operator("graph.select_box", text="Box Select (Include Handles)") props.include_handles = True - layout.operator("graph.select_circle") layout.operator_menu_enum("graph.select_lasso", "mode") + layout.separator() + layout.operator("graph.select_more", text="More") + layout.operator("graph.select_less", text="Less") + + layout.separator() + layout.operator("graph.select_linked") + layout.separator() layout.operator("graph.select_column", text="Columns on Selected Keys").mode = 'KEYS' layout.operator("graph.select_column", text="Column on Current Frame").mode = 'CFRA' @@ -234,13 +240,6 @@ class GRAPH_MT_select(Menu): props.right_handle_action = 'DESELECT' props.key_action = 'SELECT' - layout.separator() - layout.operator("graph.select_more") - layout.operator("graph.select_less") - - layout.separator() - layout.operator("graph.select_linked") - class GRAPH_MT_marker(Menu): bl_label = "Marker" diff --git a/scripts/startup/bl_ui/space_image.py b/scripts/startup/bl_ui/space_image.py index adc754bcf79..5ee4a6b2029 100644 --- a/scripts/startup/bl_ui/space_image.py +++ b/scripts/startup/bl_ui/space_image.py @@ -154,20 +154,21 @@ class IMAGE_MT_select(Menu): layout.operator("uv.select_box").pinned = False layout.operator("uv.select_box", text="Box Select Pinned").pinned = True layout.operator("uv.select_circle") + layout.operator_menu_enum("uv.select_lasso", "mode", text="Lasso Select") layout.separator() - layout.operator("uv.select_less", text="Less") layout.operator("uv.select_more", text="More") + layout.operator("uv.select_less", text="Less") layout.separator() - layout.operator("uv.select_pinned") + layout.operator_menu_enum("uv.select_similar", "type", text="Select Similar") layout.menu("IMAGE_MT_select_linked") - layout.operator("uv.select_similar") layout.separator() + layout.operator("uv.select_pinned", text="Select Pinned") layout.operator("uv.select_split") layout.operator("uv.select_overlap") diff --git a/scripts/startup/bl_ui/space_node.py b/scripts/startup/bl_ui/space_node.py index 339d38e7b62..ea9ebb3dc6f 100644 --- a/scripts/startup/bl_ui/space_node.py +++ b/scripts/startup/bl_ui/space_node.py @@ -310,25 +310,29 @@ class NODE_MT_select(Menu): def draw(self, _context): layout = self.layout + layout.operator("node.select_all", text="All").action = 'SELECT' + layout.operator("node.select_all", text="None").action = 'DESELECT' + layout.operator("node.select_all", text="Invert").action = 'INVERT' + + layout.separator() + layout.operator("node.select_box").tweak = False layout.operator("node.select_circle") layout.operator_menu_enum("node.select_lasso", "mode") layout.separator() - layout.operator("node.select_all").action = 'TOGGLE' - layout.operator("node.select_all", text="Invert").action = 'INVERT' - layout.operator("node.select_linked_from") - layout.operator("node.select_linked_to") + layout.operator("node.select_linked_from", text="Linked from") + layout.operator("node.select_linked_to", text="Linked to") layout.separator() - layout.operator("node.select_grouped").extend = False + layout.operator_menu_enum("node.select_grouped", "type", text="Select Grouped") layout.operator("node.select_same_type_step", text="Activate Same Type Previous").prev = True layout.operator("node.select_same_type_step", text="Activate Same Type Next").prev = False layout.separator() - layout.operator("node.find_node") + layout.operator("node.find_node", text="Find Node...") class NODE_MT_node(Menu): diff --git a/scripts/startup/bl_ui/space_sequencer.py b/scripts/startup/bl_ui/space_sequencer.py index c6d9f222a51..d1312fcc182 100644 --- a/scripts/startup/bl_ui/space_sequencer.py +++ b/scripts/startup/bl_ui/space_sequencer.py @@ -550,17 +550,6 @@ class SEQUENCER_MT_select_channel(Menu): layout.operator("sequencer.select_side", text="Both Sides").side = 'BOTH' -class SEQUENCER_MT_select_linked(Menu): - bl_label = "Select Linked" - - def draw(self, _context): - layout = self.layout - - layout.operator("sequencer.select_linked", text="All") - layout.operator("sequencer.select_less", text="Less") - layout.operator("sequencer.select_more", text="More") - - class SEQUENCER_MT_select(Menu): bl_label = "Select" @@ -585,16 +574,21 @@ class SEQUENCER_MT_select(Menu): col.separator() + if has_sequencer: + col.operator("sequencer.select_more", text="More") + col.operator("sequencer.select_less", text="Less") + col.separator() + + col.operator_menu_enum("sequencer.select_grouped", "type", text="Select Grouped") + col.enabled = not is_retiming + if has_sequencer: + col.operator("sequencer.select_linked", text="Select Linked") + col.separator() + if has_sequencer: col.operator_menu_enum("sequencer.select_side_of_frame", "side", text="Side of Frame...") col.menu("SEQUENCER_MT_select_handle", text="Handle") col.menu("SEQUENCER_MT_select_channel", text="Channel") - col.menu("SEQUENCER_MT_select_linked", text="Linked") - - col.separator() - - col.operator_menu_enum("sequencer.select_grouped", "type", text="Grouped") - col.enabled = not is_retiming class SEQUENCER_MT_marker(Menu): @@ -2857,7 +2851,6 @@ classes = ( SEQUENCER_MT_proxy, SEQUENCER_MT_select_handle, SEQUENCER_MT_select_channel, - SEQUENCER_MT_select_linked, SEQUENCER_MT_select, SEQUENCER_MT_marker, SEQUENCER_MT_navigation,