Hi all! I’m looking for a way to get the clip(s) that are currently selected.
I tried using sequence.getSelected() with no luck.
Here’s my function so far:
async function getSelectedClip() {
try {
const project = await ppro.Project.getActiveProject();
if (!project) {
console.error("There is no active project found");
return;
}
// console.log(`Active project: ${project.name}`);
const sequence = await project.getActiveSequence();
if (!sequence) {
console.error("There is no active sequence found");
return;
} else {
// console.log(sequence);
}
trackCount = await sequence.getVideoTrackCount();
console.log(`Track Count: ${trackCount}`);
for (let i = 0; i < trackCount; i++) {
const track = await sequence.getVideoTrack(i);
const clips = await track.getTrackItems(0, true);
for (const clip of clips) {
if (clip === null || clip.length === 0) {
continue;
}
try {
const selected = await clip.getIsSelected();
if (selected) {
return clip.name || 'Unnamed Clip';
}
} catch (error) {
console.error('Error getting clip selection:', error);
}
}
}
return 'No clip selected';
} catch (error) {
console.error('Error getting selected clip:', error);
return `Error: ${error.message}`;
}
}
Here’s my current sequence:
When I select either clip, I’d like that to be returned by the function. I’m just seeing ‘No clip selected’ in my panel. Maybe I’m completely misunderstanding how all this works?
Running PPRO v25.6.0 Beta(Build17)
EDIT:
I actually managed to stumble my way into this one. I needed to have gotten my clips like this
const clips = await track.getTrackItems(1, false);
