Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRedMser <RedMser>2022-04-14 11:56:08 +0300
committerSybren A. Stüvel <sybren@blender.org>2022-04-14 11:58:14 +0300
commitd6e72412373e2f90969b2f2a6ecfcb420011784b (patch)
tree192a0e71c9760e6d9fe1ed66aa16afda34adce13 /release
parent4fa3eadce99a87de90b8119e49cfd8ccba56c305 (diff)
Animation: Add F2 for renaming markers
F2 allows renaming lots of different types of active items, and now it also works for markers. Before, Ctrl+M was used, and it's context-sensitive: you often get "Mirror Keys" instead, when your cursor isn't on the markers region, and that operator has nothing to do with either renaming or markers. **What this commit does:** - Replace Ctrl+M shortcut with F2. - Adds the `TOPBAR_PT_name_marker` panel which is implemented similar to the global rename panel. This having to press enter twice to confirm or escape twice to cancel, which would happen if the `marker.rename` operator was called directly. - Replace usages of `marker.rename` in the UI with `wm.call_panel`. - To make the Industry Compatible keymap consistent with Blender Default, the rename shortcut only works when hovering the markers area. Reviewed By: ChrisLend, sybren Differential Revision: https://developer.blender.org/D12298
Diffstat (limited to 'release')
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py6
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py6
-rw-r--r--release/scripts/startup/bl_ui/space_time.py4
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py59
4 files changed, 64 insertions, 11 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 1ebe410b42d..bef89ac2b92 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1026,7 +1026,7 @@ def km_markers(params):
*_template_items_select_actions(params, "marker.select_all"),
("marker.delete", {"type": 'X', "value": 'PRESS'}, None),
("marker.delete", {"type": 'DEL', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
+ op_panel("TOPBAR_PT_name_marker", {"type": 'F2', "value": 'PRESS'}, [("keep_open", False)]),
("marker.move", {"type": 'G', "value": 'PRESS'}, None),
("marker.camera_bind", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
])
@@ -1833,7 +1833,6 @@ def km_graph_editor(params):
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_fcurve'),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
*_template_items_context_menu("GRAPH_MT_context_menu", params.context_menu_event),
])
@@ -2487,7 +2486,6 @@ def km_dopesheet(params):
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_action'),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
("marker.camera_bind", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
*_template_items_context_menu("DOPESHEET_MT_context_menu", params.context_menu_event),
*_template_items_change_frame(params),
@@ -2621,7 +2619,6 @@ def km_nla_editor(params):
("transform.transform", {"type": 'S', "value": 'PRESS'},
{"properties": [("mode", 'TIME_SCALE')]}),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
*_template_items_context_menu("NLA_MT_context_menu", params.context_menu_event),
*_template_items_change_frame(params),
])
@@ -2930,7 +2927,6 @@ def km_sequencer(params):
("transform.transform", {"type": 'E', "value": 'PRESS'},
{"properties": [("mode", 'TIME_EXTEND')]}),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
("sequencer.select_side_of_frame", {"type": 'LEFT_BRACKET', "value": 'PRESS'},
{"properties": [("side", 'LEFT')]}),
("sequencer.select_side_of_frame", {"type": 'RIGHT_BRACKET', "value": 'PRESS'},
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 4c1b905ac05..64039f200e9 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -836,7 +836,7 @@ def km_markers(params):
("marker.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'INVERT')]}),
("marker.delete", {"type": 'BACK_SPACE', "value": 'PRESS'}, None),
("marker.delete", {"type": 'DEL', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None),
+ op_panel("TOPBAR_PT_name_marker", {"type": 'RET', "value": 'PRESS'}, [("keep_open", False)]),
("marker.move", {"type": 'W', "value": 'PRESS'}, None),
])
@@ -937,7 +937,6 @@ def km_graph_editor(params):
("wm.context_menu_enum", {"type": 'X', "value": 'PRESS'},
{"properties": [("data_path", 'space_data.auto_snap')]}),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None),
op_menu_pie("GRAPH_MT_snap_pie", {"type": 'X', "value": 'PRESS', "shift": True}),
])
@@ -1438,7 +1437,6 @@ def km_dopesheet(params):
("wm.context_toggle", {"type": 'B', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.use_proportional_action')]}),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None),
("anim.start_frame_set", {"type": 'LEFT_ARROW', "value": 'PRESS', "ctrl": True}, None),
("anim.end_frame_set", {"type": 'RIGHT_ARROW', "value": 'PRESS', "ctrl": True}, None),
])
@@ -1548,7 +1546,6 @@ def km_nla_editor(params):
*_template_items_context_menu("NLA_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
op_menu_pie("NLA_MT_snap_pie", {"type": 'X', "value": 'PRESS', "shift": True}),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None),
])
return keymap
@@ -1835,7 +1832,6 @@ def km_sequencer(params):
{"properties": [("mode", 'TIME_EXTEND')]}),
*_template_items_context_menu("SEQUENCER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
- ("marker.rename", {"type": 'RET', "value": 'PRESS'}, None),
# Tools
op_tool_cycle("builtin.select_box", {"type": 'Q', "value": 'PRESS'}),
op_tool_cycle("builtin.blade", {"type": 'B', "value": 'PRESS'}),
diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py
index 5296900fa30..b5b124253f3 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -187,7 +187,9 @@ def marker_menu_generic(layout, context):
layout.separator()
- layout.operator("marker.rename", text="Rename Marker")
+ props = layout.operator("wm.call_panel", text="Rename Marker")
+ props.name = "TOPBAR_PT_name_marker"
+ props.keep_open = False
layout.operator("marker.move", text="Move Marker")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 55dcb4a20eb..2cf50bdbf95 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -851,6 +851,64 @@ class TOPBAR_PT_name(Panel):
row.label(text="No active item")
+class TOPBAR_PT_name_marker(Panel):
+ bl_space_type = 'TOPBAR' # dummy
+ bl_region_type = 'HEADER'
+ bl_label = "Rename Marker"
+ bl_ui_units_x = 14
+
+ @staticmethod
+ def is_using_pose_markers(context):
+ sd = context.space_data
+ return (sd.type == 'DOPESHEET_EDITOR' and sd.mode in {'ACTION', 'SHAPEKEY'} and
+ sd.show_pose_markers and sd.action)
+
+ @staticmethod
+ def get_selected_marker(context):
+ if TOPBAR_PT_name_marker.is_using_pose_markers(context):
+ markers = context.space_data.action.pose_markers
+ else:
+ markers = context.scene.timeline_markers
+
+ for marker in markers:
+ if marker.select:
+ return marker
+ return None
+
+ @staticmethod
+ def row_with_icon(layout, icon):
+ row = layout.row()
+ row.activate_init = True
+ row.label(icon=icon)
+ return row
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.label(text="Marker Name")
+
+ scene = context.scene
+ if scene.tool_settings.lock_markers:
+ row = self.row_with_icon(layout, 'ERROR')
+ label = "Markers are locked"
+ row.label(text=label)
+ return
+
+ marker = self.get_selected_marker(context)
+ if marker is None:
+ row = self.row_with_icon(layout, 'ERROR')
+ row.label(text="No active marker")
+ return
+
+ icon = 'TIME'
+ if marker.camera is not None:
+ icon = 'CAMERA_DATA'
+ elif self.is_using_pose_markers(context):
+ icon = 'ARMATURE_DATA'
+ row = self.row_with_icon(layout, icon)
+ row.prop(marker, "name", text="")
+
+
classes = (
TOPBAR_HT_upper_bar,
TOPBAR_MT_file_context_menu,
@@ -877,6 +935,7 @@ classes = (
TOPBAR_PT_gpencil_layers,
TOPBAR_PT_gpencil_primitive,
TOPBAR_PT_name,
+ TOPBAR_PT_name_marker,
)
if __name__ == "__main__": # only for live edit.