AEJoy —— AE 插件开发中的 SmartFX (五)
正文
PF_PreRenderCallbacks
目前,只有一个回调—— checkout_layer
。checkout_idL 是由 effect 选择的。
它必须是正的和独一无二的。After Effects 会填充 PF_CheckoutResult
。
PF_Err checkout_layer( PF_ProgPtr effect_ref, PF_ParamIndex index, A_long checkout_idL, const PF_RenderRequest *req, A_long what_time, A_long time_step, A_u_long time_scale, PF_CheckoutResult *result); typedef struct { PF_LRect result_rect; PF_LRect max_result_rect; PF_RationalScale par; long solid; PF_Boolean reservedB[3]; A_long ref_width; A_long ref_height; } PF_CheckoutResult; 复制代码
result_rect
可以为空。 如果主机要求其所有,则 max_result_rect
是可能的最大的输出。如果 solid
为 TRUE
,则整个 result_rect
都有不透明的 alpha 。
ref_width
和 ref_height
是图层的原始尺寸,在应用任何效果之前,不考虑任何下采样因素。这将是折叠图层的合成尺寸。
在 11.0 中,当 SmartFX 效果同时使用 PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT & PF_OutFlag_NON_PARAM_VARY 时,全局性能缓存(Global Performance Cache)有一个 bug 。
在 PF_Cmd_SMART_PRE_RENDER
期间调用 checkout_layer 将在 PF_CheckoutResult
中返回空矩形。
解决方法是简单地再次调用。在 11.0.1 中不再需要这个解决方案。
PF_PreRenderCallbacks
Currently, there is only one callback -
checkout_layer
. checkout_idL is chosen by the effect.It must be positive and unique. After Effects populates the
PF_CheckoutResult
.PF_Err checkout_layer( PF_ProgPtr effect_ref, PF_ParamIndex index, A_long checkout_idL, const PF_RenderRequest *req, A_long what_time, A_long time_step, A_u_long time_scale, PF_CheckoutResult *result); typedef struct { PF_LRect result_rect; PF_LRect max_result_rect; PF_RationalScale par; long solid; PF_Boolean reservedB[3]; A_long ref_width; A_long ref_height; } PF_CheckoutResult; 复制代码
result_rect
can be empty.max_result_rect
is the largest the output could possibly be, if the host asked for all of it. If solid is TRUE, the entire result_rect has opaque alpha.
ref_width
andref_height
are the original dimensions of the layer, before any effects are applied, disregarding any downsample factors. This will be the size of the composition for collapsed layers.There is a bug in 11.0 with the Global Performance Cache, when a SmartFX effect uses both PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT & PF_OutFlag_NON_PARAM_VARY.
Calling checkout_layer during
PF_Cmd_SMART_PRE_RENDER
returns empty rects inPF_CheckoutResult
.The workaround is to simply make the call again. This workaround is no longer needed in 11.0.1.
result_rect
由渲染请求产生的输出(层坐标系)(可以为空)。
这不能大于输入请求矩形(除非设置了 PF_RenderOutputFlag_RETURNS_EXTRA_PIXELS
),但可以更小。
result_rect
The output (in layer coordinates) resulting from the render request (can be empty).
This cannot be bigger than the input request rectangle (unless
PF_RenderOutputFlag_RETURNS_EXTRA_PIXELS
is set), but can be smaller.
max_result_rect
如果 After Effects 求其所有的话,则该输出是可能取得的最大尺寸。
这不会因请求的输出大小而改变。
max_result_rect
The maximum size the output could possibly be, if After Effects requested all of it.This must not vary depending on requested output size.
作者:ShaderJoy
链接:https://juejin.cn/post/7031223989821407239