PR Scripting QE .getItemAt() not working properly

Contributor ,
Nov 30, 2020

Copy link to clipboard

Copied

I am using the getVideoTrackAt and getItemAt methods to apply an effect to a clip. However it is only working when using the first clip on any given track. Also, the indices required seem to not be working, unless I am missing something simple. The videoTrack I am storing is working fine, but when I try to get any other item besides the first, it gives me undefined. Here is my simple project setup and code: 

Screenshot_124.png

app.enableQE();
var clip; 
var thisTrack = qe.project.getActiveSequence().getVideoTrackAt(1);

clip = thisTrack.getItemAt(0);
// gives me undefined

clip = thisTrack.getItemAt(1);
// gives me the first clip in the track

clip = thisTrack.getItemAt(2);
// gives me undefined

 

TOPICS
Error or problem

Views

107

Likes

Translate

Translate

Report

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

2 Correct Answers

Contributor , Dec 04, 2020
Nathan Lovell_52 Contributor , Dec 04, 2020
Thanks for your help @Bruce Bullis ! The issue was that I was confusing the vanilla and qe ways of looping through items. With the normal way of looping through all the clips in a video track, it only counts the visible clips, but with the QE way, you must also take into account the 'empty clips' between any present imported clips! QE example of looping through each item (0->numItems-1)

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Employee , Nov 30, 2020
Bruce Bullis Adobe Employee , Nov 30, 2020
> var thisTrack = qe.project.getActiveSequence().getVideoTrackAt(1);   This will get you the second video track in the sequence; the first would be at getVideoTrackAt(0).   The success (or not) of the getItemAt() calls, will depend on what's in that track.      

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Employee ,
Nov 30, 2020

Copy link to clipboard

Copied

> var thisTrack = qe.project.getActiveSequence().getVideoTrackAt(1);

 

This will get you the second video track in the sequence; the first would be at getVideoTrackAt(0).

 

The success (or not) of the getItemAt() calls, will depend on what's in that track.

 

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Contributor ,
Nov 30, 2020

Copy link to clipboard

Copied

Right! In this case I mean to reference my V2 (second video track). On that track I have 2 clips (see above image), but the only non-undefined clip it returns is the very first 1, and in the wrong index.

 

getItemAt(0) should be the first clip, but it is returning undefined. getItemAt(1) is the only option working, and it returns the first clip. Furthermore getItemAt(2) returns undefined as well. Given that there are 2 clips on this track, why am I only able to access 1?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Nov 30, 2020

Copy link to clipboard

Copied

Given that there are 2 clips on this track, why am I only able to access 1?

 

¯\_(ツ)_/¯

 

Send me a .prproj, and a snippet that repros the problem, and I'll debug into it. 🙂

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Contributor ,
Dec 04, 2020

Copy link to clipboard

Copied

Thanks for your help @Bruce Bullis ! The issue was that I was confusing the vanilla and qe ways of looping through items. With the normal way of looping through all the clips in a video track, it only counts the visible clips, but with the QE way, you must also take into account the 'empty clips' between any present imported clips!

 

Screenshot_130.png

QE example of looping through each item (0->numItems-1)

Likes

Translate

Translate

Report

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