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

Building my first AE plugin using the example checkout - layer unvisible

New Here ,
Jun 16, 2015 Jun 16, 2015

Hi,

I am trying to learn how to build after effects CS6 plugin using Microsoft visual studio.

I managed to make a test plug using the "checkout" example from the SDK but whenever i apply it to a layer (solid or anything)

My layer which i applied it makes the solid disappear (attached JPG)

This is the code i used to compile.

#include "Checkout.h"

static PF_Err

GlobalSetup (

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_ParamDef *params[],

  PF_LayerDef *output )

{

  PF_Err err = PF_Err_NONE;

  DuckSuite1* dsP = NULL;

  if (AEFX_AcquireSuite( in_data,

  out_data,

  kDuckSuite1,

  kDuckSuiteVersion1,

  "Couldn't load suite.",

  (void**)&dsP)) {

  PF_STRCPY(out_data->return_msg, "plugin loaded successfully");

  } else {

  if (dsP) {

  dsP->Quack(2);

  ERR(AEFX_ReleaseSuite( in_data,

  out_data,

  kDuckSuite1,

  kDuckSuiteVersion1,

  "Couldn't release suite."));

  }

  }

  // We do very little here.

  out_data->my_version = PF_VERSION( MAJOR_VERSION,

  MINOR_VERSION,

  BUG_VERSION,

  STAGE_VERSION,

  BUILD_VERSION);

  out_data->out_flags = PF_OutFlag_WIDE_TIME_INPUT |

  PF_OutFlag_I_DO_DIALOG;

  out_data->out_flags |= PF_OutFlag_PIX_INDEPENDENT |

  PF_OutFlag_USE_OUTPUT_EXTENT;

  out_data->out_flags2 = PF_OutFlag2_PARAM_GROUP_START_COLLAPSED_FLAG |

  PF_OutFlag2_SUPPORTS_SMART_RENDER |

  PF_OutFlag2_FLOAT_COLOR_AWARE |

  PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS;

  return err;

}

/*static PF_Err

PreRender(

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_PreRenderExtra *extra)

{

  /*PF_Err err = PF_Err_NONE;

  PF_ParamDef channel_param;

  PF_RenderRequest req = extra->input->output_request;

  PF_CheckoutResult in_result;

  AEFX_CLR_STRUCT(channel_param);

  // In order to know whether we care about alpha

  // or not, we check out our channel pull-down

  // (the old-fashioned way); if it's set to alpha,

  // we care. -bbb 10/4/05.

  /*ERR(PF_CHECKOUT_PARAM( in_data,

  SMARTY_CHANNEL,

  in_data->current_time,

  in_data->time_step,

  in_data->time_scale,

  &channel_param));

  if (channel_param.u.pd.value == Channel_ALPHA){

  req.channel_mask |=  PF_ChannelMask_ALPHA;

  }

  req.preserve_rgb_of_zero_alpha = TRUE; // Hey, we care.

  ERR(extra->cb->checkout_layer( in_data->effect_ref,

  SMARTY_INPUT,

  SMARTY_INPUT,

  &req,

  in_data->current_time,

  in_data->time_step,

  in_data->time_scale,

  &in_result));

  UnionLRect(&in_result.result_rect, &extra->output->result_rect);

  UnionLRect(&in_result.max_result_rect, &extra->output->max_result_rect);

  // Notice something missing, namely the PF_CHECKIN_PARAM to balance

  // the old-fashioned PF_CHECKOUT_PARAM, above?

  // For SmartFX, AE automagically checks in any params checked out

  // during PF_Cmd_SMART_PRE_RENDER, new or old-fashioned.

  //return err;

  return 0;

}*/

static PF_Err

ParamsSetup (

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_ParamDef *params[],

  PF_LayerDef *output )

