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

thisProperty expression

Explorer ,
Nov 16, 2015 Nov 16, 2015

‌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

TOPICS
Expressions
2.0K
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 , Nov 16, 2015 Nov 16, 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 (someti

...
Translate
Community Expert ,
Nov 16, 2015 Nov 16, 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

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
Explorer ,
Aug 24, 2023 Aug 24, 2023

Thank you so very much 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 ,
6 hours ago 6 hours ago
LATEST

thanks a lot this reply gave me some good practice now

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
Explorer ,
Nov 16, 2015 Nov 16, 2015

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

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 Beginner ,
Mar 30, 2017 Mar 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.

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 ,
Mar 30, 2017 Mar 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

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 Beginner ,
Mar 30, 2017 Mar 30, 2017

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;

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