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

Adding an Expression to a Layer Hides It

New Here ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

I used the pick whip tool to pair a position expression on a layer to a puppet pin on a second, separate layer. After doing this, the paired layer no longer shows up in my preview screen. If I disable the expression, the layer reappears. 

 

The expression reads: thisComp.layer("Body").effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 3").position

 

How can I make the layer visible with the expression enabled?

TOPICS
Error or problem , Expressions

Views

383

Translate

Translate

Report

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
Mentor ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

The layer is not invisible, but deformed heavily due to the puppet tool - I guess.

Deactivate the expression and check the puppet pin coordinates. Reactivate the expression and see the values again. I bet they are now completly off.

 

The easierst solve is to offset the parent layer until the values fit again. However, this means the parent layer might be "somewhere", even completly out of view.

 

A more useful approch includes .toWorld() expression - I'm not sure if this is acually already working, but :

 

l = parentlayer

l.toWorld(l.anchorPoint)

 

should get you started.

 

*Martin

Votes

Translate

Translate

Report

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
New Here ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

Thanks for the help Martin!

 

I see what you mean about the distortion. With the expression enabled, I can see outlines for the layers outside of my composition settings. Unfortunately, with the expression enabled, adjusting the position doesn't move anything, so doesn't feel like that's an option. I've run this expression on 4 different layers, and they are all defaulting to the same position. Could it be something in my settings?

 

I'm relatively new to After Effects, so could you explain the toWorld solution more? I tried to enter it as you listed, but I'm getting error messages that it's not a function. I entered "Body".toWorld("Body".anchorPoint).

 

Thanks!

Votes

Translate

Translate

Report

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
Mentor ,
Feb 16, 2021 Feb 16, 2021

Copy link to clipboard

Copied

LATEST

I think we need more details about what you are planning to do to give you a more precise help.

 

If you are working with puppet pins, you can use the pins in order to deform your layer. But you can also attach a layer to the pin and use the layer in order to control the pin (and to deform the layer). This approch is often more handy when it comes to animation.

Doing this is as easy as just "pigwhip" the pin to the position of the control layer.

 

If the control layer itself is parented, you cannot just use it's position, because now the position of the control layer doesn't represent its global coordinates, but the coordinates in relation to the parent.

Just see this yourself: Create two layers, and open the position property. Now parent one layer to another and see the value changed for the child-layer.

In order to make this work, you need the layers global position. toWorld() does this.

 

The correct code must be:

 

l = thisComp.layer("Null 1")
l.toWorld(l.anchorPoint)

 

Where "Null 1" is my control layer, parented to another layer ("Null 2").

 

Provide more details, so we can find a solution which covers your case.

 

*Martin

Votes

Translate

Translate

Report

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 ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

try this expression

transform.position+thisComp.layer("Body").effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 3").position

 

then you can move the object you want to parent to the positions you want and they will keep following the puppet pin 

Votes

Translate

Translate

Report

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
New Here ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

Thanks OussK!

 

This doesn't prevent the layers from moving when the expression is turned on, but I'm at least able to readjust them.

Votes

Translate

Translate

Report

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 ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

So are you planning to keep turning on and off the expression? 

if not you need to do this one time, turn on the expression and set the position you want and that's it, 

 

Votes

Translate

Translate

Report

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
Guide ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

the position of the layer will be the values returned by the expression. You can add the Linear expression to convert these values to the ones you want.

Votes

Translate

Translate

Report

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