I need to fix up animation on a character mesh every time I resync a linked armature, because the related mesh shape_keys animation gets deleted. Manually I have to navigate to the mesh object, expand, find a track(?) called "Key.005", Add a Track and then find and assign my an action named "Key.005Action" to this NlaTrack (yes, really!).
I want to script around this ... predicament.
How do I script to find the key below the desired mesh name, select and add a track here?
Once I find and select the "Key.005" item/row I could then:
Unfortunately this answer nor this doesn't get me there as nla_tracks for the main object are empty, as will be for the Key.005 sub-whatever.
I include a simple file with a cube with shape keys. How do I assign the KeyAction to "Key.001" with a python script? (but remember that the action on "Key" of "Cube" was deleted upon a resync!)
if there is no existing NlaTrack there, as happens when I resync the armature. So I need to find the "Key.005" row somehow, to then
obj.animation_data.nla_tracks.new()will put a new track in the wrong place, and assigning the Key.005Action there will throw an error.
Could not add action 'Key.005Action' as it cannot be used relative to ID-blocks of type 'OBGenesis8Male.Shape.001'$\endgroup$
obj.data.shape_keys.animation_data.nla_tracksso you would do