I'm trying to catch an event when an F-Curve is selected in my add-on. I've added a handler to bpy.app.handlers.depsgraph_update_post where I'm iterating through bpy.context.view_layer.depsgraph.updates, however, nothing appears to be triggered for F-Curve selections.
def selection_change_handler(scene):
for u in bpy.context.view_layer.depsgraph.updates:
print(u)
def register():
bpy.app.handlers.depsgraph_update_post.append(selection_change_handler)
I was thinking that I could somehow subscribe to msgbus
with bpy.msgbus.subscribe_rna, but I'm not sure if/how this would work with every FCurve
in a Scene
.
subscribe_to = bpy.types.FCurve.path_resolve("select", False)
#TypeError: descriptor 'path_resolve' for 'bpy_struct' objects doesn't apply to a 'str' object
I also tried adding a draw handler to the Graph Editor, but I've been unsuccessful in getting the context for this correct with a multiple file add-on. https://blender.stackexchange.com/a/76020/81083
Can anyone tell me how I can listen for F-Curve selection updates? Thank you!