## My Foray into the World of After Effects Plugin Development

This will be a very short entry, as I’ve already made a post, so forgive me for the brevity of this particular parcel.

The zest that drives me in the world of graphics programming is being able to create an application like Adobe’s After Effects. I have, in the past, had a very fun time with this software of which I am fond of. But in order to achieve such a feat, one must first release a plugin or two for the software. Me, I plan on writing a book on the subject. But that’s far into the distance.

But there are many blockades on the road which must be dealt with. First one is the fact that my Visual Studio can’t debug the damn plugins. I haven’t written any yet, but I can’t get Visual Studio debugger to work, IntelliTrace won’t show the value of any of the variables, even I I engage the plugin’s PiPL entry point, set many breakpoints, even in the wretched about() function. Therefore, I couldn’t have written any plugins even if I could, as blindly compiling the aex files back and forth is simply retarded.

I have many other problems as well, but they can be solved by reading the manual. And I’m reading it thoroughly, and carefully. Let me explain how this API works:

1. Parameters
2. Flags
3. Suites

Parameters are the UI elements which you deal with in a plugin. They’re few, but applicable. Flags are orders which the plugin orders the application. And suites are a collection of functions that comprise the API functional libraries.

For example, here’s the render function of the Skeleton example:

static PF_Err
Render (
PF_InData		*in_data,
PF_OutData		*out_data,
PF_ParamDef		*params[],
PF_LayerDef		*output )
{
PF_Err				err		= PF_Err_NONE;
AEGP_SuiteHandler	suites(in_data->pica_basicP);

/*	Put interesting code here. */
GainInfo			giP;
AEFX_CLR_STRUCT(giP);
A_long				linesL	= 0;

linesL 		= output->extent_hint.bottom - output->extent_hint.top;
giP.gainF 	= params[SKELETON_GAIN]->u.fs_d.value;

if (PF_WORLD_IS_DEEP(output)){
ERR(suites.Iterate16Suite1()->iterate(	in_data,
0,								// progress base
linesL,							// progress final
&amp;params[SKELETON_INPUT]->u.ld,	// src
NULL,							// area - null for all pixels
(void*)&amp;giP,					// refcon - your custom data pointer
MySimpleGainFunc16,				// pixel function pointer
output));
} else {
ERR(suites.Iterate8Suite1()->iterate(	in_data,
0,								// progress base
linesL,							// progress final
&amp;params[SKELETON_INPUT]->u.ld,	// src
NULL,							// area - null for all pixels
(void*)&amp;giP,					// refcon - your custom data pointer
MySimpleGainFunc8,				// pixel function pointer
output));
}

return err;
}


The functions takes a reference construct, in_data and out_data which are the given data, and the generative data, and params array which is the parameters of the UI, and finally, a layerdef which is the layer that effect has been applied to it.

At first, it creates a GainInfo variable which later will serve as our reference construct, does some calculations on it, and later passes it as the refcon to our two 8bit an 16bit functions. They in turn, cast the refcon into another variable type, and place some calculations on it, and carry the operation.

This is the basis of how AE plugins do what they do. Of course, there are some plugin types such as AEGP (which element 3D falls under). Element 3D for example, uses Assimp OpenGL Model Loader to load models, then dump the framebuffer into an image, and pass it into After Effects.

That is it for the moment. I hope you’ve enjoyed this post. I will keep you updated on my exploits. And my first plugin will definitely be free.