Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
blindchild
Topic Author
Posts: 14
Joined: Sun Feb 08, 2009 2:19 pm

How to reference and effect's name?

Fri Aug 05, 2016 7:47 am

Hello!

I am looking for a way to average out face tracking data, and am creating a series of point controls that will hold the averaged data for me. This is a task I will have to do across maybe 20 shots, so I am looking for a fast way to do it. Ideally what I would like is to have a null which I can copy and paste into the different comps and for it to automatically give me my average data.

I was hoping to use the name of the effect (a point slider) to do this for me. Something like this:

e=effect.name;
(thisComp.layer("FACE_TRACK_01").effect("Face Track Points")(e)+thisComp.layer("FACE_TRACK_02").effect("Face Track Points")(e))/2

Then I could duplicate the point slider effect and rename it for whichever facial feature I need an average for. eg: "Left Eyebrow Inner".

However, I dont seem to be able to find a way to access the effects name. Is there a way?

Thanks
 
JordieC
Posts: 4
Joined: Tue Jan 17, 2012 6:30 am

Re: How to reference and effect's name?

Thu Sep 01, 2016 2:11 am

Hey there.

Interesting! Just tried some things and came to this;

To test which value the layer with expression called, I created a text that spits out the value through its adjusted Source Text.
I managed to read the name of the effect and displayed it as a text, and whenever I change the name of the effect (in this case the slider effect) it displays the name of the effect in the comp.

Just rename your slider effect into "test" and use this line;

thisLayer.effect("test").name;

so it should be something like;
e=thisComp.layer("Average_Point").effect("test").name;

Where Average_Point is the name of my Null Object, containing the renamed slider effect.

Hopefully it works out for you man!

best regards.
Jordie
 
JordieC
Posts: 4
Joined: Tue Jan 17, 2012 6:30 am

Re: How to reference and effect's name?

Thu Sep 01, 2016 2:46 am

Add the following expression In the Null's position:

e1 = thisComp.layer("Track-1").effect("Eyebrow1").name;
e2 = thisComp.layer("Track-2").effect("Eyebrow2").name;

x1 = thisComp.layer("Track-1").effect(e1)("Point")[0];
x2 = thisComp.layer("Track-2").effect(e2)("Point")[0];
x = (x1+x2)/2;

y1 = thisComp.layer("Track-1").effect(e1)("Point")[1];
y2 = thisComp.layer("Track-2").effect(e2)("Point")[1];

y = (y1+y2)/2;

[x,y]

--

The Null named "Track-1" contains the Point Control effect with the tracked data.
The point Control effect in this Null was renamed to EyeBrow1.

--

The Null named "Track-2" contains the second tracked data etc.

--

The Null with the expression compares the data from both the Point Control effect with the name Eyebrow1 and Eyebrow2.

--

Who is online

Users browsing this forum: No registered users and 2 guests