From 0c0254018c64365630b6b6fab069d2d0499c8c96 Mon Sep 17 00:00:00 2001 From: William Reynish Date: Tue, 7 May 2019 20:49:53 +0200 Subject: UI: Add initial context menu to NLA Adding to both default and Industry Compat keymap --- .../keyconfig/keymap_data/blender_default.py | 4 +- .../keymap_data/industry_compatible_data.py | 2 + release/scripts/startup/bl_ui/space_nla.py | 45 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) (limited to 'release') diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 52d6dc07859..acd3b44de2c 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -2029,7 +2029,7 @@ def km_nla_generic(_params): return keymap -def km_nla_channels(_params): +def km_nla_channels(params): items = [] keymap = ( "NLA Channels", @@ -2048,6 +2048,7 @@ def km_nla_channels(_params): {"properties": [("above_selected", True)]}), ("nla.tracks_delete", {"type": 'X', "value": 'PRESS'}, None), ("nla.tracks_delete", {"type": 'DEL', "value": 'PRESS'}, None), + op_menu("NLA_MT_channel_context_menu", params.context_menu_event), ]) return keymap @@ -2104,6 +2105,7 @@ def km_nla_editor(params): ("nla.apply_scale", {"type": 'A', "value": 'PRESS', "ctrl": True}, None), ("nla.clear_scale", {"type": 'S', "value": 'PRESS', "alt": True}, None), op_menu_pie("NLA_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}), + op_menu("NLA_MT_context_menu", params.context_menu_event), ("nla.fmodifier_add", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True}, None), ("transform.transform", {"type": 'G', "value": 'PRESS'}, {"properties": [("mode", 'TRANSLATION')]}), diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index 6fa51721d20..5ca2ecb9b8b 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -1409,6 +1409,7 @@ def km_nla_channels(params): {"properties": [("extend", True)]}), ("nla.tracks_delete", {"type": 'BACK_SPACE', "value": 'PRESS'}, None), ("nla.tracks_delete", {"type": 'DEL', "value": 'PRESS'}, None), + op_menu("NLA_MT_channel_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}), ]) return keymap @@ -1472,6 +1473,7 @@ def km_nla_editor(params): {"properties": [("mode", 'TIME_EXTEND')]}), ("transform.transform", {"type": 'R', "value": 'PRESS'}, {"properties": [("mode", 'TIME_SCALE')]}), + op_menu("NLA_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}), ("marker.add", {"type": 'M', "value": 'PRESS'}, None), ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None), ]) diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index ba94769d2c0..324f92daaa2 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -240,6 +240,49 @@ class NLA_MT_snap_pie(Menu): pie.operator("nla.snap", text="Nearest Second").type = 'NEAREST_SECOND' pie.operator("nla.snap", text="Nearest Marker").type = 'NEAREST_MARKER' +class NLA_MT_context_menu(Menu): + bl_label = "NLA Context Menu" + + def draw(self, context): + layout = self.layout + scene = context.scene + + if scene.is_nla_tweakmode: + layout.operator("nla.tweakmode_exit", text="Stop Editing Stashed Action").isolate_action = True + layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions") + else: + layout.operator("nla.tweakmode_enter", text="Start Editing Stashed Action").isolate_action = True + layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions") + + layout.separator() + + layout.operator("nla.duplicate", text="Duplicate").linked = False + layout.operator("nla.duplicate", text="Linked Duplicate").linked = True + + layout.separator() + + layout.operator("nla.split") + layout.operator("nla.delete") + + layout.separator() + + layout.operator("nla.swap") + + layout.separator() + + layout.operator_menu_enum("nla.snap", "type", text="Snap") + + +class NLA_MT_channel_context_menu(Menu): + bl_label = "NLA Channel Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_menu_enum("anim.channels_move", "direction", text="Track Ordering...") + layout.operator("anim.channels_clean_empty") + + classes = ( NLA_HT_header, @@ -251,6 +294,8 @@ classes = ( NLA_MT_add, NLA_MT_edit_transform, NLA_MT_snap_pie, + NLA_MT_context_menu, + NLA_MT_channel_context_menu, NLA_PT_filters, ) -- cgit v1.2.3