Skip to main content
Richard Rosenman
Inspiring
January 21, 2022
Answered

Checking Out Layer Position

  • January 21, 2022
  • 1 reply
  • 2350 views

Hi gang;

 

This is probably a very silly question but if I check out a layer like so:

	AEFX_CLR_STRUCT(checkout);
	ERR(PF_CHECKOUT_PARAM(in_data,
		PARENT_LAYER_ID,
		in_data->current_time,
		in_data->time_step,
		in_data->time_scale,
		&checkout));

 

How do I retrieve it's position?

I know I can easily retrieve the layer's width and height like so:

 

int width = checkout.u.ld.width;
int height = checkout.u.ld.height;

 

I found in the documentation that I can use this to retrieve the origin, which I assume is what I want:

int originx = checkout.u.ld.origin_x;
int originy = checkout.u.ld.origin_y;

 

But these return 0. I basically want to retrieve a layer's position so that I can bind my effect to it's position.

Am I doing something wrong?

 

Thanks,

-Richard

This topic has been closed for replies.
Correct answer shachar carmi

Hi Shachar;

 

You've been more than helpful and I'd understand if you've hard enough but... on the off-chance you haven't:

 

Your suggestion did in fact, resolve the crash. The result is a different error message pop-up upon plugin launch, as well as the effect never getting drawn at all:

 

After Effects error: zero denominator converting ratio denominators. (17 :: 19)

 

I Googled this but a number of totally unrelated issues came up, some having to do with framerate (which has nothing to do with my plugin).

 

And upon stepping through with the debugger, this is the feedback:

 

&thisTime	0x0000000048e5b1a0 {value=1 scale=0 }	A_Time *
&val	0x0000000048e5b540 {streamH=0x00000000685e91e0 {Camera Raw.8bi!0x0000000053535353 {...}} val={four_d=...} }	AEGP_StreamValue2 *
AEGP_LTimeMode_LayerTime	AEGP_LTimeMode_LayerTime (0)	<unnamed-enum-AEGP_LTimeMode_LayerTime>
ERR	0	unsigned int
globalID	0	long
stream	0x00000000685e91e0 {Camera Raw.8bi!0x0000000053535353 {...}}	_AEGPp_Stream * *
suites	{i_pica_basicP=U.dll!0x0000000008165d30 {AcquireSuite=U.dll!0x00000000080b9ab0 ReleaseSuite=U.dll!0x00000000080ba0a0 ...} ...}	AEGP_SuiteHandler
val	{streamH=0x00000000685e91e0 {Camera Raw.8bi!0x0000000053535353 {...}} val={four_d=0x0000000048e5b548 {...} ...} }	AEGP_StreamValue2
val.streamH	0x00000000685e91e0 {Camera Raw.8bi!0x0000000053535353 {...}}	_AEGPp_Stream * *

Again, I understand if this is just too tedious to resolve but if this gives you any other thoughts, please do share. I'd love to get this AEGP example working, so I can apply it to all the others moving forward.

 

Thanks,

-Rich


&thisTime 0x0000000048e5b1a0 {value=1 scale=0 }

time scale can't be 0.

1 reply

Community Expert
January 21, 2022

origin_x and y will give you the layer's 0,0 location in the grabbed buffer. it won't give you the layer's width and height.

i do the following (perhpas there' a better way):

1. get the layer param's value using AEGP_GetNewStreamValue();

2. the gotten value will contain an AEGP_LayerIDVal. use it with AEGP_GetLayerFromLayerID.

3. now use AEGP_GetLayerSourceItem to obatin the layer's source object.

4. and finally, AEGP_GetItemDimensions will get you the layer's source item's dimensions.

Richard Rosenman
Inspiring
January 21, 2022

Hi Shachar!

 

Thanks for your reply as always!

 

Actually, I'm interested in the grabbed layer's position, not size, so that I can bind my effect to it. Kind of like using the pickwhip in After Effects to link one item's position to another. Can that be done with:

 

checkout.u.ld.origin_x;

 

However, when I use it, I just get 0.0 no matter where I move the grabbed layer.

 

Any suggestions?

 

Thanks,

Richard 

Community Expert
January 21, 2022

AEGP_GetNewLayerStream with AEGP_LayerStream_POSITION.