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.
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
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.
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.
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
Copy link to clipboard
Copied
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();