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

Expression for determining number of effects on a layer?

New Here ,
Dec 18, 2014 Dec 18, 2014

Hi,

I'm trying to write an expression that takes into account the number of effects a targeted layer has.  In a perfect world, it would be nice to get a count of only certain effects (ex: how many Slider Controls are applied)... but I'd rather start basic and work my way up to that (if it can be done at all).


So... has anyone done anything like this before / can this be done?

~pemling

Oh, and I'm using (as of today, at least) the most current version of AE: 13.2.0.49

TOPICS
Expressions
905
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

Community Expert , Dec 18, 2014 Dec 18, 2014

I think this will give you the number of effects:

numEffects = thisComp.layer("Layer 1")("Effects").numProperties;

Getting the number of Slider Controls could be tricky, if they have been renamed an no longer have "Slider Control" in the name.

Dan

Translate
Community Expert ,
Dec 18, 2014 Dec 18, 2014

I think this will give you the number of effects:

numEffects = thisComp.layer("Layer 1")("Effects").numProperties;

Getting the number of Slider Controls could be tricky, if they have been renamed an no longer have "Slider Control" in the name.

Dan

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
New Here ,
Dec 19, 2014 Dec 19, 2014

Thanks Dan, looks like that worked!  I'm able to get a count of the number of effects currently applied to a layer!

If you left "Slider Control" somewhere in the name of the effect ("Slider Control - 1" or "__Slider Control - 1" for example), is it possible to get a count of just those effects?  Just trying to figure out what can/can't be done...

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
Community Expert ,
Dec 19, 2014 Dec 19, 2014

Something like this should work:

numEffects = thisComp.layer("Layer 1")("Effects").numProperties;

numSliders = 0;

for (i = 1; i <= numEffects; i++){

  if (thisComp.layer("Layer 1")("Effects")(i).name.toLowerCase().indexOf("slider control") > -1){

    numSliders++;

  }

}

numSliders;

Dan

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
New Here ,
Dec 19, 2014 Dec 19, 2014
LATEST

Awesome! That's exactly what I needed! Thank you so much!

On Fri, Dec 19, 2014 at 11:53 AM, Dan Ebberts <forums_noreply@adobe.com>

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