「这是我参与11月更文挑战的第 24 天,活动详情查看:2021最后一次更文挑战」。
参加该活动的第 41 篇文章
正文
信息收发
After Effects 和插件之间的通信通道。
PF_Cmd_EVENT
这个选择器使用了额外的参数; 要处理的事件类型由 e_type
字段表示,它是由 extra
指向的结构的成员。参见Effect UI & Events。
PF_Cmd_USER_CHANGED_PARAM
用户修改了一个参数值。只有设置了 PF_ParamFlag_SUPERVISE
标志,你才会收到这个命令。您可以修改参数以控制值,或使一个参数的值影响其他参数。参数可以通过不同的操作来修改。 data.current_time
被设置为用户在 UI 中查看的帧的时间(内部地,合成的当前时间转换为层时间),同时它们正在改变触发 PF_Cmd_USER_CHANGED_PARAM
的参数。它也是一个自动添加的关键帧的时间(如果还没有一个,则秒表会被启用的)。这通常与紧随其后的 PF_Cmd_RENDER
传递的值相同(除非 caps 锁定关闭),但不一定 —— 可能有其他合成窗口打开,导致在不同的时间的渲染以响应改变的参数。
PF_Cmd_UPDATE_PARAMS_UI
效果控制面板(ECP)需要更新。这可能发生在打开 ECP 或移动到合成中的新时间之后。您可以通过调用 PF_UpdateParamUI()
来修改参数特征(例如启用或禁用它们)。响应此命令只能进行装饰性的更改。不要改变参数值,当响应 PF_Cmd_UPDATE_PARAMS_UI
的时候; 而应该是在 PF_Cmd_USER_CHANGED_PARAM
期间这样做。如果在 PiPL 中设置了 PF_OutFlag_SEND_UPDATE_PARAMS_UI
,并且在 PF_Cmd_GLOBAL_SETUP
期间,此命令才会定期发送。注意: 在此选择器期间,永远不要检查参数。几乎可以保证会产生递归的不良结果。
PF_Cmd_DO_DIALOG
显示一个选项对话框。当点击选项按钮(或选择菜单命令)时发送。这个选择器只会在 effect 先前表明它有一个对话框时被发送(通过设置全局 PF_OutFlag_I_DO_DIALOG
标志来响应 PF_Cmd_GLOBAL_SETUP
)。在版本 3.x,用 PF_Cmd_DO_DIALOG
传递的参数无效。现在情况不再是这样了; 插件可以访问非层参数,在其他时间检出(check out)参数,并在 PF_Cmd_DO_DIALOG
期间执行 UI 更新。但是它们仍然不能改变参数的值。
PF_Cmd_ARBITRARY_CALLBACK
管理您的任意数据类型。只有在注册了自定义数据类型参数后,才会收到此消息。额外的参数指示正在调用哪个处理程序函数。自定义数据类型将在Implementing Arbitrary Data中进一步讨论。
Messaging
The communication channel between After Effects and your plug-in.
PF_Cmd_EVENT
This selector makes use of the extra parameter; the type of event to be handled is indicated by the e_type field, a member of the structure pointed to by extra.See Effect UI & Events.
PF_Cmd_USER_CHANGED_PARAM
The user changed a parameter value. You will receive this command only if you’ve set the
PF_ParamFlag_SUPERVISE
flag.You modify the parameter to control values, or make one parameter’s value affect others. A parameter can be modified by different actions.in_data.current_time
is set to the time of the frame that the user is looking at in the UI (internally, the current time of the comp converted into layer time) while they are changing the param that triggered thePF_Cmd_USER_CHANGED_PARAM
.It’s also the time of a keyframe that is added automatically (if there isn’t one already, and the stopwatch is enabled).This is usually the same as the value passed for the PF_Cmd_RENDER that follows immediately after (unless caps lock is down), but not necessarily – there could be other comp windows open that cause a render at a different time in response to the changed param.PF_Cmd_UPDATE_PARAMS_UI
The effect controls palette (ECP) needs to be updated. This might occur after opening the ECP or moving to a new time within the composition.You can modify parameter characteristics (enabling or disabling them, for example) by calling
PF_UpdateParamUI()
.Only cosmetic changes may be made in response to this command. Don’t change parameter values while responding toPF_Cmd_UPDATE_PARAMS_UI
; do so duringPF_Cmd_USER_CHANGED_PARAM
instead.This command will only be sent regularly ifPF_OutFlag_SEND_UPDATE_PARAMS_UI
was set in the PiPL, and duringPF_Cmd_GLOBAL_SETUP
.NOTE: Never check out parameters during this selector. Recursive badness is almost guaranteed to result.PF_Cmd_DO_DIALOG
Display an options dialog. this is sent when the Options button is clicked (or a menu command has been selected).This selector will only be sent if the effect has previously indicated that it has a dialog(by setting the global
PF_OutFlag_I_DO_DIALOG
flag in response toPF_Cmd_GLOBAL_SETUP
).In version 3.x, the params passed withPF_Cmd_DO_DIALOG
were invalid.This is no longer the case; plug-ins can access non-layer parameters, check out parameters at other times, and perform UI updates duringPF_Cmd_DO_DIALOG
.They still may not change the parameter’s values.PF_Cmd_ARBITRARY_CALLBACK
Manage your arbitrary data type. You’ll only receive this if you’ve registered a custom data type parameter.The extra parameter indicates which handler function is being called.Custom data types are discussed further in Implementing Arbitrary Data.
(下接)
本文转载自: 掘金