{

  PF_Err err = PF_Err_NONE;

  PF_ParamDef def;

  PF_EffectUISuite1 *effect_ui_suiteP = NULL;

  AEFX_CLR_STRUCT(def);

  PF_ADD_SLIDER( NAME,

  CHECK_FRAME_MIN,

  CHECK_FRAME_MAX,

  CHECK_FRAME_MIN,

  CHECK_FRAME_MAX,

  CHECK_FRAME_DFLT,

  CHECK_FRAME_DISK_ID);

  AEFX_CLR_STRUCT(def);

  //define the add layer dropdown menu name

  PF_ADD_LAYER("Layer to checkout",

  PF_LayerDefault_MYSELF,

  CHECK_LAYER_DISK_ID);

  out_data->num_params = CHECK_NUM_PARAMS;

  // Premiere Pro/Elements does not support this suite

  if (in_data->appl_id != 'PrMr')

  {

  ERR(AEFX_AcquireSuite( in_data,

  out_data,

  kPFEffectUISuite,

  kPFEffectUISuiteVersion1,

  NULL,

  (void**)&effect_ui_suiteP));

  ERR(effect_ui_suiteP->PF_SetOptionsButtonName(in_data->effect_ref, "Test Button"));

  (void)AEFX_ReleaseSuite(in_data,

  out_data,

  kPFEffectUISuite,

  kPFEffectUISuiteVersion1,

  NULL);

  }

  return err;

}

static PF_Err

Render(

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_ParamDef *params[],

  PF_LayerDef *output )

{

  PF_Err err = PF_Err_NONE,

  err2 = PF_Err_NONE;

  int32_t num_channelsL = 0;

  PF_Rect halfsies = {0,0,0,0};

  PF_ParamDef checkout;

  PF_ChannelSuite1 *csP = NULL;

  PF_ChannelDesc desc;

  PF_ChannelRef ref;

  PF_ChannelChunk chunk;

  PF_Boolean found_depthPB;

  AEFX_CLR_STRUCT(checkout);

  // Premiere Pro/Elements does not support this suite

  if (in_data->appl_id != 'PrMr')

  {

  ERR(AEFX_AcquireSuite( in_data,

  out_data,

  kPFChannelSuite1,

  kPFChannelSuiteVersion1,

  "Couldn't load suite.",

  (void**)&csP));

  ERR(csP->PF_GetLayerChannelCount( in_data->effect_ref,

  0,

  &num_channelsL));

  

  if(num_channelsL) {

  ERR(csP->PF_GetLayerChannelTypedRefAndDesc( in_data->effect_ref,

  0,

  PF_ChannelType_DEPTH,

  &found_depthPB,

  &ref,

  &desc));

  ERR(csP->PF_CheckoutLayerChannel( in_data->effect_ref,

  &ref,

  in_data->current_time,

  in_data->time_step,

  in_data->time_scale,

  desc.data_type,

  &chunk));

  // do interesting 3d stuff here;

  ERR(csP->PF_CheckinLayerChannel(in_data->effect_ref,

  &ref,

  &chunk));

  }

  ERR2(AEFX_ReleaseSuite( in_data,

  out_data,

  kPFChannelSuite1,

  kPFChannelSuiteVersion1,

  "Couldn't release suite."));

  }

  // set the checked-out rect to be the top half of the layer

  halfsies.top = halfsies.left = 0;

  halfsies.right = (short)output->width;

  halfsies.bottom = (short)(output->height / 2);

  ERR(PF_CHECKOUT_PARAM( in_data,

  CHECK_LAYER,

  (in_data->current_time + params[CHECK_FRAME]->u.sd.value * in_data->time_step),

  in_data->time_step,

  in_data->time_scale,

  &checkout));

  if (!err) {

  if (checkout.u.ld.data)  {

  ERR(PF_COPY(&checkout.u.ld,

  output,

  NULL,

  &halfsies));

  }  else  {

  // no layer? Zero-alpha black.

  ERR(PF_FILL(NULL, &halfsies, output));

  }

  if (!err)  {

  halfsies.top = halfsies.bottom; //reset rect, copy.

  halfsies.bottom = (short)output->height;

  ERR(PF_COPY(&params[CHECK_INPUT]->u.ld,

  output,

  NULL,

  &halfsies));

  }

  }

  ERR2(PF_CHECKIN_PARAM(in_data, &checkout)); // ALWAYS check in,

  // even if invalid param.

  return err;

}

static PF_Err

About (

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_ParamDef *params[],

  PF_LayerDef *output )

{

  PF_SPRINTF(out_data->return_msg,"Name: %s, Description: %s ", NAME, DESCRIPTION);

  /*PF_SPRINTF( out_data->return_msg,

  "%s, v%d.%d\r%s",

  NAME,

  MAJOR_VERSION,

  MINOR_VERSION,

  DESCRIPTION);*/

  return PF_Err_NONE;

}

static PF_Err

PopDialog (

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_ParamDef *params[],

  PF_LayerDef *output )

{

  PF_Err err = PF_Err_NONE;

  PF_SPRINTF( out_data->return_msg,

  "Dudy Bin Message1");

  out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE;

  return err;

}

