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
This commit is contained in:
parent
4fa3eadce9
commit
d6e7241237
Notes:
blender-bot
2024-01-31 11:35:08 +01:00
Referenced by issue #101565, Tool Tip Rename Marker Referenced by issue #97411, NLA Editor - hotkey to rename active marker dysfunctional
|
@ -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'},
|
||||
|
|
|
@ -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'}),
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue