Skip to main content
Inspiring
Nov 17, 2015 12:46 AM UTC
Answered

thisProperty expression

‌I understand I can use thisProperty to get the index of a property, but is there a way to get the index of the shape group my opacity is inside? Sort of like an thisProperty.parent.index or something

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Nov 17, 2015 1:01 AM UTC

It's going to be something like:

thisProperty.propertyGroup(4)

.propertyGroup lets you travel up the property hierarchy, with the number specified being the number of levels you're moving up. One thing that can help is to pickwhip to your property from a text layer's source text expression to create an expression like this:

p = thisComp.layer("Shape Layer 1").content("Group 1").content("Rectangle 1").transform.opacity;

p.propertyGroup(4).name

That way you can see what the different levels are (sometimes they're not all visible)  to make sure you've got the right one.

Dan

7 replies

Inspiring
Nov 17, 2015 1:31 AM UTC

Thank you so much!  I thought I'd have to wait more than 20 minutes for that answer!

‌

Translate
Participating Frequently
Mar 30, 2017 10:07 PM UTC

Dan, Is there a way to drill one layer down to target a property inside another group? 

The propertyGroup() function goes up one level but I cannot find any way to go down one level in the hierarchy.

Translate
Dan Ebberts
Community Expert
Community Expert
Mar 30, 2017 10:58 PM UTC

Maybe you could supply an example of what you mean. In general, you could go up using propertyGroup() until you get to a common ancestor, then go down the other branch from there by name.

Dan

Translate
Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Nov 17, 2015 1:01 AM UTC

It's going to be something like:

thisProperty.propertyGroup(4)

.propertyGroup lets you travel up the property hierarchy, with the number specified being the number of levels you're moving up. One thing that can help is to pickwhip to your property from a text layer's source text expression to create an expression like this:

p = thisComp.layer("Shape Layer 1").content("Group 1").content("Rectangle 1").transform.opacity;

p.propertyGroup(4).name

That way you can see what the different levels are (sometimes they're not all visible)  to make sure you've got the right one.

Dan

Translate
Participating Frequently
Aug 24, 2023 8:14 PM UTC

Thank you so very much Dan!

Translate