-
Custom script -> Adding null then setting parent
Hi everyone,
I’m really a hobbyist programmer so bare with me if you can. I’m making a script that basically
adds a null then selects the active layer as the parent. I’m nearly there but it’s just setting the parent . Here is the code:
var comp = app.project.activeItem, props, n, p, idx;
if (comp instanceof CompItem){
props = comp.selectedProperties;
var layNum = comp.selectedLayers[0].index; // number of designated chosesn layer
var selLay = comp.layer(layNum); // actual layer object with the proper index.
var inLay = comp.layer(layNum).inPoint;
var outLay = comp.layer(layNum).outPoint;
var inOutlay = Math.abs(inLay - outLay);
var newNull = comp.layers.addNull([inOutlay]).moveBefore(selLay);
comp.layer(layNum).setParentWithJump(layNum -1);
};