Copy link to clipboard
Copied
Is it possible to detect which items are selected in the project panel?
Looking the equivalent of TimelineClip.isSelected() command but for items in the project panel.
Panels can currently get notified whenever the project selection changes, but (as you've found) there is no current way to get or set the selection. I can make no specific commitments, but this is a highly requested feature near the top of our API backlog.
Copy link to clipboard
Copied
Nope, no way to do that as yet.
Copy link to clipboard
Copied
Looking for this as well.
Using
var projectItem = app.project.rootItem.children[0];
for testing, but I want to retrieve the currently selected projectItem.
var projectItem = app.project.rootItem.children.isSelected(); //or similar
Does not work, but would be nice if it did.
Would be nice with both a single item return, and a Collection, if several are selected, we should write our own exceptions.
Bruce Bullis​
Copy link to clipboard
Copied
Panels can currently get notified whenever the project selection changes, but (as you've found) there is no current way to get or set the selection. I can make no specific commitments, but this is a highly requested feature near the top of our API backlog.
Copy link to clipboard
Copied
Thank you for your answer Bruce.
I think you can set the selection:
app.project.rootItem.children[0].select();
I think my current script is coming together, it searches through the timeline for shots with similar names. Just missing this bit to make it useable. Had an idea of stepping backwards through the most recently added projectItems, but its not very elegant.
Copy link to clipboard
Copied
You're correct; I should have said "While you can select and deselect individual items, you can't get/set the current project item selection, at one go."
Copy link to clipboard
Copied
Ok, I came up with a slightly more demanding solution, but it might work for this specific use-case.
Always selecting the lastly added item to root in project:
var projectLen = app.project.rootItem.children.numItems - 1;
var projectItem = app.project.rootItem.children[projectLen];
Which demands "constant cleaning", where the user puts away clips in bins after they are "placed" in the timeline, but it might be usable.