Unhide the Channels region in Graph Editor

I want to implement a function. When there are many bones in a scene, some bones Channels Region are expanded and some are collapsed. I want to design a button to make the Channels Regions of all bones in the scene expand/collapsed. I currently know that bpy.ops.anim.channels_expand() can be used, but it must be in the activated bone interface. what should I do?

Only the bone channel group can be expanded/collapsed via python.

import bpy

for g in bpy.context.object.animation_data.action.groups:
    g.show_expanded_graph = True

The armature and action channels must be done via operators.

1 Like

Thanks again for your help, it has been resolved :slight_smile: