AE ENHANCERS

Expressions/Scripts/Presets
It is currently Thu Sep 02, 2010 3:49 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Crop Layer Sets
PostPosted: Fri Sep 15, 2006 10:16 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 509
Location: London, UK
Photoshop files can contain layer sets, groups of layers that are imported into AE as precomps. Unfortunately these precomps are always the same size as the main comp. This script crops the precomps to the size of their contents, while retaining their correct position in the main comp. Ideally the script should be run on a freshly imported PSD comp before any changes are made.

I wrote this script based on a request from Mark Coleran http://www.coleran.com, a leading screen graphics designer. Mark creates user interface designs in Photoshop made up of many layer sets for the different UI components. This script makes it easier to manipulate the precomp layers, the bounding boxes accurately reflect the size/position of the precomps and effects are applied to a smaller area, making for more efficient renders.

Download pt_CropLayerSets_v1.2.zip

How to use:
Import a Photoshop file that contains layers sets, as a composition. Ensure you select layer bounds for layer size, and not document size. Select the composition in the project window and run the script


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Fri Feb 08, 2008 5:28 am 
Offline

Joined: Fri Feb 08, 2008 4:39 am
Posts: 8
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.


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Thu Feb 14, 2008 10:52 am 
Offline

Joined: Fri Feb 08, 2008 4:39 am
Posts: 8
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


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Thu Feb 14, 2008 2:50 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 509
Location: London, UK
I'll look into it.

Paul


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Thu Feb 14, 2008 4:59 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 509
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


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Fri Feb 15, 2008 10:41 pm 
Offline

Joined: Fri Dec 01, 2006 1:20 pm
Posts: 28
This script is great. Really helps.

Is there a similar script around which will take any comp and crop it to the boundary of the visible layers?

Thanks,

Russ


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Sat Feb 16, 2008 5:49 am 
Offline

Joined: Fri Feb 08, 2008 4:39 am
Posts: 8
Initial tests works great. Thanks a lot for this.

Ignoring adjustment.. That is very clever. Preserving its effect on layers below when the Collapse Transformations is checked. I have no problem with that.


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Thu Mar 20, 2008 7:20 am 
Offline

Joined: Fri Feb 08, 2008 4:39 am
Posts: 8
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?


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Fri Mar 21, 2008 7:47 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 509
Location: London, UK
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
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.

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

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?
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.
Download pt_CropLayerSets_v1.2.zip


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Wed Jul 15, 2009 1:51 am 
Offline

Joined: Mon Feb 16, 2009 12:41 pm
Posts: 41
I'm having trouble with AE 9.0.2 and Crop 1.2.

I'm getting this error... :(

Imported with comp with layer size. It's an Illustrator CS4 multi layer doc if that makes a difference.


Attachments:
Picture 3.png
Picture 3.png [ 24.63 KiB | Viewed 2959 times ]
Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Wed Jul 15, 2009 7:55 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 509
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. Send to paul.tuersley@btinternet.com. 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.


Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Sun Aug 08, 2010 5:41 pm 
Offline

Joined: Mon Feb 16, 2009 12:41 pm
Posts: 41
Hey Paul .. Getting it again. Using CS5 now.

Attachment:
Screen shot 2010-08-08 at 7.33.39 PM.png
Screen shot 2010-08-08 at 7.33.39 PM.png [ 22.64 KiB | Viewed 230 times ]


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.08 KiB]
Downloaded 5 times
Top
 Profile  
 
 Post subject: Re: Crop Layer Sets
PostPosted: Mon Aug 09, 2010 12:40 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 509
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: MSN [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group