M4L: How to use the Object ID of a Clip to find clip_slot ID?
I'm aware that there's a LiveAPI-Interactive tool that lets you look this up, but is there a way to put this into a M4L patch?
The goal is to:
1) call a clip by its *object ID*
2) use that to identify the clip_slot it resides in
3) use the live.observer to check whether the clip in that slot is triggered (and if so, perform other functions)
I'm constantly adding, deleting and moving scenes, so using clip_slots alone isn't helpful.
For any object where you have it's object ID, you can use "get canonical_parent" and that will return the id of it's parent. For a Clip, that is the Clip Slot which contains it.
I'm constantly adding, deleting and moving scenes, so using clip_slots alone isn't helpful.
For the record if you delete / move / add scenes such that the path to a clip_slot changes, the id of the clip slot itself stays the same. It's only the index in the path of the clip_slot that changes.
Ah haaaa!
Such a simple fix. Thank you Tyler!
Also, I've just found that getpath (instead of get canonical_parent) is useful here too.
FWIW with the getpath solution you need to be a little careful if you’re trying to slice off the end of the path in order to get the path of the parent, because the “child” item at the end may be two elements or one (e.g. “live_set tracks 5” vs. “live_set master_track”).