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

Parenting by name

New Here ,
Feb 01, 2024 Feb 01, 2024

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?

TOPICS
Expressions , Resources , Scripting

Views

61

Translate

Translate

Report

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
Enthusiast ,
Feb 01, 2024 Feb 01, 2024

Copy link to clipboard

Copied

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

 

 

Votes

Translate

Translate

Report

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