Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions storing property info into a variable

  • storing property info into a variable

    Posted by Mike Overbeck on October 29, 2013 at 9:59 pm

    I am working on an expression that allows many animated properties of a layer to be driven by the same properties of a master layer. I’d be applying this expression to many layers with many animated properties. But I am trying to store this in one universal expression to avoid excessive pickwhipping.
    For example, when the expression is applied to the property:
    layerStyle.outerGlow.opacity
    the expression should automatically reference the same property of the master layer.
    I think I need to store the property’s full name into a variable, but using ‘thisProperty.name’ would only give me “opacity” in this example.
    Any ideas? Is there some basic function for this that I just haven’t found?

    Mike Overbeck replied 12 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Mike Overbeck

    October 30, 2013 at 4:07 am

    I was putting together some code that would hamfist these properties and property groups into arrays with the .name function until I realized the resulting formatting is not useable. All .name results capitalize the first letter and multi-word props are separated with spaces. I don’t know the purpose of the .name function.

  • Dan Ebberts

    October 30, 2013 at 4:34 pm

    I think you can use the result of .name. These both work:

    prop = thisComp.layer(“Layer 1”).layerStyle.innerGlow.gradientSmoothness;

    prop = thisComp.layer(“Layer 1”)(“Layer Styles”)(“Inner Glow”)(“Gradient Smoothness”);

    I assume you’ve figured out that you can use prop.propertyGroup(n).name to move up the chain to get the names of the parent properties. I guess you would keep going until the name you get back is the same as the layer’s name, although there may be a more reliable way to know you’re finished.

    Dan

  • Mike Overbeck

    November 5, 2013 at 1:41 am

    Thanks for the reply Dan! Ah, using non-compact naming might do it!
    Here is some script that I was working on to ride up the group chain and add it to the array.

    function groupCheck(x){
    try {
    return thisProperty.propertyGroup(x).name
    }
    catch(err){
    return false
    }
    };
    fullgroup = [];
    for (var i = 4; i > 0; i--){
    if (groupCheck(i) != false && groupCheck(i) != thisLayer.name){
    fullgroup.push(groupCheck(i))
    }
    }

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