1
1

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:
Iyad Ahmed
2022-09-26 21:11:23 +10:00
committed by Campbell Barton
parent 2edb8ab739
commit cd7ec0dac6

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 = (