Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Generate an array for a drop-down list using n values

  • Generate an array for a drop-down list using n values

    Posted by Doc Byrne on February 21, 2024 at 1:52 pm

    Hi everyone,

    I’ve been struggling with an expression and would be really grateful if someone could point me in the right direction. I want to create a dynamic drop-down list that’s linked to the number of layers in a specific comp. The idea is that if I add or remove layers in a comp, my drop down list should change accordingly.

    I know I need to start with: comp(“Comp 1”).numLayers and then create some sort of for loop to populate the drop-down array but actually rigging it together has me stumped.

    Does anyone have any ideas on where to start or links to useful resources?

     

    Thanks,

    Doc

    Doc Byrne replied 2 years, 4 months ago 3 Members · 4 Replies
  • 4 Replies
  • Abdul Rehman

    February 21, 2024 at 4:45 pm

    Have you tired to ask chat Gpt about the solution, to me, I ususlly ask chat gpt to write my expression for me, all I do is describe my goal to it, and ask for an expression.

  • Doc Byrne

    February 21, 2024 at 5:31 pm

    I never thought of that but if I’m honest, I prefer asking people.

  • Dan Ebberts

    February 21, 2024 at 5:38 pm

    That’s not the kind of thing you can do with an expression. An expression can only modify the value of the property it’s applied to, so if it’s not something you can keyframe you won’t be able to do it with an expression.

    You could do it with a script, but it wouldn’t be automatic–you’d have to run the script each time you wanted to update the drop-down.

  • Doc Byrne

    February 22, 2024 at 10:01 am

    Thanks Dan. That’s a shame but at least I know to stop wasting time trying to do the impossible. Even if I could manage to put together a script (which I can’t 😉) having to run it manually to update the drop-down would be hassle for the people who’ll ultimately be using the template.

    Thanks again!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy