-
null position to layername problem
Hi,
I wanted do add some new features to a script I wrote some weeks ago.
Every time I run the script it takes the 2d moving of 2 selected nulls and puts it into a new null that moves in 3d space…This workes fine, but I now tried to add something that counts how many times I used the script and puts this number at the end of the name of the new null.
I use the x-position of another null (placeholder) to count, but the expression for the position doesn’t get written and every time I try another way to get the position into a layers name, it’s 0, NaN or some other error.I ran on the problem with the expression not geting written when I wrote the first script, but strangely it worked fine the next day, without any changes in the script. Maybe this part will work tomorrow…
var thisComp = app.project.activeItem;
var plchldr = thisComp.layers[3];
var plchldrname = plchldr.name;
var plchldrpos = plchldr.position;
var plchldrexpr= plchldrpos.expression;
var placeholder = new String ('placeholder');
var aufrufe = 0;if (plchldrname == placeholder) {
var pos = plchldr.position[0];
var aufrufe2 = pos + 1;
var plchldrexpr = 'value + [' + aufrufe2 + ',-100];';
newTrackpoint.name = trackName + aufrufe2;}else{
var newplchldr = thisComp.layers.addNull();
newplchldr.name = 'placeholder';
newplchldr.position.setValue ([1,-100]);
newplchldr.moveAfter (thisComp.layers[3]);
newTrackpoint.name = trackName + aufrufe;
}