Retrieve selected object in project panel + check empty tracks

Participant ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Hello guys, i have 2 questions:

 

1.

When a right click->nest is performed, a nested sequence is created and it remain selected in the project panel. How can i store it's reference via scripting in a variable, to manipolate it later? I thought there was something like selectedItem(), but i can't find anything with similar function.

 

2.

Is there a method that return if a track is empty and which?

 

Thank you!

 

 

TOPICS
How to, SDK

Views

55

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Explorer , Mar 18, 2021 Mar 18, 2021
var sequence = app.project.activeSequence; // 1. To get selection: var selection = sequence.getSelection(); for (var s = 0; s < selection.length; s++) { selection[s]; // selected clip number s } // 2. To get empty track, iterate over them and find which one is empty. numTracks = sequence.videoTracks.numTracks // numTracks works as lenght. To test audio, use audioTracks while (numTracks--) { sequence.videoTracks[numTracks].clips.numItems; // 0 if it is empty }

Likes

translate

Translate

Translate
Explorer ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

var sequence = app.project.activeSequence;

// 1. To get selection:
var selection = sequence.getSelection();
for (var s = 0; s < selection.length; s++) {
   selection[s]; // selected clip number s
}

// 2. To get empty track, iterate over them and find which one is empty.
numTracks = sequence.videoTracks.numTracks // numTracks works as lenght. To test audio, use audioTracks
while (numTracks--) {
   sequence.videoTracks[numTracks].clips.numItems; // 0 if it is empty
}

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines