Highlighted

Accessing a shape layer object name in an expression

Adobe Community Professional ,
Oct 02, 2020

Copy link to clipboard

Copied

I am building a series of automated bar and line graph expressions that change the position of a shape layer object. I'm pointing to a slider that has the same name as the object I am trying to move. This is the expression I'm working on:

pointPosition = effect("Ellipse 1")("Slider"); // placement as a percentage of the line
barLength = content("Baseline Rectangle").content("Rectangle Path 1").size[0];
barStart = - barLength / 2;
xPosition = barLength * pointPosition;
xOffset = pointPosition * barLength * .01;
[barStart + xOffset, value[1]]

This is where the expression lives:

Screenshot_2020-10-02 11.46.17_Fk2qoV.png

What I would like to do is use something like this which will work just fine in another layer

thisComp.layer("Shape Layer 1").content("Ellipse 9").content("Ellipse Path 1").name

to replace the effect("Ellipse 1") in the first line of my expression so that duplicating an ellipse and duplicating the Effect Ellipse 1 slider in the Effects Control Panel would give me another point automatically.

 

I have spent about an hour trying to work out how to replace "Ellipse 1" with the object name without any success. I'm hoping someone, maybe even Dan_Ebberts will have a solution for this problem. It will save a bunch of time on a half dozen upcoming projects that I'm working on.

TOPICS
Expressions, Scripting

Views

65

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

Accessing a shape layer object name in an expression

Adobe Community Professional ,
Oct 02, 2020

Copy link to clipboard

Copied

I am building a series of automated bar and line graph expressions that change the position of a shape layer object. I'm pointing to a slider that has the same name as the object I am trying to move. This is the expression I'm working on:

pointPosition = effect("Ellipse 1")("Slider"); // placement as a percentage of the line
barLength = content("Baseline Rectangle").content("Rectangle Path 1").size[0];
barStart = - barLength / 2;
xPosition = barLength * pointPosition;
xOffset = pointPosition * barLength * .01;
[barStart + xOffset, value[1]]

This is where the expression lives:

Screenshot_2020-10-02 11.46.17_Fk2qoV.png

What I would like to do is use something like this which will work just fine in another layer

thisComp.layer("Shape Layer 1").content("Ellipse 9").content("Ellipse Path 1").name

to replace the effect("Ellipse 1") in the first line of my expression so that duplicating an ellipse and duplicating the Effect Ellipse 1 slider in the Effects Control Panel would give me another point automatically.

 

I have spent about an hour trying to work out how to replace "Ellipse 1" with the object name without any success. I'm hoping someone, maybe even Dan_Ebberts will have a solution for this problem. It will save a bunch of time on a half dozen upcoming projects that I'm working on.

TOPICS
Expressions, Scripting

Views

66

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
Oct 02, 2020 0
Guide ,
Oct 02, 2020

Copy link to clipboard

Copied

Rick, I'm not 100% sure, but I think this is what you're looking for:

 

pointPosition = effect(thisProperty.propertryGroup(3).name)("Slider");

 

Dan

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...
Oct 02, 2020 0
Adobe Community Professional ,
Oct 02, 2020

Copy link to clipboard

Copied

Perfect.

 

Well almost perfect. A little typo in propertry group...

   but that was easy to fix.

 

Thanks Dan. You're the man.

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...
Oct 02, 2020 0
Guide ,
Oct 02, 2020

Copy link to clipboard

Copied

Sorry about that.. That's what happens when I don't test it before I post it.

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...
Oct 02, 2020 0