Skip to main content
Inspiring
November 17, 2015
Answered

thisProperty expression

  • November 17, 2015
  • 2 replies
  • 2141 views

‌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

Correct answer Dan Ebberts

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

2 replies

Inspiring
November 17, 2015

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

Participating Frequently
March 30, 2017

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.

Participating Frequently
March 30, 2017

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


Thanks for your quick response Dan. I actually found an answer on another one of your pages.

This is what I meant. You can just put a number in parentheses after content. I couldn't find the answer to this anywhere. I guess it was just obvious to everyone in the world except me.

theNextIndex = thisProperty.propertyGroup(2).propertyIndex + 1;

xPos = thisComp.layer(index).content(theNextIndex).transform.position[0] + 11;

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
November 17, 2015

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

Participating Frequently
August 24, 2023

Thank you so very much Dan!