-
Why isn’t this script creating four nulls?
I’m trying to create a script, using the Create paths from nulls example as a starting point. The function called when the button is clicked is below – it should create four nulls, but only creates one. I tried removing the loop and putting in four separate code blocks to manually create the nulls one after another, but that didn’t work either:
<pre class=””>function createNull(targetComp){
return targetComp.layers.addNull();
}function CurveMaker(){
var undoGroup = localize("$$$/AE/Script/createCurveMaker/curveMaker=Make Curves");
app.beginUndoGroup(undoGroup);
nl = [];
var comp = getActiveComp();
// TODO: if there isn't an active comp, make one
for (var i = 0; i <= 3; i++) {
nl[i] = createNull(comp);
nl[i].name = ("Control-0" + (i+1));
nl[i].label = 11; // orange
var np = nl[i].position;
np.setValue([100 + (i%2)*100, 100 + (Math.floor(i/2)*100)]);
var e1 = addSlider(nl[i], "CurveDepth", 1);
var e2 = addSlider(nl[i], "Roundedness", 0.5);
var e3 = addSlider(nl[i], "Influence", 1);
var e4 = addCheckbox(nl[i], "Disable", false);
}
app.endUndoGroup();
}I get one orange null with the sliders attached to it, but it’s like the loop then stops. Is there a reason why createNull() can’t be called more than once, or something like that?