WM: batch rename action clips

Batch rename for action clips works in outliner and 3d view.

Reviewed By: campbellbarton

Ref D15819
This commit is contained in:
Eyad Ahmed 2022-09-26 21:11:23 +10:00 committed by Campbell Barton
parent 2edb8ab739
commit cd7ec0dac6
Notes: blender-bot 2024-02-27 13:26:38 +01:00
Referenced by issue #101227, Crash loading certain .exr file in compositor
Referenced by pull request #115185, Fix #115166: Batch Rename Action Clips error
1 changed files with 25 additions and 0 deletions

View File

@ -2518,6 +2518,7 @@ class WM_OT_batch_rename(Operator):
('BONE', "Bones", ""),
('NODE', "Nodes", ""),
('SEQUENCE_STRIP', "Sequence Strips", ""),
('ACTION_CLIP', "Action Clips", ""),
),
description="Type of data to rename",
)
@ -2690,6 +2691,30 @@ class WM_OT_batch_rename(Operator):
"name",
iface_("Material(s)"),
)
elif data_type == "ACTION_CLIP":
data = (
(
# Outliner.
tuple(set(
action for id in context.selected_ids
if (((animation_data := id.animation_data) is not None) and
((action := animation_data.action) is not None) and
(action.library is None))
))
if space_type == 'OUTLINER' else
# 3D View (default).
tuple(set(
action for ob in context.selected_objects
if (((animation_data := ob.animation_data) is not None) and
((action := animation_data.action) is not None) and
(action.library is None))
))
)
if only_selected else
[id for id in bpy.data.actions if id.library is None],
"name",
iface_("Action(s)"),
)
elif data_type in object_data_type_attrs_map.keys():
attr, descr, ty = object_data_type_attrs_map[data_type]
data = (