This script can crop nested compositions to fit the image contents. Useful in cases like Photoshop imports where precomps are created as document size. It makes precomp layers easier to work with as their bounding boxes fit the images, and can speed up rendering by reducing the areas being processed.
Written on request for screen graphics designer Mark Coleran, whose work can be seen on the computer screens in movies such as The Bourne Identity and Tomb Raider. Mark designs complex user interfaces in Photoshop made up of many layers nested into groups, before importing them into After Effects to animate.
Watch the tutorial video and download pt_CropPrecomps from aescripts.com
pt_CropPrecomps (formerly Crop Layer Sets)
Moderator: Paul Tuersley
Thanks for this very helpful script.
It works perfectly fine in AE7 (Windows) while I have experienced problems in CS3.
I think it might relate to CS3 being able to import Photoshop-files with layer sets within another layer set. The files for witch I want the PreComps cropped are like this.
Any help appreciated.
It works perfectly fine in AE7 (Windows) while I have experienced problems in CS3.
I think it might relate to CS3 being able to import Photoshop-files with layer sets within another layer set. The files for witch I want the PreComps cropped are like this.
Any help appreciated.
Apparently, the script works great in CS3 as well, apart from the problem mentioned above (ie Photoshop documents with Groups inside another Group, creating a chain of nested compositions in After Effects).
However, I have found a workaround.
The nesting and layers of the compositions are like this:
Main_Comp (Layer 1, Pre_Comp1) -> Pre_Comp1 (Layer 2, Pre_Comp2) -> Layer 3
Pre_Comp2 should crop to the size of Layer 3.
Pre_Comp1 should crop to the size of Layer 2 and Pre_Comp2 combined.
If I run the script with Main_Comp active nothing happens.
So:
1. First make Pre_Comp1 the active composition and run the script -> Pre_Comp2 crops correctly.
2. Then make Main_Comp the active composition and run the script -> Pre_Comp1 crops correctly.
Unfortunately, I do not have the knowledge yet to alter the script to check for this (if possible).
Does anyone have the time to do an update?
Thanks
However, I have found a workaround.
The nesting and layers of the compositions are like this:
Main_Comp (Layer 1, Pre_Comp1) -> Pre_Comp1 (Layer 2, Pre_Comp2) -> Layer 3
Pre_Comp2 should crop to the size of Layer 3.
Pre_Comp1 should crop to the size of Layer 2 and Pre_Comp2 combined.
If I run the script with Main_Comp active nothing happens.
So:
1. First make Pre_Comp1 the active composition and run the script -> Pre_Comp2 crops correctly.
2. Then make Main_Comp the active composition and run the script -> Pre_Comp1 crops correctly.
Unfortunately, I do not have the knowledge yet to alter the script to check for this (if possible).
Does anyone have the time to do an update?
Thanks
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
I'll look into it.
Paul
Paul
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
It turned out to be an easy fix. Give this a try and let me know if it works.
Download pt_CropLayerSets_v1.1.zip (link removed)
I've also made the script ignore adjustment layers when calculating the crop. Any thoughts on that?
Paul
Download pt_CropLayerSets_v1.1.zip (link removed)
I've also made the script ignore adjustment layers when calculating the crop. Any thoughts on that?
Paul
I've been getting a lot of these lately:
"Unable to execute script at line 75. After Effects error: Unable to set "width". value -2616 out of range 1 to 30000."
Is it possible to make the script also ignore layers that are outside of the canvas?
"Unable to execute script at line 75. After Effects error: Unable to set "width". value -2616 out of range 1 to 30000."
Is it possible to make the script also ignore layers that are outside of the canvas?
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
This script won't crop the currently active comp, just the precomps inside it. If you place your comp in another comp and run the script from there, it will crop it, but it assumes all layers are unchanged (100% scale and 0 degree rotation) as they would be in a newly imported PSD.ymmij wrote:Is there a similar script around which will take any comp and crop it to the boundary of the visible layers?
Thanks,
Russ
There is a "sourceRectAtTime()" scripting method (page 48 of AE CS3 scripting guide.pdf) but I think it may only work for text and shape layers. And there have been a few threads about trying to calculating the bounds of text layers:
http://www.aenhancers.com/viewtopic.php?f=8&t=150
http://www.aenhancers.com/viewtopic.php?f=6&t=931
Those errors were caused by having layers that were outside the canvas. I've changed it to ignore those layers. Let me know if it works ok.Kasio wrote:I've been getting a lot of these lately:
"Unable to execute script at line 75. After Effects error: Unable to set "width". value -2616 out of range 1 to 30000."
Is it possible to make the script also ignore layers that are outside of the canvas?
Download pt_CropLayerSets_v1.2.zip (link removed)
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
If you can send me the file you're having problems with (or a cut down zipped version if it's too big) I'll take a look. I'm away travelling at the moment though, so I won't be able to look into this until I get back home on 22nd July.
Hey Paul .. Getting it again. Using CS5 now.
I've attached the project file.
I'm trying to run Layer Crop on each of the precomps (Eyes & Mouth) in the main comp. And I'm getting that 'line 110' error.
I've attached the project file.
I'm trying to run Layer Crop on each of the precomps (Eyes & Mouth) in the main comp. And I'm getting that 'line 110' error.
- Attachments
-
- Lip Sync Rig.zip
- (146.07 KiB) Downloaded 2674 times
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Yes sorry, I haven't released the update yet... but I did send you a work in progress some time back. I'll mail you another copy and get the update out soon.
I think this only happens when using it on Illustrator files. Can I ask what you're workflow is? Maybe you're the only person running into this.
I think this only happens when using it on Illustrator files. Can I ask what you're workflow is? Maybe you're the only person running into this.
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
I've posted an update for this script, now called pt_CropPrecomps.
New in version 2.0:
- Dockable UI and built-in help
- Option to retain border pixels
- Various bug fixes
- New video tutorial
Watch the tutorial video and download pt_CropPrecomps from aescripts.com
New in version 2.0:
- Dockable UI and built-in help
- Option to retain border pixels
- Various bug fixes
- New video tutorial
Watch the tutorial video and download pt_CropPrecomps from aescripts.com