Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Parenting by name

New Here ,
Feb 01, 2024 Feb 01, 2024

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?

TOPICS
Expressions , Resources , Scripting
100
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 01, 2024 Feb 01, 2024
LATEST

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();

 

 

screenshot.png

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines