When working in the NLA Editor, there are multiple NlaStrips you can edit. You can go in and out of tweak mode to make adjustments to existing strips.
My question is, how to find out which exact NlaStrip is currently being tweaked while in tweak mode. I want to find this out programmatically, with Python.
As far as I can tell, this whole tweak mode system is pretty poorly documented (and similarly poorly designed), so I had to make some guesses based on experiments I've run.
What I've found out is the following: Whenever you go into tweak mode, the action that is being tweaked is now the active action on the relevant object. You can have at most one action being tweaked per object. The action which was previously active will then be stored in the action_tweak_storage field of the object's animation data. Once tweak mode is exited, the action in storage is made the active action again.
But with only this amount of information, it is unclear which NlaStrip is now holding the action which is being tweaked since multiple NlaStrips can hold the same action. Is there a way to find this out?
A follow-up question would be, if there is a lower-level and more performant way to enter and exit tweak mode without using the ops commands bpy.ops.nla.tweakmode_enter and bpy.ops.nla.tweakmode_exit?