DllExport

PF_Err

EntryPointFunc (

  PF_Cmd cmd,

  PF_InData *in_data,

  PF_OutData *out_data,

  PF_ParamDef *params[],

  PF_LayerDef *output,

  void *extra)

{

  PF_Err err = PF_Err_NONE;

  switch (cmd) {

  case PF_Cmd_ABOUT:

  err = About(in_data,out_data,params,output);

  break;

  case PF_Cmd_GLOBAL_SETUP:

  err = GlobalSetup(in_data,out_data,params,output);

  break;

  case PF_Cmd_PARAMS_SETUP:

  err = ParamsSetup(in_data,out_data,params,output);

  break;

  case PF_Cmd_RENDER:

  err = Render(in_data,out_data,params,output);

  break;

  case PF_Cmd_DO_DIALOG:

  err = PopDialog(in_data,out_data,params,output);

  break;

  default:

  break;

  }

  return err;

}

example.jpg

Thanks,

Dudy.

TOPICS
SDK
1.5K
Translate
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 ,
Jun 16, 2015 Jun 16, 2015

it doesn't "disappear", it just has an empty output buffer.

are you feeding the effect output with any pixel data?

Translate
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 ,
Jun 16, 2015 Jun 16, 2015

Hi Shachar and thanks for the response.

I am not sure where should i feed the effect with the pixel data or what kind of pixel data ?

Sorry if i sound confused but its all new to me

Thanks,

Dudy.

Translate
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 ,
Jun 16, 2015 Jun 16, 2015

one of the arguments in the "Render" function of the "Checkout" sample is:

PF_LayerDef *output

this is the buffer which you need to fill with your result. AE will carry

that buffer onward to the next effect or the layer render in the comp.

Translate
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 ,
Jun 17, 2015 Jun 17, 2015

Hi Shachar can you please show me an example for *output just to start playing with ? I looked into the debug and saw that in my code output has all kind of properties

That hasn't assigned.

Thanks,

Dudy.

Translate
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 ,
Jun 17, 2015 Jun 17, 2015

what sort of plug-in do you want to develop?

it's hard to give such general advice.

Translate
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 ,
Jun 17, 2015 Jun 17, 2015

I am trying to make a plugin which will make an ease effect to any animation made inside after effects.

It can be a solid,composition etc..

I am trying to learn from the SDK example so i could see how things are done there, but i am quite new to c++ (tough i used to program in action script and java script)

Thanks for the quick response Shachar,

Dudy.

Translate
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 ,
Jun 17, 2015 Jun 17, 2015

if i get you correctly, you're trying to affect the animation keyframes,

and not so much to process the layer's image.

should you try to create an "ease" effect by affecting the image instead of

the animation parameters you'll want to create a "transform" like effect,

which will compensate for the layer's offset from it's location to where

you'd like it to be.

it's possible, but would of course affect image quality, as the layer's

transform would happen as well.

if you wish to affect only the keyframes, take a look at the "Easy_Cheese"

sample project. it does just that.

Translate
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 ,
Jun 17, 2015 Jun 17, 2015

Thanks Shachar, i will look into it.

BTW if i want to access the position parameter or rotation parameter of the current layer which i apply my plugin.

ho do i get those parameters in realtime (meaning while i pressed RAM preview and the frames are counted)

hope my question made sense.

Thanks,

Dudy.

Translate
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 ,
Jun 17, 2015 Jun 17, 2015
LATEST

well...

there are two kinds of plug-ins. "Effects" which are applied to layers and

process image and audio, and "AEGPs" (After Effects General Plugin) which

do everything else.

both are passive, and are invoked by AE whenever it sees fit. when invoked,

both the plug-ins types can access whatever data they want.

during a RAM preview effects will get invoked to render each frame, so you

can access the transform params then.

AEGPs are invoked either during a command hook (such a as a menu command

they're wired to being pressed), or idle hook (a periodic call to AEGPs,

which happens a few times each second).

however, during a ram preview, there is no idle time so idle hooks are not

called.

in any case, you can't change parameter values during a render, as it will

invalidate the render itself.

i have to say that you're advancing into a problemous territory... there's

no good way to affect a layer's position on the fly without a few major

issues coming up. AE is just not wired up that way.

if you're looking for easier solutions, either affect keyframes as you wish

in the same way that "Easy ease" does, or apply a corrective "transform"

effect on your layers, at the expense of blurred images due to double

transformations.

Translate
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