Anim: improve UI of Replace Action operator

Three small changes that improve the Replace Action UI:

- Add "..." to the label in the menus, to indicate there will be a
  popup.
- If the old or new Action cannot be found, show the Action names
  without the `AC` ID type prefix.
- If the old and new Action are the same, show "Cannot replace Action
  with itself" instead of the more cryptic "Invalid old/new Action
  pair".

Pull Request: https://projects.blender.org/blender/blender/pulls/163959
This commit is contained in:
Sybren A. Stüvel 2026-09-15 16:22:28 +02:00
parent 329ec12fe5
commit 90ed330a82
3 changed files with 12 additions and 5 deletions

View file

@ -643,7 +643,7 @@ class DOPESHEET_MT_action(Menu):
layout = self.layout
layout.operator("anim.merge_animation")
layout.operator("anim.separate_slots")
layout.operator("anim.replace_action")
layout.operator("anim.replace_action", text="Replace Action...")
layout.operator("anim.replace_action_new")
layout.operator("anim.replace_action_duplicate")

View file

@ -3032,7 +3032,7 @@ class VIEW3D_MT_object_animation(Menu):
layout.operator("nla.bake", text="Bake Action...")
layout.operator("grease_pencil.bake_grease_pencil_animation", text="Bake Object Transform to Grease Pencil...")
layout.operator("anim.replace_action")
layout.operator("anim.replace_action", text="Replace Action...")
layout.operator("anim.replace_action_new")
layout.operator("anim.replace_action_duplicate")

View file

@ -1430,12 +1430,19 @@ static wmOperatorStatus replace_action_exec(bContext *C, wmOperator *op)
bAction *new_action = reinterpret_cast<bAction *>(
BKE_libblock_find_session_uid(bmain, ID_AC, new_session_uid));
if (!old_action || !new_action || old_action == new_action) {
if (!old_action || !new_action) {
BKE_reportf(op->reports,
RPT_ERROR_INVALID_INPUT,
"Invalid old/new Action pair ('%s' / '%s')",
old_action ? old_action->id.name : "Invalid UID",
new_action ? new_action->id.name : "Invalid UID");
old_action ? old_action->id.name + 2 : "Invalid UID",
new_action ? new_action->id.name + 2 : "Invalid UID");
return OPERATOR_CANCELLED;
}
if (old_action == new_action) {
BKE_reportf(op->reports,
RPT_ERROR_INVALID_INPUT,
"Cannot replace Action with itself ('%s')",
old_action->id.name + 2);
return OPERATOR_CANCELLED;
}