Hi All you Python Geniuses,
I am extremely new to Python, so I’m 100% not sure what I’m doing, but I’m having fun trying to figure it out as I go.
Basically, I was getting really sick of manually locking and unlocking all my audio tracks, I know shift click works on video tracks but I couldn’t find anything comparable on the audio side. I have a script that works as long as I have the specific sequence selected in the media panel (thanks to Fred Warren’s delete empty tracks script).
Where I am having trouble and would love some guidance is, rather than have the script be based on what is selected in the media panel, I’m trying to have it reference the current sequence in the timeline window and manipulate its tracks. I’m able to have it pop up as a custom timeline ui but nothing happens. Below is one of the many iterations I’ve failed at with.
First you need to know that it is not possible to pass a PyTrack or PyVersion as the selection. Only a PySegment, PyTransition (2023), PyTimelineFX or PyMarker. You could submit an Improvement Request to have PyTrack/PyVersion added to this list.
Change PyTrack for PySegment in scope_track at the top
Change the content of the “Timeline Does Not Work” section for:
clip = selection.parent.parent.parent
for audio_track in clip.audio_tracks:
for channel in audio_track.channels:
if len(channel.segments) == 1:
channel.locked = True
The key here is to use the multiple .parent to go up back to the PySequence level.
Thanks so much for a quick response. I’m running Flame 2023.0.1 and for some reason I couldn’t get the flame.timeline.clip technique to work, but the selection.parent etc worked like a charm. At one point I had the thinking of using .parent but I clearly was going too far or not far enough.
Thanks for your help.