FORUMS: list search recent posts

changing the transform properties on a layer across multiple compositions

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
alistair mcclymont
changing the transform properties on a layer across multiple compositions
on Mar 4, 2017 at 11:33:19 am

I've got over a hundred compositions in a folder - each with one layer with a scaled video.

I've need to duplicate every one of those compositions and change the scale transform property of that layer in every single composition.

Its a bit time consuming - any tips or scripts that may help with this?


Return to posts index

Mike Sevigny
Re: changing the transform properties on a layer across multiple compositions
on Mar 4, 2017 at 3:32:33 pm

Here's a script that will duplicate the compositions in the folder, resize the layers to 150% and place the new comps in a new folder. Check the 'settings' at the top of the code to set your custom folder name and custom size.

// Settings
folderName = 'myFolder'; // Folder with |Original Compositions
customScale = [150, 150]; // Custom Scale

// Find target Compositions
targetComps = new Array();
for (e= 1;e<= app.project.numItems; e++) {
if (app.project.item(e) instanceof CompItem){
if (app.project.item(e).parentFolder.name = folderName) {
targetComps[targetComps.length] = app.project.item(e);
}
}
}

// Duplicate the Compositions
newFolder = app.project.items.addFolder('dupComps');
for (a=0;a<=targetComps.length-1;a++){
thisCompDup = targetComps[a].duplicate();
thisCompDup.name = targetComps[a].name + '-dup';
thisCompDup.parentFolder = newFolder;
thisCompDup.layer(1).transform.scale.setValue(customScale);
}


Hope this helps,
Mike Sevigny
http://www.torusmedialabs.com


Return to posts index

alistair mcclymont
Re: changing the transform properties on a layer across multiple compositions
on Mar 5, 2017 at 12:54:10 am

i'm running it now and it may need some work - but thanks so much for providing the script. I program elsewhere, but am new to after effects scripting - obviously going to be fun.


i'm getting some functionality from the script - but i get this error:
unable to execute script at line 19. Function targetComps[a].duplicate is undefined

the script is making a folder 'dupComps' - its also making many copies of the target folder - these seem to contain slightly random comps, many of which weren't in the target comp

i made a new project with some simple comps with a solid in each - 3 were in a folder and 3 loose in the project. The script ran, but put every comp in the new folder


Return to posts index


Mike Sevigny
Re: changing the transform properties on a layer across multiple compositions
on Mar 5, 2017 at 4:56:14 pm

You're right, for some reason it's not recognizing the Item's parentFolder. I changed a few things around so that it uses the folder you've selected intead of trying to find it by name. I commented the script to give you an idea of what's going on at each step.
Give this a try:
sourceFolder = app.project.activeItem; // Collect the currently selected Folder
customScale = [150, 150]; // Custom Scale

if (sourceFolder instanceof FolderItem) { // If the selected Item is a Folder
targetComps = new Array(); // Create blank Array to store the Compositions
for (e= 1;e<=sourceFolder.numItems; e++) { // Cycle through the Folder Items
if (sourceFolder.item(e) instanceof CompItem){ // If the Folder Item is a Composition
targetComps[targetComps.length] = sourceFolder.item(e); // Collect the Item into the Array
}
}
// Duplicate the Compositions
newFolder = app.project.items.addFolder('dupComps'); // Create a new Folder for the duplicate comps
for (a=0;a<=targetComps.length-1;a++){ // Cycle through the collected Project Items
thisCompDup = targetComps[a].duplicate(); // Duplicate this Composition
thisCompDup.name = targetComps[a].name + '-dup'; // Rename the duplicate
thisCompDup.parentFolder = newFolder; // Place the duplicate composition in the new Folder
thisCompDup.layer(1).transform.scale.setValue(customScale); // Change the scale of the first layer in the duplicate composition
}
}else{ // If the selected Item is not a Folder, throw error.
alert('You must select a folder to be processed')
}

Before running it:

After running it:


Hope this helps,
Mike Sevigny
http://www.torusmedialabs.com


Return to posts index

alistair mcclymont
Re: changing the transform properties on a layer across multiple compositions
on Mar 5, 2017 at 4:57:35 pm

great cheers - i'll give it a whirl asap


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]