UI: Add initial context menu to NLA
authorWilliam Reynish <billrey@me.com>
Tue, 7 May 2019 18:49:53 +0000 (20:49 +0200)
committerWilliam Reynish <billrey@me.com>
Tue, 7 May 2019 18:49:53 +0000 (20:49 +0200)
Adding to both default and Industry Compat keymap

release/scripts/presets/keyconfig/keymap_data/blender_default.py
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
release/scripts/startup/bl_ui/space_nla.py

index 52d6dc0..acd3b44 100644 (file)
@@ -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')]}),
index 6fa5172..5ca2ecb 100644 (file)
@@ -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),
     ])
index ba94769..324f92d 100644 (file)
@@ -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,
 )