Highlighted

Shape layer Shape Index in Expressions

Contributor ,
Jul 18, 2017

Copy link to clipboard

Copied

Is there a way to access the index of a shape in a shape layer? Just like how I can use layer index to talk to specific layers in a comp, I want to talk to specific shapes in a shape layer. Like Rectangle 1. Rectangle Path [3] or something like that?

Most Valuable Participant
Correct answer by Mylenium | Most Valuable Participant

There is no absolute index to address. You address this stuff using the .content() method referencing the groups and property streams. The real crux of course is that you may end up writing endless strings of content(Top Group).content(Sub Group).content(Path) and so on just to gain access to a simple value, depending on how deeply you nested your stuff. The actual groups can of course be referenced using their indices just as well, but this gets quite confusing and messy since in fact most of them will simply only have 1 as their number and clearly content(1).content(1).content(1) isn't particulalrly telling. Therefore using the names is much more advisable.

Mylenium

Views

2.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Shape layer Shape Index in Expressions

Contributor ,
Jul 18, 2017

Copy link to clipboard

Copied

Is there a way to access the index of a shape in a shape layer? Just like how I can use layer index to talk to specific layers in a comp, I want to talk to specific shapes in a shape layer. Like Rectangle 1. Rectangle Path [3] or something like that?

Most Valuable Participant
Correct answer by Mylenium | Most Valuable Participant

There is no absolute index to address. You address this stuff using the .content() method referencing the groups and property streams. The real crux of course is that you may end up writing endless strings of content(Top Group).content(Sub Group).content(Path) and so on just to gain access to a simple value, depending on how deeply you nested your stuff. The actual groups can of course be referenced using their indices just as well, but this gets quite confusing and messy since in fact most of them will simply only have 1 as their number and clearly content(1).content(1).content(1) isn't particulalrly telling. Therefore using the names is much more advisable.

Mylenium

Views

2.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 18, 2017 0
Most Valuable Participant ,
Jul 19, 2017

Copy link to clipboard

Copied

There is no absolute index to address. You address this stuff using the .content() method referencing the groups and property streams. The real crux of course is that you may end up writing endless strings of content(Top Group).content(Sub Group).content(Path) and so on just to gain access to a simple value, depending on how deeply you nested your stuff. The actual groups can of course be referenced using their indices just as well, but this gets quite confusing and messy since in fact most of them will simply only have 1 as their number and clearly content(1).content(1).content(1) isn't particulalrly telling. Therefore using the names is much more advisable.

Mylenium

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 19, 2017 1
Contributor ,
Jul 19, 2017

Copy link to clipboard

Copied

I found a few resources that dig into it a bit. using propertyIndex of the propertyGroup(), but they only explain so much. I am still trying to figure out you to use it for linking individual shapes but it seems so complicated.

Tapering A Stroke with Expressions Part 1 on Vimeo
Property Group and Index - AE ENHANCERS
Property Group Index Expression + Free Preset - YouTube

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 19, 2017 0
New Here ,
Apr 07, 2020

Copy link to clipboard

Copied

Yep, this is the right approach. I used this when trying to change transform properties of a specific group, matching the index of the group to the index of the layer (I would then duplicate the same layer multiple times in the same comp)

 

You can find the name of the group like this:

 

var groupIndex = thisProperty.propertyGroup(2).propertyIndex;
var groupName = thisLayer("Contents")(groupIndex).name;

 

Combining the group index and name, you should be able to set up the rig I hope. Lemme know, thanks!

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 07, 2020 0
New Here ,
Apr 07, 2020

Copy link to clipboard

Copied

You can use the propertyIndex and  group name property, something like this:

var groupIndex = thisProperty.propertyGroup(2).propertyIndex;

var groupName = thisLayer("Contents")(groupIndex).name;

 

You can change the 2 above to whatever heirarchy the group is in. 

Hopefully all your shape layers are in groups with the same heirarchical level

 

Combining the group index and name, you should be able to set up the rig I hope. Lemme know, thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 07, 2020 0