Hi,
I would like to know how to access the properties of a clip in a video track—specifically, its name, its IN and OUT points, and whether it is selected or not. Is it possible to achieve this with code similar to the following?
Thanks in advance! 
const activeProject = await ppro.Project.getActiveProject();
const activeSequence = await activeProject.getActiveSequence();
const videoTrackCount = await activeSequence.getVideoTrackCount();
for (let i = 0; i < videoTrackCount; i++) {
const videoTrack = await activeSequence.getVideoTrack(i);
const trackItems = await videoTrack.getTrackItems(1, false);
for (let t=0; t < trackItems.length; t++){
console.log(trackItems[t]);
//How to know if this clip item is selected?
//Its name?
//Its in and out points?
}
}
Hi!
You can access following properties by:
const activeProject = await ppro.Project.getActiveProject();
const activeSequence = await activeProject.getActiveSequence();
const videoTrackCount = await activeSequence.getVideoTrackCount();
for (let i = 0; i < videoTrackCount; i++) {
const videoTrack = await activeSequence.getVideoTrack(i);
const trackItems = await videoTrack.getTrackItems(1, false);
for (let t=0; t < trackItems.length; t++){
console.log(trackItems[t]);
//How to know if this clip item is selected?
//**We are still working on API which return list of selected *trackItems* in the active sequence.**
//**However, if you are interested in if the associated *clip* of the *trackItem* is being selected at the project panel, following code will help.**
let projectItem = await trackItems[t].getProjectItem();
const projectSelection = await ppro.ProjectUtils.getSelection(activeProject);
const projectItems = await projectSelection.getItems();
let selected = false;
for (const currItem of projectItems){
if (currItem == projectItem){
selected = true;
}
}
//Its name?
let name = await projectItem.name;
//It's in and out points?
let inPoint = await trackItems[t].getInPoint();
let outpoint = await trackItems[t].getOutPoint()
}
}
Thanks for trying out UXP!
2 Likes