Get relative text layer coordinates in composition
Copy link to clipboard
Copied
Hi,
I'm writing an ExtendScript script, where I change text inside of nested compositions.
The nesting looks like this (the green arrows show the nesting):
So I've got composition "01_CONSULTING_A" which contains composition "EDIT STATEMENT 1" which contains composition "EDIT TEXT Statement 1" which then contains a text layer. In my script I edit that text layer to another language, which of course also changes the length of the text and thus the width/height of the text box.
In "EDIT STATEMENT 1" there's another composition called "POSITION Arrow". Here I have to change the position so that it lines up with the end of the new text. Here's the problem: I don't seem to be able to get the correct X and Y coordinates of that text layer inside of the "EDIT STATEMENT 1" composition so that I can use those coordinates to position the arrow. I already found out that I apparently have to get the relative position of the layer in the "outer" composition. But I don't even seem to be able to get the correct coordinates of the text layer itself. So could someone maybe help me to get the coordinates of the upper left corner of the text and the lower right corner so that I can use those to move the "POSITION Arrow" composition accordingly?
Thanks!
Copy link to clipboard
Copied
You have to apply temporary expressions in your script that do all the layer space transform stuff and bounding boxes, then read the post-expression values and apply them to the elements. Scripts themselves don't have such functions and the values need to be evaluated, anyway, to make sense. The otehr option would of course be to hard-set al lthis stuff inside the script without even needing a complex composition hierarchy or for that matter actual source inputs.
Mylenium

