AEJoy —— AE 插件开发中的 命令选择器(二)

285 阅读3分钟

「这是我参与11月更文挑战的第 22 天,活动详情查看:2021最后一次更文挑战」。

参加该活动的第 39 篇文章

正文

命令选择器表

全局选择器

所有插件都必须响应这些选择器

选择器响应
PF_Cmd_ABOUT显示一个描述插件的对话框。填充out_data>return_msg 而且 After Effects 将在一个简单的模态对话框中显示它。在对话框中包含插件的版本信息。在 macOS 上,当前资源文件将在此选择器期间设置为您的 effect 模块。
PF_Cmd_GLOBAL_SETUP设置任何必需的标志和 PF_OutData 字段(包括 out_data>my_version)来描述插件的行为。
PF_Cmd_GLOBAL_SETDOWN释放所有全局数据(只有在分配了一些数据时才需要)。
PF_Cmd_PARAM_SETUP描述参数并使用 PF_ADD_PARAM 注册它们。另外,注册自定义用户界面元素。设置 PF_OutData>num_params 来匹配您的参数计数。

Command Selectors Table

Global Selectors

All plug-ins must respond to these selectors

SelectorResponse
PF_Cmd_ABOUTDisplay 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 macOS, the current resource file will be set to your effects module during this selector.
PF_Cmd_GLOBAL_SETUPSet any required flags and PF_OutData fields (including out_data>my_version) to describe your plug-in’s behavior.
PF_Cmd_GLOBAL_SETDOWNFree all global data (only required if you allocated some).
PF_Cmd_PARAM_SETUPDescribe 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_SEQUENCE_SETUP分配和初始化任何特定于序列的数据。第一次应用效果时发送。此时 PF_InData 已初始化。
PF_Cmd_SEQUENCE_RESETUP重新创建(通常是非平展的)序列数据。在从磁盘读取序列数据后发送,在预合成期间,或在复制 effect 时发送; After Effects 会在复制之前平展序列数据。在复制期间,PF_Cmd_SEQUENCE_RESETUP 对旧序列和新序列都发送。不要期望在 PF_Cmd_SEQUENCE_RESETUPs 之间会出现 PF_Cmd_SEQUENCE_FLATTEN
PF_Cmd_SEQUENCE_FLATTEN在保存和复制序列时发送。平展包含着指针或句柄的序列数据,以便将其写入磁盘。这将与项目文件一起保存。释放非平展数据并将 out_data>sequence_data 设置为指向新的平展数据。平展数据必须按照正确的字节顺序进行文件存储。在 6.0 版本中,如果一个 effect 的序列数据最近被平展了,那么该 effect 可能会在不接收额外的 PF_Cmd_SEQUENCE_SETDOWN 的情况下被删除。在这种情况下,After Effects 将丢弃你的平展序列数据。释放所有的平展数据。

Sequence Selectors

These control sequence data handling.

SelectorResponse
PF_Cmd_SEQUENCE_SETUPAllocate and initialize any sequence-specific data. Sent when the effect is first applied. PF_InData is initialized at this time.
PF_Cmd_SEQUENCE_RESETUPRe-create (usually unflatten) sequence data. Sent after sequence data is read from disk, during pre-composition, or when the effect is copied;After Effects flattens sequence data before duplication. During duplication, PF_Cmd_SEQUENCE_RESETUP is sent for both the old and new sequences.Don’t expect a PF_Cmd_SEQUENCE_FLATTEN between PF_Cmd_SEQUENCE_RESETUPs.
PF_Cmd_SEQUENCE_FLATTENSent when saving and when duplicating the sequence. Flatten sequence data containing pointers or handles so it can be written to disk.This will saved with the project file. Free the unflat data and set the out_data>sequence_data to point to the new flattened data. Flat data must be correctly byte-ordered for file storage.As of 6.0, if an effect’s sequence data has recently been flattened, the effect may be deleted without receiving an additional PF_Cmd_SEQUENCE_SETDOWN.In this case, After Effects will dispose of your flat sequence data.
PF_Cmd_SEQUENCE_SETDOWNFree all sequence data.