I'm trying to delete some specific channels from many objects. I select them but the dope sheet requires me to expand the Action and Transform menus from each object, then selecting each curve and delete. For example, I'd like to delete specifically the "X Location" channel from all selected objects, but from the UI I could only delete all axes from the location or delete a single channel from only one of the objects.
This is really boring, so I thought I'd use Blender's Python API to automate it. However, I'm very new to it and couldn't find how to show the channel's name to the user.
I'm starting with an operator that would scan all selected items' channels and present a list to the user to select which channel to delete from all selected objects. However, the furthest I got was to list those channels by their data_path
and array_index
. I have this so far:
for ob in bpy.context.selected_objects:
anim = ob.animation_data
for group in anim.action.groups:
for channel in group.channels:
print("Channel:", channel)
print("data_path:", channel.data_path, " array_index:", channel.array_index)
print(ob.path_resolve(channel.data_path))
However, the array_index
is not really user-readable. So, here are two-questions-in-one:
Can I delete a single channel from all selected objects?
and
How can I present an FCurve's user-readable name to the user, if it is possible without hard-coding?
By the way, I remember that Blender is now translatable, and it seems the path should be in that direction, but I couldn't find it yet.