Skip to main content
Participant
February 10, 2023
Answered

Checking out simple layer not working correctly ?

  • February 10, 2023
  • 1 reply
  • 782 views

Hi everyone,

 

Maybe someone could help me:

I am struggling checking out a simple layer in a c++ plugin. At first it works well, but when I move the layer the effect is applied in, and I re-render the frame (by purging the memory for example), it will re-draw the checkouted layer from the top left of the composition and not the top left of the layer itself (see screenshots). The checkouted layer gets squeezed somehow.

 

 

Here is my (simple) code :

 

PF_ParamDef checkoutLayerParam;

PF_Err	err = PF_Err_NONE,
        err2 = PF_Err_NONE;

PF_EffectWorld* input_worldP = NULL,
        * output_worldP = NULL;

// checkout input & output buffers.
ERR((extra->cb->checkout_layer_pixels(in_data->effect_ref, CC_INPUT, &input_worldP)));
ERR(extra->cb->checkout_output(in_data->effect_ref, &output_worldP));

// checkout params
AEFX_CLR_STRUCT(checkoutLayerParam);
ERR(PF_CHECKOUT_PARAM(in_data, CC_CHECKOUT_LAYER, in_data->current_time, in_data->time_step, in_data->time_scale, &checkoutLayerParam));

auto worldTransformSuite = AEFX_SuiteScoper<PF_WorldTransformSuite1>(in_data, kPFWorldTransformSuite, kPFWorldTransformSuiteVersion1);

if (!err) {
   if (checkoutLayerParam.u.ld.data) {
            ERR(worldTransformSuite->copy(in_data->effect_ref, &checkoutLayerParam.u.ld, output_worldP, NULL, NULL));
   }
}

ERR2(PF_CHECKIN_PARAM(in_data, &checkoutLayerParam));

return err;

 

Could someone help me understand what's happening, and how to fix this issue ? 

Thanks a lot

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

I am sorry I am not sure to understand... The output origin is always (0,0). You mean to take into account the output origin in my offset calculation ?

Here is my current code :

// Calculate offset
A_long x = (A_long)(effectLayerData.position.x - in_data->width / 2);
A_long y = (A_long) (effectLayerData.position.y - in_data->height / 2);

// Send to output
ERR(worldTransformSuite->transfer_rect(in_data->effect_ref,
	in_data->quality,
	PF_MF_Alpha_STRAIGHT,
	in_data->field,
	&checkout_layer_worldP->extent_hint,
	checkout_layer_worldP,
	&compMode,
	NULL,
	x,
	y,
	output_worldP));

in which effectLayerData contains the position of the layer the effect is applied to (using AEGP methods)


sorry, steered you the wrond way.

you should look at output_worldP->origin_y, and probably also the checkout_layer_woldP->origin_y. (and x, for both)

1 reply

Community Expert
February 10, 2023

i think the issue is that the output buffer is not the size you expect it to be.

when moving a layer partially outside the comp, AE tries to optimize and asks the plug-ins to render only the visable rectangle.

you read the full layer, and copy it to a half height output buffer. the copy operation resizes the source buffer to the dest buffer size.

raul9105Author
Participant
February 10, 2023

All right I see what you mean. So what's the correct way to ckeckout a layer so that is does not get resized?

 

I tried using the checkout_layer_pixels() method, but I only get a cropped version of the original layer, is this one is bigger than the comp' size.

Community Expert
February 10, 2023

calculate the offset, and use composite_rect() instead of copy().