/*** Hacking Movie ***/

かっこいいファンタジー映画をつくるまで。

After_Effects_SDK_Guide を見てみる -01-

まずは
アニメ制作者のためのAfterEffectsプラグイン作成入門(第2回) とりあえず作ってみよう!
を参考に概要を把握したいです。

  • EntryPointFunc関数は、標準Cでいうmain関数に相当します。
  • Effectプラグインは必ずこの関数から実行され、引数のセレクタ(PF_Cmd)に応じたイベント(関数)を実行するように作ります。
  • PF_Cmdについては、付属のドキュメントに詳しい記述があるので、目を通しておくといいと思います。

ということでAfter_Effects_SDK_Guide.pdfみてみます。

Entry Point

After_Effects_SDK_Guide

All communication between After Effects and an effect plug-in is initiated by After Effects, and it all happens by the host (After Effects) calling a single entry point function. For all effect plug-ins, the entry point function must have the following signature:

PF_Err main (
  PF_Cmd cmd,
  PF_InData *in_data,
  PF_OutData *out_data,
  PF_ParamDef *params[],
  PF_LayerDef *output,
  void *extra)

The name of the entry point function above is “main”, but it can be whatever is specified in the PiPL resource.

Argument Purpose
cmd After Effects sets the command selector to tell the plug-in what to do.
in_data Information about the application’s state and the data the plug-in is being told to act upon. Pointers to numerous interface and image manipulation functions are also provided.
out_data Pass back information to After Effects by setting fields within out_data.
params An array of the plug-in’s parameters at the time provided in in_data>current_time. params[0] is the input image (a PF_EffectWorld) to which the effect should be applied. These values are only valid during certain selectors (this is noted in the selector descriptions). Parameters are discussed at length here.
output The output image, to be rendered by the effect plug-in and passed back to After Effects. Only valid during certain selectors.
extra The extra parameter varies with the command sent or (in the case of PF_Cmd_EVENT) the event type. Used primarily for event management and parameter supervision.

SDK_Noise

Premiere Pro CC と Aftereffects CC の SDK -Example-でビルドしてみたSDK_Noiseプロジェクトを見てみる。

SDK_Noise.cppのEntryPointFunc関数。

PF_Err 
EntryPointFunc (
	PF_Cmd			cmd,
	PF_InData		*in_dataP,
	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_dataP,out_data,params,output);
			break;
		case PF_Cmd_GLOBAL_SETUP:
			err = GlobalSetup(in_dataP,out_data,params,output);
			break;
		case PF_Cmd_PARAMS_SETUP:
			err = ParamsSetup(in_dataP,out_data,params,output);
			break;
		case PF_Cmd_RENDER:
			err = Render(in_dataP,out_data,params,output);
			break;
		case PF_Cmd_SMART_PRE_RENDER:
			err = PreRender(in_dataP, out_data, (PF_PreRenderExtra*)extra);
			break;
		case PF_Cmd_SMART_RENDER:
			err = SmartRender(in_dataP, out_data, (PF_SmartRenderExtra*)extra);
			break;
	}
	return err;
}


とりあえず。上6つのセレクタの説明をみる。

Selector Response
PF_Cmd_ABOUT Display a dialog describing the plug-in. Populate out_data>return_msg and After Effects will display it in a simple modal dialog. Include your plug-in’s version information in the dialog. On Mac OS, the current resource file will be set to your effects module during this selector.
PF_Cmd_GLOBAL_SETUP Set any required flags and PF_OutData fields (includingout_data>my_version) to describe your plug-in’s behavior.
PF_Cmd_PARAM_SETUP Describe your parameters and register them using PF_ADD_PARAM. Also, register custom user interface elements. Set PF_OutData>num_params to match your parameter count.
PF_Cmd_RENDER Render the effect into the output, based on the input frame and any parameters. This render call can only support 8-bit or 16-bit per channel rendering. 32-bit per channel rendering must be handled in PF_Cmd_SMART_RENDER.All fields in PF_InData are valid. If your response to this selector is interrupted (your calls to PF_ABORT or PF_PROGRESS returns an error code), your results will not be used. You cannot delete frame_data during this selector; you must wait until PF_Cmd_FRAME_SETDOWN.
PF_Cmd_SMART_PRE_RENDER SmartFX only. Identify the area(s) of input the effect will need to produce its output, based on whatever criteria the effect implements.
PF_Cmd_SMART_RENDER SmartFX only. Perform rendering and provide output for the area(s) the effect was asked to render.

ABOUT

SDK_Noise

SDK_Noise.cppのAbout関数。

static PF_Err 
About (	
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	PF_SPRINTF(	out_data->return_msg, 
				"%s, v%d.%d\r%s",
				NAME, 
				MAJOR_VERSION, 
				MINOR_VERSION, 
				DESCRIPTION);

	return PF_Err_NONE;
}


out_data->return_msg使われてますね。

After_Effects_SDK_Guide

PF_SPRINTF関数とは?

Function Purpose
sprintf Emulates the C sprintf function. Replaces PF_SPRINTF.


Cのsprintf関数の置き換えなのかな。

どこで使われる?

List all plug-ins and version numbers loaded into After Effects

Just press Command+Option+Shift+Help.

Just change this line in the shortcuts file and then restart After Effects:

“WriteVersionFileExtra” = “(Ctrl+Alt+Shift+HELP)”

I mapped mine to Ctrl+Alt+Shift+1 on Windows, like this:

“WriteVersionFileExtra” = “(Ctrl+Alt+Shift+1)”

ショートカットってどこで設定してるんだ。。

Adobe After Effects * 環境設定

キーボードショートカットとワークスペースを含む環境設定は、次の場所にあるファイルに保存されます。

Mac OS:<ドライブ名>/Users/<ユーザー名>/Library/Preferences/Adobe/After Effects/10.0

自分の場合はここにありました。
/Users/katososuke/Library/Preferences/Adobe/After Effects/12.2/Adobe After Effects 12.2 Mac ja_JP ショートカット.txt

446行目の
"WriteVersionFileExtra" = "(Cmd+Option+Shift+HELP)"

"WriteVersionFileExtra" = "(Cmd+Option+Shift+1)"
変更してAE再起動。

Cmd+Option+Shift+1押してみたら

f:id:katososuke:20140104171825p:plain

なんと。。

AEVers.txtみたら

Sample Plug-ins/SDK_Noise v3.0x1

あった。

あったけど、フォーマット違う。。

あ、、、

こっちか。。。

f:id:katososuke:20140104172701p:plain

情報のとこクリック。

f:id:katososuke:20140104172718p:plain

はい。

はい、PF_Cmd_ABOUTについては以上。