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

Given an after effect file; count the number of composition, layers, items.

New Here ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

Is there anywhere a script (free or commercial) that will let me count the number of compositions, layers, shapes etc in an after effect file?

Prefereably it will generate a report or a spreadsheet file.. I have been searching, and I don't believe I can do that in after effects without a script or a plugin.

TOPICS
How to , Performance , Scripting , User interface or workspaces

Views

701

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
LEGEND ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

You can start by using the Collect Files function to generate a report and then perhaps you can find a bunch of scripts on AEScripts.com. There's definitely stuff similar to Collect Files, but counting shape groups and other finer granularity levels may be something you have to add if you realyl care about the statistics. That's stuff nobody usually even considers relevant, given that they are parametrically generated internal entities.

 

Mylenium

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
New Here ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

Thanks a lot, I didn't know about that functionality in After Effects .. I will give it a shot and see what happens.

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
Community Expert ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

File > Dependencies > Collect Files > Generate Report Only will write a text document that lists the Compositions and counts external source footage.  It does not; however, not count Layer nor Layer Source types that After Effects generates from within the project file.

 

For something customized, a custom script should be able to do it.  I hired a someone to write a custom script that gets Comp names and rendered filenames in one click.  The time it saves me to do a Collect Files - Generate Report Only and always set the Render Queue to write a log file was well worth it. 

 

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
Contributor ,
Oct 29, 2021 Oct 29, 2021

Copy link to clipboard

Copied

Feels like an easy task to write.
Here's something to check the number of comps and layers. Let me know if you need anymore help! 🙂

var proj = app.project;
var itemTotal = proj.numItems;

function getComp(){
    var compAry = [];

    for(var i = 1; i <= itemTotal; i++){
        var curItem = proj.item(i);
        if(curItem.typeName == "Composition"){
            compAry.push(curItem);
        }
    }
    
    if(compAry.length > 0){
        return compAry;
    }else{
        return 0;
    }
}

alert(getComp().length);//Get number of Comps

function getLayNum(){
    var layNum = 0;
    for(var i = 0; i < getComp().length; i++){
        var curComp = getComp()[i];
        layNum += curComp.numLayers;
    }

    return layNum;
}

alert(getLayNum());//Get all Layers


 

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
Community Beginner ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

LATEST

in case its usefull to anyone, i created this scriptUIpanel which does exactly that:

// Create a ScriptUI panel
var panel = new Window("palette", "After Effects Script", undefined, {resizable: true});
panel.orientation = "column";

// Create a group for the table-like interface
var group = panel.add("group");
group.orientation = "column";
group.alignChildren = "left";

// Function to get the number of compositions
function getComp() {
var comps = app.project.items;
var compCount = 0;
for (var i = 1; i <= comps.length; i++) {
if (comps[i] instanceof CompItem) {
compCount++;
}
}
return compCount;
}

// Function to get the total number of layers
function getLayNum() {
var comps = app.project.items;
var layerCount = 0;
for (var i = 1; i <= comps.length; i++) {
if (comps[i] instanceof CompItem) {
layerCount += comps[i].numLayers;
}
}
return layerCount;
}

// Function to update the panel content
function updatePanelContent() {
compResult.text = getComp().toString();
layerResult.text = getLayNum().toString();
panel.layout.layout(true);
panel.layout.resize();
}

// Add items (categories and results) to the group
group.add("statictext", undefined, "Compositions:");
var compResult = group.add("statictext", undefined, "");

group.add("statictext", undefined, "Number of Layers:");
var layerResult = group.add("statictext", undefined, "");

// Create a styled button to manually refresh
var refreshButton = group.add("button", undefined, "Refresh");
refreshButton.size = [100, 30]; // Set the button size
refreshButton.graphics.font = ScriptUI.newFont("Tahoma", "Bold", 14); // Set the font and size
refreshButton.graphics.foregroundColor = refreshButton.graphics.newPen(refreshButton.graphics.PenType.SOLID_COLOR, [0.2, 0.5, 0.9], 1); // Set button color
refreshButton.onClick = updatePanelContent;

// Initial panel content update
updatePanelContent();

// Show the panel
panel.onResizing = panel.onResize = function() {
this.layout.resize();
}
panel.show();

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