Is it possible to have an expression reference another expression?
I have a slate comp that references the main comp with several expressions.
When the expressions break I have to fix every expression.
I'm wondering if I can have one master expression that references the main comp and all sub-expression take their information from that master expression.
That way I would only have to fix one expression.
Thanks!
Expression from expression?
Moderator: byronnash
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
I presume you mean text layers? In theory you could assemble all the data into a single string on a text layer, then have other layers retrieve that string. Have the main text layer set with a built in text string with default values to ensure the others don't fail even when the expression is disabled.
i.e. enter "1;1" on you main txt layer, then add an expression like:
firstData + ";" + secondData;
Then on your other text layers have expressions like:
thisComp.layer("Main Text Layer").text.sourceText.split(";")[0];
Text layers are the only properties where you could assemble multiple values in this way.
Paul
i.e. enter "1;1" on you main txt layer, then add an expression like:
firstData + ";" + secondData;
Then on your other text layers have expressions like:
thisComp.layer("Main Text Layer").text.sourceText.split(";")[0];
Text layers are the only properties where you could assemble multiple values in this way.
Paul
Thanks for the reply.
The slate comp has one text layer that gets its value from the shotcomp name, but the others are the "numbers" text effect that reports duration.
Can I link the numbers text effect to the text layer?
I can't pick-whip it.
Thanks.
The slate comp has one text layer that gets its value from the shotcomp name, but the others are the "numbers" text effect that reports duration.
Can I link the numbers text effect to the text layer?
I can't pick-whip it.
Thanks.
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
You could parseInt() the split piece of text.
parseInt(thisComp.layer("Main Text Layer").text.sourceText.split(";")[0]);
parseInt(thisComp.layer("Main Text Layer").text.sourceText.split(";")[0]);
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
parseInt() converts a string into a whole number (parseFloat() for fractional/decimals)
If you're including the name of the comp to reference in the text line you wouldn't parseInt() it, you'd do something like:
shotComp = comp(thisComp.layer("NAME").text.sourceText);
The .split() method is only necessary if you want to include multiple bits of information in the text layer expression. You'd do this using a separator (i.e. ";"), then later split the result into an array and access one of the array properties using [0], [1], etc.
With the approach you're currently trying, unless your text layer always contains the name of a valid comp, all your dependant expressions will break.
The more detail you give on what you want to do, the more accurate advice I can give you.
Paul
If you're including the name of the comp to reference in the text line you wouldn't parseInt() it, you'd do something like:
shotComp = comp(thisComp.layer("NAME").text.sourceText);
The .split() method is only necessary if you want to include multiple bits of information in the text layer expression. You'd do this using a separator (i.e. ";"), then later split the result into an array and access one of the array properties using [0], [1], etc.
With the approach you're currently trying, unless your text layer always contains the name of a valid comp, all your dependant expressions will break.
The more detail you give on what you want to do, the more accurate advice I can give you.
Paul