Copy link to clipboard
Copied
Hi everyone
I am just wondering if there is a way to automatically parenting compositions to nulls just by the same name.
exemple:
Comp name: TEST01
Null name: TEST01
Is there any expression for this? or is this even possible?
Copy link to clipboard
Copied
Not using an expression but a script:
var proj = app.project;
var thisComp = proj.activeItem;
app.beginUndoGroup("Undo");
for (var i = 1; i <= thisComp.numLayers; i++) {
if (thisComp.layer(i).source instanceof CompItem) {
for (var j = 1; j < thisComp.numLayers; j++) {
if (thisComp.layer(j).nullLayer && thisComp.layer(j).name == thisComp.layer(i).name) {
thisComp.layer(i).parent = thisComp.layer(j)
}
}
}
}
app.endUndoGroup();