正文
效果 UI 与 事件
效果可以在两个区域提供自定义 UI :
- 效果控制窗口(自定义 ECW UI)
- 合成或层窗口(自定义 Comp UI)。
使用自定义 UI 的效果应该设置 PF_OutFlag_CUSTOM_UI
(【从全局选择器的】PF_Cmd_GLOBAL_SETUP
期间从 PF_OutFlags
中) ,并处理 PF_Cmd_EVENT
选择器。
自定义 ECW UI 允许效果使用自定义控件提供参数,该控件既可以与标准参数类型一起使用,也可以与任意数据参数一起使用。
具有自定义 UI 的参数在添加参数时应该设置 PF_PUI_CONTROL
(来自参数 UI 标志)。
自定义 Comp UI 允许效果在合成或图层窗口中直接操作视频。
当效果被选择时,窗口可以直接在视频上覆盖自定义控件,并可以处理用户与这些控件的交互,以更快速和自然地调整参数。
效果应该通过调用 PF_REGISTER_UI
来注册自己来接收事件。
After Effects 可以将事件发送到效果 ,以进行用户界面处理和参数管理,并将效果集成到其中心消息队列中。
在发送许多事件以响应用户输入的同时,After Effects 也向管理任意数据参数的效果发送事件。
事件的类型在 PF_EventExtra->e_type
中指定,各种事件如下所述。
Effect UI & Events
Effects can provide custom UI in two areas: (1) the Effect Controls Window (custom ECW UI), and (2) the Composition or Layer Windows (Custom Comp UI).
Effects that use custom UI should set
PF_OutFlag_CUSTOM_UI
(from PF_OutFlags duringPF_Cmd_GLOBAL_SETUP
(from Global Selectors), and handle the PF_Cmd_EVENT selector.Custom ECW UI allows an effect to provide a parameter with a customized control, which can be used either with standard parameter types or Arbitrary Data Parameters.
Parameters that have a custom UI should set
PF_PUI_CONTROL
(from Parameter UI Flags) when adding the parameter.Custom Comp UI allows an effect to provide direct manipulation of the video in the Composition or Layer Windows.
When the effect is selected, the Window can overlay custom controls directly on the video, and can handle user interaction with those controls, to adjust parameters more quickly and naturally.
Effects should register themselves to receive events by calling PF_REGISTER_UI.
After Effects can send events to effects for user interface handling and parameter management, integrating effects into its central message queue.
While many events are sent in response to user input, After Effects also sends events to effects which manage arbitrary data parameters.
The type of event is specified in PF_EventExtra->e_type and the various events are described below.
事件
时间类型 | 指示 |
---|---|
PF_Event_NEW_CONTEXT |
用户为事件创建了一个新的上下文(可能是通过打开一个窗口)。允许插件使用上下文句柄在上下文中存储状态信息。PF_EventUnion包含有效的上下文和类型,但其他一切都应该被忽略。 |
PF_Event_ACTIVATE |
用户激活了一个新的上下文(可能是通过将一个窗口带到前景)。PF_EventUnion是空的。 |
PF_Event_DO_CLICK |
用户在效果的 UI 内单击。PF_EventUnion包含一个 PF_DoClickEventInfo 。处理鼠标点击和响应,传递拖动信息; 请参阅示例代码)。注意:从 7.0 开始,不要阻塞直到鼠标抬起; 改为依赖于 PF_Event_DRAG 。 |
PF_Event_DRAG |
也是一个点击事件,PF_EventUnion包含一个 PF_DoClickEventInfo 。请求从 PF_Event_DO_CLICK 返回 send_drag == TRUE 。这样 After Effects 就可以从用户的更改中看到新的数据。 |
PF_Event_DRAW |
绘制事件! PF_EventUnion 包含一个 PF_DrawEventInfo 。 |
PF_Event_DEACTIVATE |
用户已经停用了一个上下文(可能是通过将另一个窗口带到前景)。PF_EventUnion 是空的。 |
PF_Event_CLOSE_CONTEXT |
上下文已被用户关闭。PF_EventUnion 将为空。 |
PF_Event_IDLE |
一个上下文是开放的,但没有发生任何事情。PF_EventUnion 是空的。 |
PF_Event_ADJUST_CURSOR |
鼠标位于插件的 UI 上方。通过改变 PF_AdjustCursorEventInfo 中的 PF_CursorType 来设置光标。使用特定于操作系统的调用来实现自定义游标; 告诉 After Effects 你已经通过设置 PF_CursorType 为 PF_Cursor_CUSTOM 完成了。尽可能使用 After Effects 游标来保持接口的连续性。 |
PF_Event_KEYDOWN |
按键事件。PF_EventUnion包含一个 PF_KeyDownEvent 。 |
PF_Event_MOUSE_EXITED |
CS6 新引入的。通知鼠标不再是在一个特定的视图上(仅层或复合)。 |
Events
Event Indicates PF_Event_NEW_CONTEXT
The user created a new context (probably by opening a window) for events.The plug-in is allowed to store state information inside the context using the context handle.PF_EventUnion contains valid context and type, but everything else should be ignored. PF_Event_ACTIVATE
The user activated a new context (probably by bringing a window into the foreground). PF_EventUnion is empty. PF_Event_DO_CLICK
The user clicked within the effect’s UI. PF_EventUnion contains a PF_DoClickEventInfo
.Handle the mouse click and respond, passing along drag info; see sample code), within a context.NOTE: As of 7.0, do not block until mouse-up; instead, rely onPF_Event_DRAG
.PF_Event_DRAG
Also a Click Event, PF_EventUnion contains a PF_DoClickEventInfo
.Request this by returningsend_drag == TRUE
fromPF_Event_DO_CLICK
.Do this so After Effects can see new data from the user’s changes.PF_Event_DRAW
Draw! PF_EventUnion contains a PF_DrawEventInfo
.PF_Event_DEACTIVATE
The user has deactivated a context (probably by bringing another window into the foreground). PF_EventUnion
is empty.PF_Event_CLOSE_CONTEXT
A context has been closed by the user. PF_EventUnion
will be empty.PF_Event_IDLE
A context is open but nothing is happening. PF_EventUnion
is empty.PF_Event_ADJUST_CURSOR
The mouse is over the plug-in’s UI. Set the cursor by changing the PF_CursorType
in thePF_AdjustCursorEventInfo
.Use OS-specific calls to implement a custom cursor; tell After Effects you’ve done so by settingPF_CursorType
toPF_Cursor_CUSTOM
.Use an After Effects cursor whenever possible to preserve interface continuity.PF_Event_KEYDOWN
Keystroke. PF_EventUnion contains a PF_KeyDownEvent
.PF_Event_MOUSE_EXITED
New in CS6. Notification that the mouse is no longer over a specific view (layer or comp only).
近期评论