Return-Path: Received: from qmta03.emeryville.ca.mail.comcast.net ([76.96.30.32] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 4849525 for ae-list@media-motion.tv; Mon, 17 Sep 2012 21:01:39 +0200 Received: from omta23.emeryville.ca.mail.comcast.net ([76.96.30.90]) by qmta03.emeryville.ca.mail.comcast.net with comcast id 0Ch51k0011wfjNsA3K35Dp; Mon, 17 Sep 2012 19:03:05 +0000 Received: from HPZ200 ([76.20.32.7]) by omta23.emeryville.ca.mail.comcast.net with comcast id 0K341k00509DSM08jK34P7; Mon, 17 Sep 2012 19:03:04 +0000 Message-ID: From: "Dan Ebberts" To: "After Effects Mail List" References: In-Reply-To: Subject: Re: [AE] Layer Space transform onto parented layers Date: Mon, 17 Sep 2012 12:03:04 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0046_01CD94CC.646E93A0" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3555.308 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308 This is a multi-part message in MIME format. ------=_NextPart_000_0046_01CD94CC.646E93A0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I=92m stumped. I=92ve never seen that error and I can=92t seem to = generate it. Dan From: Byron Nash=20 Sent: Monday, September 17, 2012 11:39 AM To: After Effects Mail List=20 Subject: Re: [AE] Layer Space transform onto parented layers Weird, it seems to take the expression but then I get this error:=20 After Effects warning: layer to world matrix isn=92t invertible in = fromWorld Expression disabled. Error occurred at line 2. Comp: =91MHI_logo_Layers 2=92 Layer: 17 (=91red arrow 2=92) Property: =91Orientation=92 On Mon, Sep 17, 2012 at 2:12 PM, Dan Ebberts = wrote: This should give you the position: L =3D thisComp.layer("parented null"); L.toWorld(L.anchorPoint); And this should give you the orientation: L =3D thisComp.layer("parented null"); u =3D L.toWorldVec([1,0,0]); v =3D L.toWorldVec([0,1,0]);=20 w =3D normalize(L.toWorldVec([0,0,1]));=20 sinb =3D clamp(w[0],-1,1); b =3D Math.asin(sinb); cosb =3D Math.cos(b); if (Math.abs(cosb) > .0005){ c =3D -Math.atan2(v[0],u[0]); a =3D -Math.atan2(w[1],w[2]); }else{ a =3D (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]); c =3D 0; } [radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)] Dan From: Byron Nash=20 Sent: Monday, September 17, 2012 10:20 AM To: After Effects Mail List=20 Subject: Re: [AE] Layer Space transform onto parented layers How about the other direction? I have a layer that is parented inside = a heirarchy. I need to match another layer to it that is unparented. = Most of the motion is from the parent layers rotation. Also, I have = moved the anchorpoints around so they are not in the center. I am = trying different combinations of toWorld and fromWorld and can't seem to = get it working. I need another one on the rotation to get it oriented = correctly, would that go on Orientation or the individual axes? On Wed, Sep 5, 2012 at 6:06 PM, Darby Edelen = wrote: This line: parent.fromWorld(p); Should work no matter how deeply parented the null is. The reason = being that it will take a world position (p) and transform it into the = local/layer space of the current layer's parent. This is exactly how a = child's position is defined (i.e. in the parent's local/layer space). The part that is really important is the parent.fromWorld(). You = could put any world coordinate in there and it should work. On Sep 5, 2012 11:19 PM, "Byron Nash" wrote: Thanks for the expression. I haven't had a chance to test it yet. = I did not think of stacking the toWorld and fromWorld. What if the = parented null is several parent layers deep?=20 On Wed, Sep 5, 2012 at 12:39 PM, Darby Edelen = wrote: In order to transform the parented null to the unparented null = you'll need to use an expression in this form; applied to the parented = null's position: l =3D thisComp.layer("unparented null"); p =3D l.toWorld(l.anchorPoint); parent.fromWorld(p); I can't confirm this is correct at the moment, but it should at = least be close. On Sep 5, 2012 5:37 PM, "Byron Nash" = wrote: I need to "constrain" one null to another with Layer Space = transforms. The null that I am matching FROM is not parented at all. The = one I am wanting to add the expression TO is parented several levels = deep. I have tried various combinations of toComp, fromComp, toWorld, = fromWorld, etc... What is the proper way to apply a comp position value = to a layer that is inheriting many levels of offsets?=20 Thanks! ------=_NextPart_000_0046_01CD94CC.646E93A0 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
I=92m stumped. I=92ve never seen that error and I can=92t seem to = generate=20 it.
 
Dan
 
From: Byron Nash
Sent: Monday, September 17, 2012 11:39 AM
Subject: Re: [AE] Layer Space transform onto parented=20 layers
 
Weird,=20 it seems to take the expression but then I get this error:=20
 
After Effects warning: layer to world matrix isn=92t invertible in=20 fromWorld
Expression disabled.
 
Error occurred at line 2.
Comp: =91MHI_logo_Layers 2=92
Layer: 17 (=91red arrow 2=92)
Property: =91Orientation=92
 
 
 
 
On Mon, Sep 17, 2012 at 2:12 PM, Dan Ebberts = <debberts@comcast.net> wrote:
This should give you the position:
 
L =3D thisComp.layer("parented null");
L.toWorld(L.anchorPoint);
 
And this should give you the orientation:
 
L =3D thisComp.layer("parented null");
u =3D L.toWorldVec([1,0,0]);
v =3D L.toWorldVec([0,1,0]);
w =3D normalize(L.toWorldVec([0,0,1]));
 
sinb =3D clamp(w[0],-1,1);
b =3D Math.asin(sinb);
cosb =3D Math.cos(b);
if (Math.abs(cosb) > .0005){
  c =3D -Math.atan2(v[0],u[0]);
  a =3D -Math.atan2(w[1],w[2]);
}else{
  a =3D (sinb < 0  ?  -1 :=20 1)*Math.atan2(u[1],v[1]);
  c =3D 0;
}
=
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]
 
 
Dan
 
 
From: Byron Nash =
Sent: Monday, September 17, 2012 10:20 AM
Subject: Re: [AE] Layer Space transform onto parented=20 layers
 
