Skip to main content
Known Participant
January 1, 2015
Answered

Is there a way to loop through a layer's property groups and JUST get the ones that are visible?

  • January 1, 2015
  • 2 replies
  • 2644 views

Hi,

I'm trying to just get the property groups that are visible to a given layer in my script. Is there such a property?

For example, when I loop through a Shape Layer's property groups, I get Masks, Layer Styles, Material Options, and Audio property groups, when none of these are appropriate. I've tried using property().elided, but it just gives me the hidden "Contents" folders within the Vector Groups and 'Masks' within 'Compositing Options'.

** on a side note, I have gotten the error "Can not 'set expression' with this property, because the property or a parent property is hidden." when trying to access X or Y Rotation on a 2D layer. It makes it seem like there is a 'hidden' Boolean somewhere in the Property Object, but I can't find it.

This topic has been closed for replies.
Correct answer UQg

Hi,

"elided" and "hidden" both have UI purpose (make the UI lighter) but are quite different:

  • "elided" is a static attribute of property groups (readonly, and After Effects never changes the value internally).

          The children of an elided group are not necessarily elided.

  • "hidden" is NOT an attribute, is dynamic, and "undocumented".

          The After Effects UI hides everything that is not needed in the layer property tree (for instance the material option group is hidden when the layer is not 3D, since it is not used anyway).

          Hidden groups and properties are still there though and can be accessed by script, one can read their values and attributes, scout their property subtree, but one cannot set anything on them nor select them (in both cases an error is generated).

          And the children of a hidden group are hidden.

Since there is no attribute corresponding to "hidden", it is uneasy to know whether a property is hidden or not. I can only see a case by case "treatment".

For instance:

is myLayer.layerStyle hidden ? <===>  !myLayer.layerStyle.canSetEnabled

is myLayer.transform.xRotation hidden ? <===>  !myLayer.transform.xRotation.canSetExpression

is myLayer.mask hidden ? <===> myLayer.mask.numProperties===0

is myShapeLayer.content hidden ? <===> false (never hidden, even if empty)

etc...

Xavier.

2 replies

Participant
February 17, 2015

I'm also having this problem.

Another approach to eliminate a lot of tests is to try to set the property's value. If an exception is thrown, then we can eliminate regular attributes. We still have to test for CUSTOM_VALUES and expressions, which will throw exceptions as well, but not for the same reason necessarily.

My approach is:

try{

prop.setValue(prop.value);

catch(err){

     //test wether the value is given by an expression

     //test wether it is a CUSTOM_VALUE

     //maybe some other case

}

By the way, blastframe‌, have you found a different approach to get this done?

Cheers.

Participating Frequently
December 28, 2015

Hello guys,

I have a similar issue:

I try to change the position of a text as this:

layer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator").property("ADBE Text Animator Properties").property("ADBE Text Position 3D").setValueAtTime(0, [1,2,3]);

I'm getting this error:

Can not "set value at time" with this property, because the property or a parent property is hidden.

Similar error if I use setValue() function.

The layer is a TextLayer.

Any ideea?

Dan Ebberts
Community Expert
Community Expert
December 28, 2015

Try it this way:

layer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator").property("ADBE Text Animator Properties").addProperty("ADBE Text Position 3D").setValueAtTime(0, [1,2,3]);

Dan

UQg
UQgCorrect answer
Legend
January 1, 2015

Hi,

"elided" and "hidden" both have UI purpose (make the UI lighter) but are quite different:

  • "elided" is a static attribute of property groups (readonly, and After Effects never changes the value internally).

          The children of an elided group are not necessarily elided.

  • "hidden" is NOT an attribute, is dynamic, and "undocumented".

          The After Effects UI hides everything that is not needed in the layer property tree (for instance the material option group is hidden when the layer is not 3D, since it is not used anyway).

          Hidden groups and properties are still there though and can be accessed by script, one can read their values and attributes, scout their property subtree, but one cannot set anything on them nor select them (in both cases an error is generated).

          And the children of a hidden group are hidden.

Since there is no attribute corresponding to "hidden", it is uneasy to know whether a property is hidden or not. I can only see a case by case "treatment".

For instance:

is myLayer.layerStyle hidden ? <===>  !myLayer.layerStyle.canSetEnabled

is myLayer.transform.xRotation hidden ? <===>  !myLayer.transform.xRotation.canSetExpression

is myLayer.mask hidden ? <===> myLayer.mask.numProperties===0

is myShapeLayer.content hidden ? <===> false (never hidden, even if empty)

etc...

Xavier.

Known Participant
January 2, 2015

Thank you. I've decided to change my approach to my script because of this (which I think was a good thing!). Happy New Year.