Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

DropDown Menu Control

Explorer ,
Sep 20, 2021 Sep 20, 2021

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.

TOPICS
Scripting
609
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Sep 22, 2021 Sep 22, 2021

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")
...
Translate
Community Expert ,
Sep 22, 2021 Sep 22, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 22, 2021 Sep 22, 2021
LATEST

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);
}




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines