Highlighted

PF_Rect, Extent_Hint, Origin Coordinates and Layer Dimension

New Here ,
Jul 29, 2018

Copy link to clipboard

Copied

Hello guys. Can anyone assist me with a bit of explanation about how the PF_Rect and all the dimension variables work in the the after effects SDK. Before I was using on the 8 bit and 16 bit API and didn't need to really understand this. all I knew was there was in_data->width/height and out_data->width/height.

However I have started using the SmartFX API and now I can't get anything on the screen.

My preRender function is the same as the SmartyPants example and in my smartRender function all I am attempting to do is use the PF_COPY(or PF_FILL for that matter) macro to fill the output with something(anything). I am using the world suite to check the format of the layer and only applying an effects if its 8bpc just to get some result even on the 8 bpc. No matter what I do the layer with my effects stays black. I've played with the UnionLRect funciton(even using my on custom values).

so basically my problem comes with understand what all the parameters are in the in_data and out_data.

OutData has a width,height and origin variables.

InData has a width, height, output_origin_x/y, pre_effect_source_origin_x/y and extent_hint.

output(PF_EffectWorld) has (yet again) origin_x/y and (offcourse) width, height and an extend_hint.

Is there something more I should be doing to tell after effects what area I want rendered?

In the SmartyPants Example they use this process to get a PF_Rect that is then used on the PF_COPY macro

     src_rect.left = -in_data->output_origin_x;

     src_rect.top = -in_data->output_origin_y;

     src_rect.bottom = src_rect.top + output->height;

     src_rect.right = src_rect.left + output->width;

-Why is there a negative sign for in_data->origin_x?

-Why are we initializing src_rect.left using information from in_data but taking src_rect.right from output.

this src_rect(PF_RECT) is only used for the PF_COPY macro.

For the iterate function things are done differently. these is how the iterate function looks in SmartyPants.

suites.IterateFloatSuite1()->iterate_origin(

     in_data,                   (PF_InData*)

     0,                             (A_long progress_base)         

     output->height,     (A_long progress_final)

     input,                      (PF_EffectWorld*)

     &areaR,                  (PF_Rect*)

     &origin,                  (PF_Point*)

     (void*)(&idp),           (void*)

     InvertPixelFloat,      ("the iterator function")

     output));                  (PF_EffectWorld)

-"AreaR" is another PF_Rect that is generated like this.

     areaR.top =

     areaR.left = 0;

     areaR.right = 1;

     areaR.bottom = output->height;

Don't quite understand why the rectangle would be 1 x height instead of width x height. I'm sure it has something to do with the progress_base and progress_final(which is output->height)

-"origin" is generated like this.

     origin.h = in_data->output_origin_x;

     origin.v = in_data->output_origin_y;

Why is output->origin_x/y not used to initialize the origin variable but instead the in_data->output_origin_x/y that is used in the iterate function? How are they different?

I feel like there clear reason why this is structured like this, I'm just not seeing the picture quite clearly right now.

EDIT:

I managed to fix some mistakes and made the iterate function work. So I can manipulate the pixels individually but I'm still confused about the layer dimensions, and PF_Rects.

Topics

SDK

Views

484

Likes

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

PF_Rect, Extent_Hint, Origin Coordinates and Layer Dimension

New Here ,
Jul 29, 2018

Copy link to clipboard

Copied

Hello guys. Can anyone assist me with a bit of explanation about how the PF_Rect and all the dimension variables work in the the after effects SDK. Before I was using on the 8 bit and 16 bit API and didn't need to really understand this. all I knew was there was in_data->width/height and out_data->width/height.

However I have started using the SmartFX API and now I can't get anything on the screen.

My preRender function is the same as the SmartyPants example and in my smartRender function all I am attempting to do is use the PF_COPY(or PF_FILL for that matter) macro to fill the output with something(anything). I am using the world suite to check the format of the layer and only applying an effects if its 8bpc just to get some result even on the 8 bpc. No matter what I do the layer with my effects stays black. I've played with the UnionLRect funciton(even using my on custom values).

so basically my problem comes with understand what all the parameters are in the in_data and out_data.

OutData has a width,height and origin variables.

InData has a width, height, output_origin_x/y, pre_effect_source_origin_x/y and extent_hint.

output(PF_EffectWorld) has (yet again) origin_x/y and (offcourse) width, height and an extend_hint.

Is there something more I should be doing to tell after effects what area I want rendered?

In the SmartyPants Example they use this process to get a PF_Rect that is then used on the PF_COPY macro

     src_rect.left = -in_data->output_origin_x;

     src_rect.top = -in_data->output_origin_y;

     src_rect.bottom = src_rect.top + output->height;

     src_rect.right = src_rect.left + output->width;

-Why is there a negative sign for in_data->origin_x?

-Why are we initializing src_rect.left using information from in_data but taking src_rect.right from output.

this src_rect(PF_RECT) is only used for the PF_COPY macro.

For the iterate function things are done differently. these is how the iterate function looks in SmartyPants.

suites.IterateFloatSuite1()->iterate_origin(

     in_data,                   (PF_InData*)

     0,                             (A_long progress_base)         

     output->height,     (A_long progress_final)

     input,                      (PF_EffectWorld*)

     &areaR,                  (PF_Rect*)

     &origin,                  (PF_Point*)

     (void*)(&idp),           (void*)

     InvertPixelFloat,      ("the iterator function")

     output));                  (PF_EffectWorld)

-"AreaR" is another PF_Rect that is generated like this.

     areaR.top =

     areaR.left = 0;

     areaR.right = 1;

     areaR.bottom = output->height;

Don't quite understand why the rectangle would be 1 x height instead of width x height. I'm sure it has something to do with the progress_base and progress_final(which is output->height)

-"origin" is generated like this.

     origin.h = in_data->output_origin_x;

     origin.v = in_data->output_origin_y;

Why is output->origin_x/y not used to initialize the origin variable but instead the in_data->output_origin_x/y that is used in the iterate function? How are they different?

I feel like there clear reason why this is structured like this, I'm just not seeing the picture quite clearly right now.

EDIT:

I managed to fix some mistakes and made the iterate function work. So I can manipulate the pixels individually but I'm still confused about the layer dimensions, and PF_Rects.

Topics

SDK

Views

485

Likes

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
zcream LATEST
Explorer ,
May 09, 2020

Copy link to clipboard

Copied

I probably double posted, these are exactly the same questions that I have too.

Likes

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
Reply
Loading...