AE ENHANCERS

Expressions/Scripts/Presets
It is currently Tue May 21, 2013 1:45 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Shape Layers Question
PostPosted: Sat May 14, 2011 8:41 pm 
Offline

Joined: Sat May 14, 2011 8:23 pm
Posts: 1
I'm new to scripting for AE (but not new to programming) and I think I have discovered a bug in After Effects, or maybe I am just too ignorant to understand my problem. Please point me in the right direction.

In my script I have called the following:

Code:
app.project.activeItem.selectedLayers[0].width


where the selected layer is a shape layer. It always returns "1920" (the comp width), not the actual width of the shape. I've tested this with other types of layers, and they all return their correct widths.
How do I get the correct width of the shape layer, or better yet the size of rectangles and the radii of ellipses?


Top
 Profile  
 
 Post subject: Re: Shape Layers Question
PostPosted: Sun May 15, 2011 9:09 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 646
Location: London, UK
You need the sourceRectAtTime method. This is from the CS3 scripting guide:

AVLayer sourceRectAtTime() method
app.project.item(index).layer(index).sourceRectAtTime(timeT, extents)

Retrieves the rectangle bounds of the layer at the specified time index, corrected for text or shape layer content. Use, for example, to write text that is properly aligned to the baseline.

timeT: The time index, in seconds. A floating-point value.
extents: True to include the extents, false otherwise. Extents apply to shape layers, increasing the size of the layer bounds as necessary.

Returns a JavaScript object with four attributes, [top, left, width, height].


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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