Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
rainjam
Topic Author
Posts: 4
Joined: Fri Apr 04, 2008 4:28 am

Finding out the scale of a layer with a parent

Mon May 26, 2008 8:25 am

Anyone know how to do this? The layer space transforms (toComp, toWorld etc) seem to do this for position values but I can't find any way of finding a layer's absolute scale value. I'm trying to do a "world zoom" similar to the Videocopilot tutorial, so the highest-res layer when fully zoomed out is scaled about 0.01%. But using layer(index).transform.scale just gives its "internal" scale value which is 50%. I just wanted to try and cut down on render time by turning off any layers smaller than about 1% scale, but can't figure out how.

Thanks in advance

Nick
 
Dan Ebberts
Posts: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Finding out the scale of a layer with a parent

Mon May 26, 2008 9:10 am

Like this:

s = scale[0];
L = thisLayer;
while (L.hasParent){
  s = s*L.parent.scale[0]/100;
  L = L.parent;
}
s


Dan
 
rainjam
Topic Author
Posts: 4
Joined: Fri Apr 04, 2008 4:28 am

Re: Finding out the scale of a layer with a parent

Mon May 26, 2008 10:41 am

Genius. Thanks Dan!

Who is online

Users browsing this forum: No registered users and 3 guests