Copy link to clipboard
Copied
hHi guys,
i'm having a problem with mogrt via script, but i can't find any solution. Maybe someone can help me so i will share the scenario.
I'm injecting mogrt via script, taking the text content from a formatted sheet, and the injecting works well, but once the mogrt is in premiere timeline the text box panel in the 'properties' tab is empty.
Under the Effect control everything works fine and once I change the text in the effect control on the properties panel the text suddenly appear on the other tab. The real big problem of this situation is that if a try to retrieve the text style via code i can see only the text value. After making visible the text on the other panel i have access to the complete string, showing style info.
Moreover i think there is no other workaround to access the text style...
I would like to have your opinion.
Thank you
Thank for your support.
We've confirmed with the Graphics Engine (.mogrt) team that there is no know workaround for this behavior; no changes to ExtendScript API behavior are planned or scheduled, as we continue to focus on PPro's UXP extensibility.
Copy link to clipboard
Copied
We've confirmed with the Graphics Engine (.mogrt) team that there is no know workaround for this behavior; no changes to ExtendScript API behavior are planned or scheduled, as we continue to focus on PPro's UXP extensibility.
Copy link to clipboard
Copied
If mogrt is created in After Effect - you can only access text styles via JSON.
And there is one more thing. Initially text data is JSON, but if you insert text via:
setValue(“new some text”)
then you won't be able to do anything afterwards.
That's why only JSON editing method is suitable.
First we do JSON.parse().
Change font, text, size... whatever you need,
then pack it back into a string via JSON.stringify().
and only after that we apply it to the text in mogrt.
Although officially they don't recommend to do it, because it is not supported by them, but I haven't found any other way to change styles.
Copy link to clipboard
Copied
Hi everyone, thank's so much for your support.
Let me share something i've reached after some researches and community support.
First i had two different problems:
1) after injecting text to MOGRT TEXT FIELD the EFFECT CONTROL WINDOW was filled with the text, but the PROPERTY TEXT BOX was empty. Moreover, in this case once i tryied to access the text via code (getValue()) i had just the text value (no JSON to access the style)
this problem was solved by accessing to the text value using
var B = MGT.getMGTComponent().properties.getParamForDisplayName("TESTO reference");
B.setValue(TextToInject, true);Using this way both the windows are filled.
2) Once both are filled or in case you just import the MOGRT without inject any text via setValue() you actually receive the full string with style as you said
Now, in my case i cannot use the function JSON.parse() or JSON.stringify() directly in ExtendScript so I used this workaround
var B = MGT.getMGTComponent().properties.getParamForDisplayName("TESTO reference");
var appoggio = B.getValue();
var appoggio_SPLIT = appoggio.split('":"');
appoggio = appoggio.substring(0, appoggio.length - appoggio_SPLIT[1].length);
appoggio = appoggio + TextToInject + '"}';
B.setValue(appoggio, true);In this case i only needed to change the text...
I hope this can bu usefull to anyone accourred in my situation.
Cheers
Find more inspiration, events, and resources on the new Adobe Community
Explore Now