I want my script to add the selected object to the NLA editor, add an empty track, and then add an action strip to that track.
When I call the tracks_add
function, I get the error "Select an existing NLA Track or an empty action line first." Here's my code:
import bpy
# find nla editor area for proper context
area = None
for a in bpy.context.screen.areas:
print(a.type)
if a.type == 'NLA_EDITOR':
area = a
override = {'area': area}
# check for animation data
bpy.ops.nla.selected_objects_add(override)
# check for existing animation tracks
bpy.ops.nla.tracks_add(override)
In the UI it's easy to just click the empty action line. But how can I do this using the Python API so I can add the empty track?
Thanks in advance!