2

I am trying to develop an API using PHP, Which will receive Text from user as Input. I need to change text inside the aepx file. On my research I found <string> tag and <ldata> contains text value and corresponding its hexadecimal value respectively.

I am able to parse and replace text of <string> tags in aepx. I am also able to change the hexadecimal values of bdata attribute of <ldata>.

But after all the changes I have made, it is not rendering(tried to run using aerender command). Also After Effect Application(latest -cc 2018) is crashing while opening changed aepx file.

Example:

Original

<ldta bdata="0000000c00020000000000010000000000005da80000000000005da8000afc8000005da80000008700 0000000000000000000000000000000000000100010000506c616365686f6c6465722074657874000000000000 000000000000000000000000000200000000000000000000000100000000000000000000000000000000000000 0300000000000000000000000000000000000000000000000000000000"/>

<string>Placeholder text</string>

After Change

<ldta bdata="0000000c00020000000000010000000000005da80000000000005da8000afc8000005da80000008700 000000000000000000000000000000000000010001000048656C6C6F20576F726C642100000000000000000000 000000000000000000020000000000000000000000010000000000000000000000000000000000000003000000 00000000000000000000000000000000000000000000000000"/>

<string>Hello World!</string>
Ugnius Malūkas
  • 2,649
  • 7
  • 29
  • 42
  • I'm not sure why the .aepx wouldn't render, but you can build a PHP API wrapper around something like Templater Bot's command line interface which allows you to interface with AE on the command line. http://dataclay.com/templater – ariestav May 09 '18 at 13:29
  • Any progress? Did the Answer solve your issue? – VC.One May 12 '18 at 02:02
  • @VC.One Thanks for your help, Aepx started rendering, but my issue isn't solved. The text is remains as unchanged after rendering. – Kailas V.Nair May 13 '18 at 16:37
  • Before rendering does it looked changed when opened in After Effects editor? I actually tested the answer from modifying the AEP file itself, I never need to use AEPX before but know about it. I'll see what happens with this AEPX editing when I get chance soon. – VC.One May 13 '18 at 18:10
  • It seems not changed .The old text is displayed in editor too. – Kailas V.Nair May 14 '18 at 09:53

2 Answers2

4

You can do this using After Effects Expressions. Following are the steps which worked for me:

  1. Open the project in AfterEffects
  2. Go to Text layer you wish to modify
  3. Click arrow icon which shows a sub section with a stopwatch icon and the text "Source Text"
  4. ALT + click the stopwatch icon, you will see another section underneath it with text "Expression Source Text"
  5. Give its value as "thisLayer.name"
  6. Click File > Save as > Save as xml
  7. This will create you a aepx file.
  8. Open aepx file in any text editor and search for the text you wish to modify. Confirm that it looks like in the attached sample aepx image. The following is the expression line "thisLayer.name" that we created through AfterEffects in above steps.
  9. Now change the text "This is the text to be changed" to whatever you wish,
  10. Render and check. If all ok then it must be changed.

Attached images:

  1. After Effects steps to setup expression
  2. Sample aepx glimpse.

enter image description here

enter image description here

Manojkumar B
  • 206
  • 1
  • 7
0

Consider: Placeholder text has 16 characters (since also counting the space char).

Make sure your new input text is same length as Placeholder text length in total characters (you can use spaces to increase length, where needed for shorter text).

The easiest fix is to:

  • Make Placeholder text have max expected length, (example: 30 chars), so in AE you create a textfield and press space 30 times (or make 10 spaces then copy these 10 blank chars and re-paste them another 2 times).

  • Your PHP API should check the input text length and if below 30 chars, fill remainder with space " " maybe using a For loop. If input is above the 30 limit, then trim down to first 30 chars and ignore the rest.

  • The final string should be same length as the text-field you made in A.E. Your API can now safely place the final text into your AEPX file.

VC.One
  • 14,790
  • 4
  • 25
  • 57