Skip to main content
Participating Frequently
June 4, 2024

paragraph set boxTextPos [0, 0] doesn't work

  • June 4, 2024
  • 3 replies
  • 459 views

Hi,

 

I'm using AE 24.4.1 , and created a project with a single composition and a single paragraph text, to do scripting tests.

 

When running the following script, the value doesn't update if "pos = [0, 0]"

 

var txt = layer.sourceText.value;
var pos = [0, 0];
txt.boxTextPos = pos;
layer.sourceText.setValue(txt);

 

If pos[0] is not null, or pos[1] is not null, the position updates.

The bug seems to occur only with [0, 0].

 

3 replies

Adobe Employee
June 4, 2024

It is old code because I can see the history - this behavior existed at least as far back as May 2021.

 

I remember the bug about negative positions - that was failing on validation and I changed that back in November 2023.

 

This is just a bug that affects setting the boxTextPos by Scripting - it has nothing to do with the other ways in which the position can be set.

 

Just to keep our terms tidy - this is NOT about setting the position of a paragraph, it is setting the position of the box (container) for the containing paragraph(s).

 

Your workaround is to make sure that if both x and y pos are zero, that you will have to change one of them ever slo slightly to be non-zero.

 

Douglas Waterfall

After Effects Engineering

Participating Frequently
June 4, 2024

Why do you think it's old code ? Are there other ways to do the same thing ?

 

The use case is to control the position of the paragraph programmatically.

 

In fact I just found out there are 2 ways to create text layers, regular text layers (just a click with the text tool), and paragraphs (click + holding) and that they behave differently on the anchor point management.

 

Controlling the anchor point of a regular text layer is accessible with the help of sourceRectAtTime().

For the Paragraph, I figured out there was not only the anchorPoint but another data which could be seen as a (2nd/sub-)anchor point (boxTextPos).

 

I was searching ways to move programmatically this anchorPoint, and found boxTextPos here https://ae-scripting.docsforadobe.dev/text/textdocument.html#textdocument-boxtextpos . 

In AE 23.6.2, I couldn't set boxTextPos with negative components ([-1, -1] = crash), but when we create a paragraph layer, the anchor is by default with negative components ([-250, -50] for example).

It was fixed since, in AE 24.4.1 negative and positive values do work, but doesn't work with [0, 0].

 

Visual example:

 

 

 

 

Adobe Employee
June 4, 2024

Indeed you are right - this looks to be very old code too.

 

I wonder why it was done that way?

 

It is just a straight comparison to zero - if you made the value .000001 for either pos x/y it ought to work.

 

I will look into it - thanks for reporting it @aescripter7 

 

Douglas Waterfall

After Effects Engineering