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

How to get position of checked out layer in composition coordinate space?

New Here ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

I'm implementing an effect that has a layer parameter and blends the image from that layer with the layer that the effect is applied on:

- The effect is applied on LayerA which is 1920x1080
- The effect's layer parameter is set to LayerB which is 800x600

 

Everything works except that the image coming through the layer parameter (LayerB) is always positioned at the top left corner of LayerA, regardless of where I positioned LayerB in the composition.

 

When I call checkout_layer() during PF_Cmd_SMART_PRE_RENDER, the returned result_rect rectangle has the correct dimentions (800x600) but the top and left fields are always set to zero, regardless where I positioned LayerB.

 

Interestingly, if I create a Shape layer instead of importing an image from disk, I observe that checkout_layer() returns correct values for top and left fields of result_rect and I get the result that I expect.

 

What do I need to do to get the position of a layer passed via layer parameter, when the source of that layer is an image that I imported from disk?

 

Thank you!

TOPICS
How to , SDK

Views

138

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
Engaged ,
Nov 08, 2024 Nov 08, 2024

Copy link to clipboard

Copied

Hi Pedro

 

Shape layers will give the correct values because they are continuously rasterised and are in composition space, not layer space.

 

If the layer does not have collapse transforms on (AV layers), I believe you can get this information from the origins of the layer you checked out and add that to the position values. 

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 ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

Hi James,

Are you referring to the values returned by PF_CHECKOUT_PARAM?

If I use PF_CHECKOUT_PARAM to access the PF_ParamDef data structure of that layer, the .u.ld.origin_x and .u.ld.origin_y are always zero for a layer that only contains an image that I imported from disk.

Please let me know if I misunderstood your hint.

It's surprising to me that AE won't provide a way to get the position of the image coming in through a layer parameter, but I'm at a loss on how to do 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
Engaged ,
Nov 16, 2024 Nov 16, 2024

Copy link to clipboard

Copied

LATEST

Hi Pedro

It's best practice to use checkout_layer_pixels and not via PF_CHECKOUT_PARAM when using smartFX, that should allow you to get the origins. LayerA (where the effect is applied) and LayerB (selected in the layer param) should both be continuously rasterised for this to work. 

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