TransWikia.com

Best way to create external alterable configuration file to be read by After Effects and Java

Video Production Asked by kviLL on October 28, 2021

Background

I’m trying to make an AE animation to visualize some data. Since the raw data I’m using comes in json files and needs to be parsed and analyzed to find useful statistics, I’m using a java program to import all the json and export .csv files for After Effects. I’ve managed to run through this workflow once already, importing json, exporting csv, and writing AE scripts to read the data from the CSV and calculate object movements on the timeline.

However, when I went to make some changes to how the animation worked, I decided to create a config.properties file that the Java program reads to adjust some settings when creating the CSVs. My intention was that After Effects could read the same file, figure out what settings Java had been using, and parse the CSV accordingly. I figured it wasn’t going to be as easy to read the file in AE as it had been in Java, but I hadn’t anticipated not being able to import it. I’ve gotten either errors saying I need Adobe Animate CC to import a .fla file (it’s not .fla and I can’t imagine why I should need to download that, although I can if necessary) and just plain crashing.

I tried Googling and

At this point I thought that maybe the best course of action would be to write a short Java script that parses the config.properties file and rewrites it as a csv in the form "string",value on each line while removing all of the comments, but having to parse my own config file kinda defeats the point of writing my own config file for both programs… I also like the .properties format, allowing me to use # for comments and define constants in the form variable: 0 or variable: "abc". I didn’t actually ever parse it out of the .properties file because I realized that is probably a terrible solution, and instead I came here.

TL;DR

What is the best way to create a configuration file, composed of user-readable comments, variable names, and string/numerical declarations for those variables, which can be read by my Java program and After Effects, such that I will only need to make a change to one config setting, rerun Java, and then reexport my animation to have something completely new?

Since Java is obviously more flexible here, I’m mostly interested in a good non-laggy AE solution that will ideally require minimal modification to my Java setup.

Some random notes

  • I found from another Stack Exchange question that it’s possible to import a file from an after effects expression, but they named two major problems for me: the inability to reference that file relative to my project (the project directory will move and I’d prefer to not have to make many changes in that case) and it re-imports the file every frame, which would simply destroy my already painstakingly slow animation.
  • I need to be able to modify everything in the config file. While it can be assumed that once I reference a variable in the AE script that variable will always be present with the same name, its line number may shift as I add new comments and variables.
  • I tried changing the file to .txt, which allowed After Effects to read it (and Java has no problem with any random file extension), but I just get a list of the contents of line that I can reference individually and doesn’t respond to the creation of new lines in the config file. In other words, useless.

Here’s an example screenshot from my existing config.properties file. Obviously these aren’t real values. I’m not that stupid. They’re just examples of all the data types I’m using at the moment. Notably Java just reads all of these as strings and then I have to go tell it if it’s an integer or whatnot. Since this is all a personal project I’m putting 0 effort into stopping it from breaking if I replace stuff with random unexpected data types.

config.properties screenshot

One Answer

I would look at Templater Rig to see whether this does a fair amount of what you need. https://aescripts.com/templater/

You can also import JSON files directly into AE without conversion to CSV first: https://helpx.adobe.com/after-effects/using/data-driven-animations.html

Answered by tomh on October 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP