Copy link to clipboard
Copied
Does anybody know how the index of a sequence is determined?
It seems that by adding new sequences to a project, the indexes for existing sequences get scrambled up.
For example, I start with:
seq_a (index:0)
seq_b (index:1)
I then create seq_c and seq_d, and my indexes are now:
seq_a (index:0)
seq_b (index:2)
seq_c (index:1)
seq_d (index:3)
What is going on there...?
It is very hard to consistantly perform anything to a sequence since the only way to perform a method on a sequence is seemingly to identify it using it's index, for example: app.project.sequences[index].name
Any thoughts or advice would be greatly appreciated, thanks!
How/from where are you getting a sequence index?
Yes, as sequences are added to and removed from the project, a given sequence's position within app.project.sequences will change. Since sequences can also have the same name as other sequences, the sequence.sequenceID field is the only way to differentiate between them.
Ah I see, thankyou. So it appears you can assign the createSubsequence method actually returns a sequence Object, which can be assigned to a variable, i.e:
var newSeq = activeSequence.createSubsequence();
and subsequently perform: newSeq.name = 'myseqname'
This means I can access the new sequence object I have created without needing to determine its index. I had not assumed this, since the documentation does not say that activeSequence.createSubsequence() returns a SeqeunceObject, rather that i
Copy link to clipboard
Copied
How/from where are you getting a sequence index?
Yes, as sequences are added to and removed from the project, a given sequence's position within app.project.sequences will change. Since sequences can also have the same name as other sequences, the sequence.sequenceID field is the only way to differentiate between them.
Copy link to clipboard
Copied
Thanks Bruce.
I'm not a dev by trade so bear with me..
Could one use a sequenceID to access the sequence object methods, it appears to me that all sequence object attrbiutes and methods require an index number to identify them? Such as: app.project.sequences[index].clone()
This seems problematic since the index is fluid.
What I am particuarly trying to do is take a master sequence and automate creating a bunch of subsequences from that master sequence at various timecodes. I then want to be able to access those subsequences as they are created and rename them with a specefic labelling convention. If the index was incremental, it would be an easy for-loop with each new sequence just being an incremental index number. So I'm wondering how to best go about this..
It all seems a bit obvious so my guess is I'm missing a beat here 😉 Thanks for the advice
Copy link to clipboard
Copied
> It all seems a bit obvious
I'm not sure you're missing anything; it's always tricky to access a array while modifying that array, in an efficient way. 🙂
Here's PProPanel's example usage of sub-sequence creation; it makes new sequences (entire or in/out range) and names them.
https://github.com/Adobe-CEP/Samples/blob/ef77e70b0fb813c8db5b32159b98ed7fdd15c541/PProPanel/jsx/PPR...
Perhaps you could loop over the desired time ranges, and export new subsequences, naming them appropriately as you go. You could also add custom metadata to the clones, if you wanted; might be overkill.
How are you determining what the master sequence is?
Copy link to clipboard
Copied
Ah I see, thankyou. So it appears you can assign the createSubsequence method actually returns a sequence Object, which can be assigned to a variable, i.e:
var newSeq = activeSequence.createSubsequence();
and subsequently perform: newSeq.name = 'myseqname'
This means I can access the new sequence object I have created without needing to determine its index. I had not assumed this, since the documentation does not say that activeSequence.createSubsequence() returns a SeqeunceObject, rather that it "Returns 0 if successful" ("https://ppro-scripting.docsforadobe.dev/sequence/sequence.html).
So I had assumed that var newSeq = activeSequence.createSubsequence() would just give me a variable = 0.
Copy link to clipboard
Copied
I fixed the documentation.
When the docs don't agree with the sample code, trust the sample code. 🙂