|
|
Hmm, if MOGRTS are really limited that way, the only workaround that comes to my mind is that you use another separator symbol for the linebreaks.
So the user, for example, enters
“This is line one and#this is line two and#a third oneâ€
using the # symbol instead of a line break and then
in the expression you do
lines = txt.split(/#/);
instead of
lines = txt.split(/\r|\n|\x03/);
such that it splits the text at the # symbol instead of at actual line breaks.
> On 11 Apr 2018, at 11:34, Jarle Leirpoll <AE-List@media-motion.tv> wrote:
>
> Thanks Mathias!
> This works much better.
>
> But I think I may have stumbled into a limitation in MOGRTs. It seems they
> don't support line breaks in text fields in Premiere, so the user will have
> to split the text manually and enter in different text fields for every line
> break.
>
> If I enter the following text in Premiere:
>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
> tempor incididunt ut labore et dolore magna aliqua.
> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> aliquip ex ea commodo consequat.
>
> This is what I get back:
>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
> tempor incididunt ut labore et dolore magna aliqua.
>
> So the second line is gone.
> Bummer.
>
> I tried with both area text and point text. No luck.
>
> /jarle
> _________________________________
>
> Mathias Möhl wrote:
> You can split the text at linebreaks and then apply danÂ’s processing to each
> of the parts separately:
>
> ————
>
> txt = thisComp.layer("Source Text").text.sourceText;
> n = thisComp.layer("Controls").effect("Text width")("Slider");
>
> function breakToGivenLength(txt,n){
> var outStr = "";
> var newLine = ""
> var splt = txt.split(" ")
> for (var i = 0; i < splt.length; i++){
> if ((newLine + " " + splt[i]).length > n){
> if (outStr != "") outStr += "\r";
> outStr += newLine;
> newLine = splt[i];
> }else{
> if (newLine != "") newLine += " ";
> newLine += splt[i];
> }
> }
> if (newLine != ""){
> if (outStr != "") outStr += "\r";
> outStr += newLine;
> }
> return outStr;
> }
>
>
> lines = txt.split(/|\r|\n|\x03/);
> for(var i=0; i< lines.length; i++){
> lines[i]=breakToGivenLength(lines[i],n);
> }
> lines.join("\n");
>
>
> ————
>
> Note that this still does not deal properly at tabs, for example (it only
> breaks at simple line breaks but not at tabs).
>
> Cheers,
> Mathias
>
>
> +---End of message---+
> To unsubscribe send any message to <ae-list-off@media-motion.tv>
|
|