Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to get relative position of layer in larger precomp.

Enthusiast ,
May 23, 2010 May 23, 2010

The Setup:

Comp 1 is 2000x3000 pixels. Comp 1 contains Layer X that is positioned at 1750,1250. (or whatever)

I pull Comp 1 into Comp 2 which is 800x600. I scale and move Comp 1 inside Comp 2 by an arbitrary amount.

How can I determine Layer X's position using Comp 2's coordinate space?

TOPICS
Expressions
4.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 23, 2010 May 23, 2010

Something like this:

L1 = comp("Comp 1").layer("Layer X");
P1 = L1.toWorld(L1.anchorPoint);
L2 = thisComp.layer("Comp 1");
L2.toWorld(P1)

Dan

Translate
Community Expert ,
May 23, 2010 May 23, 2010

Something like this:

L1 = comp("Comp 1").layer("Layer X");
P1 = L1.toWorld(L1.anchorPoint);
L2 = thisComp.layer("Comp 1");
L2.toWorld(P1)

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 24, 2010 May 24, 2010

Perfect! Dan, you are indeed the man! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 02, 2010 Dec 02, 2010

Hey Dan.

I'm having trouble using this with a null.

So Null A is in Comp XX.  Comp XX is pulled into Comp ZZ and moved/scaled. When I put your expression into an effect's Point Control, it doesn't line up where the Null is supposed to be in Comp XX.

What am I missing?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2010 Dec 02, 2010

Try changing the last line to this:

L2.toComp(P1)

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 02, 2010 Dec 02, 2010

Hmmmm... That's not working either.

Inserting this expression into an Effect's point control doesn't put it in the right position.  I tried inserting this expression into another (2D) null's position, but it's in the same incorrect place.

Original Null A Position (from C4D project import).  This comp is put into Comp ZZ.

Screen shot 2010-12-02 at 8.41.23 PM.png

Applying that Expression to Null's position in Comp ZZ puts the new Null B way off in the corner.

Screen shot 2010-12-02 at 8.41.49 PM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2010 Dec 02, 2010

Hard to say without looking at it. What's the exact expression you're using? Also, are all layers and comps square pixels?

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 03, 2010 Dec 03, 2010

Ooookay. I think I got it. The generic comp names was mixing me up. I didn't understand that the L2 should refer to the same pre-comp as where the original null is.  I was putting the name of the layer I was applying this expression to.

So yeah, this works when applied to Point Control of an effect and an objects position

L1 = comp("MyLogo").layer("FlareNull");

P1 = L1.toComp(L1.anchorPoint);

L2 = thisComp.layer("MyLogo");

L2.toWorld(P1)

What's the diff between toWorld and toComp?  World = 3D and Comp= 2D?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2010 Dec 03, 2010
LATEST

Pretty much. toComp() is what you use to get the 2D position in the comp view.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 02, 2010 Dec 02, 2010

See if this helps...

http://db.tt/7IBNIhu

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines