Copy link to clipboard
Copied
Multi question that im wrestling with.
I used to use the Layer control for scripots, i want to switch to dropdown menu.
I have a comp with 20 or so layers all named.
1. I want to populate the men u control with the layer names from a specific comp. Struggling?
2. Alot of my scripts use the layer control index to drive it. Is there a Drop Down Menu Control index aspect as well?
Thank you.
Thank you. I was able to figure it out.
Just a few for loops making arrays then populating the array in the menu control. Similar to what you posted.
function makeMenuController(tComp, tLoc) {
// makes the menu controller
var myProj = app.project;
var myComp = myProj.activeItem;
var myLayer = myComp.selectedLayers[0];
var itemCount = myProj.numItems;
var mNames = new Array();
var dropDownEffect = myLayer
.property("ADBE Effect Parade")
.addProperty("ADBE Dropdown Control")
...
Copy link to clipboard
Copied
You're really better off sticking with layer controls as they're always updated with all your layers. I don't think you can edit Dropdown Menu Control optins with expressions, but you can with scripting:
const prop = app.project.activeItem.selectedProperties[0];
prop.menu.setPropertyParameters(["Sunday", "Monday", "Tuesday"]);
More details here: https://helpx.adobe.com/after-effects/using/create_dropdowns_using_expressions.html
Copy link to clipboard
Copied
Thank you. I was able to figure it out.
Just a few for loops making arrays then populating the array in the menu control. Similar to what you posted.
function makeMenuController(tComp, tLoc) {
// makes the menu controller
var myProj = app.project;
var myComp = myProj.activeItem;
var myLayer = myComp.selectedLayers[0];
var itemCount = myProj.numItems;
var mNames = new Array();
var dropDownEffect = myLayer
.property("ADBE Effect Parade")
.addProperty("ADBE Dropdown Control");
for (i = 1; i <= itemCount; i++) {
curItem = myProj.item(i);
if (curItem instanceof CompItem && curItem.name == tComp) {
layerCount = curItem.numLayers;
for (var l = 1; l <= layerCount; l++) {
curLayer = curItem.layer(l);
mNames[mNames.length] = curLayer.name;
}
}
}
dropDownEffect.property(1).setPropertyParameters(mNames);
}