Copy link to clipboard
Copied
Hi I'd really like some help with this, I need to create null objects with names and position values from a .csv file, working with external data is not something I've done a great deal of
I've got a .csv with 146 entires, column 1 is x position, column 2 y position and column 3 a name
I've imported the .csv, AE can see the data, I know I can call specific fields with "footage("data.csv").dataValue([1,1])" for example, but can I write a script that will create 146 null objects with x,y and name data from each row of the csv file?
Copy link to clipboard
Copied
I think if I can get the expression to dynamically update when I duplicate the layer that will be the easiest way
So I create one null object with an expression to call the position data from the first line of the csv file:
X = thisComp.layer("data.csv")("Data")("Outline")("x")("x 1");
Y = thisComp.layer("data.csv")("Data")("Outline")("y")("y 1);
[X, Y]
and if I create a variable based on the layer index number I can use that instead of the row number
var idx = thisLayer.index;
Z = idx;
X = thisComp.layer("data.csv")("Data")("Outline")("x")(Z);
Y = thisComp.layer("data.csv")("Data")("Outline")("y")(Z);
[X, Y]
So now if I duplicate my null 146 times, the top layer calls for Row 1 of the data file, the second layer Row 2 and so on
Not perhaps the most beautiful solution but it works so I've shared it
Copy link to clipboard
Copied
Well done!
That's the most straight forward way using expression.
To create null objects from the *.csv data, you will need a script. Expressions cannot create objects, just manipulate the ones which are already there.
*Martin