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

How to use one text layer to control text for other text layers with different formats?

Explorer ,
Aug 09, 2023 Aug 09, 2023

So I have multiple sizes of a video (9x16, 16x9, 1x1, etc) which uses the same text throughout. I know there are going to be revisions on copy so I would like to be able to use one master text layer, set up in essential graphics, that will allow me to control the text for every size. I am trying to reduce having to replace copy for every size, as well as keep the styles and effects exact, by pulling from one place.

I've tried using "getStyleAt(0,0).setText()" which works, but I cannot adjust the text format for each individual size. I would like to be able to change the format (left align or center) and te amout of lines for each size (two lines of text vs three lines of text), but keep the text and styles of the master text layer.

LosoF_1-1691572848873.png

 

TOPICS
Expressions
2.5K
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

Explorer , Aug 09, 2023 Aug 09, 2023

So I misspoke and found that all I needed to do is just play around with it a bit more. I found the soultion by using paragraph text. So @Mylenium it is indeed possible which is why I'm going to mark this a the correct answer as it answers/solves the question asked. See solution below:

I created a Master comp and created a paragraph text box as my master source. I then added its source text to the essentials panel where I added the text string.

 

Several "child" layers, which have their source text

...
Translate
LEGEND ,
Aug 09, 2023 Aug 09, 2023

Not possible. One of those limitations of the process.

 

Mylenium 

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 ,
Aug 09, 2023 Aug 09, 2023

I think there are two problems here.  When you add an EG text comp to a layer, any settings you set will only apply to that EG layer.  So any changes made won't reflect across the different formats.  You could use a convoluted precomping to solve this but a safer way might be to use a CSV file with all your captions in.  That way you can update the text in one file and it will work for all comps.

The second problem I think it simpler to solve, you want to have text appear on two or three lines, so I'd make an EG with two text layers, whose visibility is controlled by an EG checbox / dropdown.  Both text layers can have their content derived from the same source text, which is just a case of linking one sourcetext property to the other using the pickwhip.

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 09, 2023 Aug 09, 2023

Yeah this is a bit much. I don't think theres a solution for this unfortunately. Maybe in the future there would be a way to solve this with auto text box, or allowing to pull a text value from a string. Thanks 

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 09, 2023 Aug 09, 2023

So I misspoke and found that all I needed to do is just play around with it a bit more. I found the soultion by using paragraph text. So @Mylenium it is indeed possible which is why I'm going to mark this a the correct answer as it answers/solves the question asked. See solution below:

I created a Master comp and created a paragraph text box as my master source. I then added its source text to the essentials panel where I added the text string.

 

Several "child" layers, which have their source text linked to the master source layer, where placed in each comp that will have a different size. These are also paragraph texts which allows resizing of the paragraph bounding box that'll force the line breaks when scaling the width. I can also change paragraph alignment (left, center, right) for each size variation without messing anything up.

Since the master source paragraph is in the essential graphics panel, I can manipulate the text and font from there and for each "child" text layer I used the expression below in the Source Text to allow manipulation from the essential graphics panel.

 

sourceTextProperty = comp("MASTER").layer("Scene-01-txt01").text.sourceText;

newStyle = sourceTextProperty.getStyleAt(0,0);

newStyle.setText(sourceTextProperty);

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 14, 2023 Aug 14, 2023
LATEST

So after implementing the above, I had to modify the expression due to the amount of text needed.

For this template, I have several sizes (1x1, 16x9, 9x21, etc.) as comps which utilizes the same text throughout. In each comp there are 10 different separate text layers, which will be placeholders. These text layers have an expression which sources its text from a master text layer in a different, master comp, and can have their text direction and size adjusted individually. (See screenshot below for the setup).

 

Child text, source text expression:

var master = thisComp.name.split("-")[1];
var tsrc=thisLayer;
var sourceTextProperty = comp(master+"_MASTER").layer(tsrc+"_MASTER").text.sourceText;

newStyle = sourceTextProperty.getStyleAt(0,0);
newStyle.setText(sourceTextProperty);

 

The 10 text layers in each comp are created as paragraph text, so that I could manipulate the amount of lines by adjusting its width, and using the size to adjust its overall size.

 

For the coding, I used a naming system with dashes ("-") so that I can reference part of the layer or comp name as a variable using the split() command. I did this for the Master Comp name (var master) so you can change which master comp you want all the text to pull from, by changing the second part of the size comps' name (02-AC-16x9). This is a template after all so this eliminates having to update the code for each text layer when the master comp needs to change...this makes it super dynamic.

 

Each text layer is named as such "s1-txt1" while its parent/master text is names "s1txt1_MASTER".

 

Here's a link to a video which has detailed info and examples using the split command.

 
THE MASTER COMP

The Master Comp holds 10 master text layers which feed the 10 children text layers in the other comps, as well as an FX (adjustment guide) layer which also controls the effects used for all of the text. These master text layers have their source text added to the Essentials Graphics Panel, to help speed up editing each text.

Here is a screenshot of the setup. I know this is a lot but also hope it's useful.

LosoF_1-1692034435844.png

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