How=20 about the other direction? I have a layer that is parented inside a = heirarchy.=20 I need to match another layer to it that is unparented. Most of the = motion is=20 from the parent layers rotation. Also, I have moved the anchorpoints = around so=20 they are not in the center.  I am trying different combinations = of=20 toWorld and fromWorld and can't seem to get it working. I need another = one on=20 the rotation to get it oriented correctly, would that go on = Orientation or the=20 individual axes?

On Wed, Sep 5, 2012 at 6:06 PM, Darby Edelen = <dedelen@gmail.com> wrote:

This line:

parent.fromWorld(p);

Should work no matter how deeply parented the null is. The reason = being=20 that it will take a world position (p) and transform it into the = local/layer=20 space of the current layer's parent. This is exactly how a child's = position=20 is defined (i.e. in the parent's local/layer space).

The part that is really important is the parent.fromWorld(). You = could=20 put any world coordinate in there and it should work.

On Sep 5, 2012 11:19 PM, "Byron Nash" = <byronnash@gmail.com>=20 wrote:
Thanks for the expression. I haven't had a = chance to=20 test it yet. I did not think of stacking the toWorld and = fromWorld. What=20 if the parented null is several parent layers deep?

On Wed, Sep 5, 2012 at 12:39 PM, Darby = Edelen <dedelen@gmail.com> wrote:

In order to transform the parented null to the unparented = null you'll=20 need to use an expression in this form; applied to the parented = null's=20 position:

l =3D thisComp.layer("unparented null");
p =3D=20 l.toWorld(l.anchorPoint);
parent.fromWorld(p);

I can't confirm this is correct at the moment, but it should = at least=20 be close.

On Sep 5, 2012 5:37 PM, "Byron Nash" = <byronnash@gmail.com> wrote:
I need to "constrain" one null to another = with Layer=20 Space transforms. The null that I am matching FROM is not = parented at=20 all. The one I am wanting to add the expression TO is parented = several=20 levels deep. I have tried various combinations of toComp, = fromComp,=20 toWorld, fromWorld, etc... What is the proper way to apply a = comp=20 position value to a layer that is inheriting many levels of = offsets?=20
 
=
Thanks!

<= /BLOCKQUOTE>
=
 
 
------=_NextPart_000_0046_01CD94CC.646E93A0--