diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-05 10:12:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-05 10:18:00 +0300 |
commit | 1df228a416008c3f8a768fddb57d6431cbecbed2 (patch) | |
tree | df93f69dc809b29476086d0dd292323f41d08337 /release/scripts/startup/bl_ui | |
parent | 80d86f303a4ac8d293fc06bc3d1ccb2cd4ebfe5b (diff) |
UI: context menu for other editor types
D3458 by @billreynish w/ edits.
- Context menu for dope-sheet, graph, image & node editors.
- Add type to contenxt menu header.
- Access with W-Key.
- Change UV-editor weld key binding to Shift-W.
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/space_dopesheet.py | 62 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_graph.py | 72 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 38 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 36 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 12 |
5 files changed, 214 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 3fedf8bc08c..136cb03a3fb 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -469,6 +469,66 @@ class DOPESHEET_MT_delete(Menu): layout.operator("action.clean", text="Clean Channels").channels = True +class DOPESHEET_MT_specials(Menu): + bl_label = "Dope Sheet Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator("action.copy", text="Copy") + layout.operator("action.paste", text="Paste") + layout.operator("action.paste", text="Paste Flipped").flipped = True + + layout.separator() + + layout.operator_menu_enum("action.handle_type", "type", text="Handle Type") + layout.operator_menu_enum("action.interpolation_type", "type", text="Interpolation Mode") + layout.operator_menu_enum("action.easing_type", "type", text="Easing Type") + + layout.separator() + + layout.operator("action.keyframe_insert").type = 'SEL' + layout.operator("action.duplicate_move") + layout.operator("action.delete") + + layout.separator() + + layout.operator_menu_enum("action.mirror", "type", text="Mirror") + layout.operator_menu_enum("action.snap", "type", text="Snap") + +class DOPESHEET_MT_channel_specials(Menu): + bl_label = "Dope Sheet Channel Context Menu" + + def draw(self, context): + layout = self.layout + + + layout.operator("anim.channels_setting_enable", text="Mute Channels").type='MUTE' + layout.operator("anim.channels_setting_disable", text="Unmute Channels").type='MUTE' + layout.separator() + layout.operator("anim.channels_setting_enable", text="Protect Channels").type='PROTECT' + layout.operator("anim.channels_setting_disable", text="Unprotect Channels").type='PROTECT' + + layout.separator() + layout.operator("anim.channels_group") + layout.operator("anim.channels_ungroup") + + layout.separator() + layout.operator("anim.channels_editable_toggle") + layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode") + + layout.separator() + layout.operator("anim.channels_expand") + layout.operator("anim.channels_collapse") + + layout.separator() + layout.operator_menu_enum("anim.channels_move", "direction", text="Move...") + + layout.separator() + + layout.operator("anim.channels_delete") + + classes = ( DOPESHEET_HT_header, DOPESHEET_HT_editor_buttons, @@ -482,6 +542,8 @@ classes = ( DOPESHEET_MT_gpencil_channel, DOPESHEET_MT_gpencil_frame, DOPESHEET_MT_delete, + DOPESHEET_MT_specials, + DOPESHEET_MT_channel_specials, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index 7e927bb6385..1eb25700868 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -299,6 +299,76 @@ class GRAPH_MT_delete(Menu): layout.operator("graph.clean").channels = False layout.operator("graph.clean", text="Clean Channels").channels = True + +class GRAPH_MT_specials(Menu): + bl_label = "F-Curve Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator("graph.copy", text="Copy") + layout.operator("graph.paste", text="Paste") + layout.operator("graph.paste", text="Paste Flipped").flipped = True + + layout.separator() + + layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type") + layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode") + layout.operator_menu_enum("graph.easing_type", "type", text="Easing Type") + + layout.separator() + + layout.operator("graph.keyframe_insert").type = 'SEL' + layout.operator("graph.duplicate_move") + layout.operator("graph.delete") + + layout.separator() + + layout.operator_menu_enum("graph.mirror", "type", text="Mirror") + layout.operator_menu_enum("graph.snap", "type", text="Snap") + + +class GRAPH_MT_channel_specials(Menu): + bl_label = "F-Curve Channel Context Menu" + + def draw(self, context): + layout = self.layout + st = context.space_data + + layout.separator() + layout.operator("anim.channels_setting_enable", text="Mute Channels").type='MUTE' + layout.operator("anim.channels_setting_disable", text="Unmute Channels").type='MUTE' + layout.separator() + layout.operator("anim.channels_setting_enable", text="Protect Channels").type='PROTECT' + layout.operator("anim.channels_setting_disable", text="Unprotect Channels").type='PROTECT' + + layout.separator() + layout.operator("anim.channels_group") + layout.operator("anim.channels_ungroup") + + layout.separator() + layout.operator("anim.channels_editable_toggle") + layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode") + + layout.separator() + layout.operator("graph.hide", text="Hide Selected Curves").unselected = False + layout.operator("graph.hide", text="Hide Unselected Curves").unselected = True + layout.operator("graph.reveal") + + layout.separator() + layout.operator("anim.channels_expand") + layout.operator("anim.channels_collapse") + + layout.separator() + layout.operator_menu_enum("anim.channels_move", "direction", text="Move...") + + layout.separator() + + layout.operator("anim.channels_delete") + if st.mode == 'DRIVERS': + layout.operator("graph.driver_delete_invalid") + + classes = ( GRAPH_HT_header, GRAPH_MT_editor_menus, @@ -309,6 +379,8 @@ classes = ( GRAPH_MT_key, GRAPH_MT_key_transform, GRAPH_MT_delete, + GRAPH_MT_specials, + GRAPH_MT_channel_specials, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index b1ff1618d09..457c64c5fed 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -422,6 +422,43 @@ class IMAGE_MT_uvs_select_mode(Menu): props.data_path = "tool_settings.uv_select_mode" +class IMAGE_MT_specials(Menu): + bl_label = "UV Context Menu" + + def draw(self, context): + layout = self.layout + + sima = context.space_data + + # UV Edit Mode + if sima.show_uvedit: + layout.operator("uv.unwrap") + layout.operator("uv.follow_active_quads") + + layout.separator() + + layout.operator("uv.pin").clear = False + layout.operator("uv.pin", text="Unpin").clear = True + + layout.separator() + + layout.operator("uv.weld") + layout.operator("uv.stitch") + + layout.separator() + + layout.operator_enum("uv.align", "axis") # W, 2/3/4 + + layout.separator() + + layout.operator("transform.mirror", text="Mirror X").constraint_axis[0] = True + layout.operator("transform.mirror", text="Mirror Y").constraint_axis[1] = True + + layout.separator() + + layout.menu("IMAGE_MT_uvs_snap") + + class IMAGE_HT_header(Header): bl_space_type = 'IMAGE_EDITOR' @@ -1308,6 +1345,7 @@ classes = ( IMAGE_MT_uvs_mirror, IMAGE_MT_uvs_weldalign, IMAGE_MT_uvs_select_mode, + IMAGE_MT_specials, IMAGE_HT_header, MASK_MT_editor_menus, IMAGE_PT_mask, diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 0963613af5c..fce031f987b 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -290,6 +290,41 @@ class NODE_MT_node_color_specials(Menu): layout.operator("node.node_copy_color", icon='COPY_ID') +class NODE_MT_specials(Menu): + bl_label = "Node Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_DEFAULT' + layout.operator("node.duplicate_move") + layout.operator("node.delete") + layout.operator_context = 'EXEC_DEFAULT' + + layout.operator("node.delete_reconnect") + + layout.separator() + + layout.operator("node.link_make").replace = False + layout.operator("node.link_make", text="Make and Replace Links").replace = True + layout.operator("node.links_detach") + + layout.separator() + + layout.operator("node.group_make", text="Group") + layout.operator("node.group_ungroup", text="Ungroup") + layout.operator("node.group_edit").exit = False + + layout.separator() + + layout.operator("node.hide_toggle") + layout.operator("node.mute_toggle") + layout.operator("node.preview_toggle") + layout.operator("node.hide_socket_toggle") + layout.operator("node.options_toggle") + layout.operator("node.collapse_hide_unused_toggle") + + class NODE_PT_active_node_generic(Panel): bl_space_type = 'NODE_EDITOR' bl_region_type = 'UI' @@ -531,6 +566,7 @@ classes = ( NODE_MT_node, NODE_MT_node_color_presets, NODE_MT_node_color_specials, + NODE_MT_specials, NODE_PT_active_node_generic, NODE_PT_active_node_color, NODE_PT_active_node_properties, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4f3396c9ed8..ea3a804e7c3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1483,7 +1483,7 @@ class VIEW3D_MT_object_clear(Menu): class VIEW3D_MT_object_specials(Menu): - bl_label = "Context Menu" + bl_label = "Object Context Menu" @classmethod def poll(cls, context): @@ -2113,7 +2113,7 @@ class VIEW3D_MT_particle(Menu): class VIEW3D_MT_particle_specials(Menu): - bl_label = "Context Menu" + bl_label = "Particle Context Menu" def draw(self, context): layout = self.layout @@ -2363,7 +2363,7 @@ class VIEW3D_MT_pose_apply(Menu): class VIEW3D_MT_pose_specials(Menu): - bl_label = "Context Menu" + bl_label = "Pose Context Menu" def draw(self, context): layout = self.layout @@ -2496,7 +2496,7 @@ class VIEW3D_MT_edit_mesh(Menu): class VIEW3D_MT_edit_mesh_specials(Menu): - bl_label = "Context Menu" + bl_label = "Mesh Context Menu" def draw(self, context): layout = self.layout @@ -3030,7 +3030,7 @@ class VIEW3D_MT_edit_curve_clean(Menu): class VIEW3D_MT_edit_curve_specials(Menu): - bl_label = "Context Menu" + bl_label = "Curve Context Menu" def draw(self, context): layout = self.layout @@ -3244,7 +3244,7 @@ class VIEW3D_MT_edit_armature(Menu): class VIEW3D_MT_armature_specials(Menu): - bl_label = "Context Menu" + bl_label = "Armature Context Menu" def draw(self, context): layout = self.layout |