「这是我参与11月更文挑战的第 14 天,活动详情查看:2021最后一次更文挑战」。
参加该活动的第 30 篇文章
正文
内容边界
节点(node)的内容边界是调用 PreRender 可以返回的最大可能的结果矩形。它绝对不能根据当前的渲染请求或其他任何东西而变化,应该仔细计算它,而不是轻率地计算。
这个计算是非常重要的。它是节点(及其输入)的固有属性,一旦构建了图,它就固定下来了。违反它的话可能会在不同的代码段中造成各种各样的问题。
Content Bounds
The content bounds of a node are the largest possible result rectangle that can be returned from a call to PreRender. It absolutely cannot vary depending on current render request or anything else. It should be calculated carefully, not loosely.
This calculation is very important. It is an intrinsic property of the node (and its inputs) and is fixed once the graph is built. Violation of it can and probably will cause all sorts of problems in various pieces of code.
如何 Smaritify
设置了 PF_OutFlag2_SUPPORTS_SMART_RENDER (来自 PF_OutFlags)的效果将收到 SmartFX 调用 PF_Cmd_SMART_PRE_RENDER 和 PF_Cmd_SMART_RENDER (来自 Frame Selectors),而不是旧的 PF_Cmd_FRAME_SETUP / PF_Cmd_RENDER / PF_Cmd_FRAME_SETDOWN 序列。为了保持与非 Smartified 主机的兼容性,您可能还想继续支持旧的命令。
How To Smartify
Effects which set
PF_OutFlag2_SUPPORTS_SMART_RENDER(from PF_OutFlags) will receive the SmartFX callsPF_Cmd_SMART_PRE_RENDERandPF_Cmd_SMART_RENDER(from Frame Selectors), instead of the olderPF_Cmd_FRAME_SETUP/PF_Cmd_RENDER/PF_Cmd_FRAME_SETDOWNsequence. To preserve compatibility with non-smartified hosts, you may want to continue supporting the older commands too.
PF_Cmd_SMART_PRE_RENDER
After Effects 请求来自 effect 的输出。effect 通过使用回调函数和操作额外参数中的结构体,告诉 After Effects 需要什么样的输入来生成输出。在 PF_Cmd_SMART_PRE_RENDER 期间,一个 effect 是不能访问它没有检出的任何层输入的像素。因此,必须使用 checkout_layer 提前检查 effect 可能需要的所有层的输入。如果一个 effect 可能需要特定的层输入,那么必须现在检出它们,即使稍后在渲染 effect 时可能决定不需要该层。另外,由于在PF_Cmd_SMART_PRE_RENDER 或 PF_Cmd_SMART_RENDER 期间没有参数数组被传递给 SmartFX ,所以任何需要的非层参数必须使用 PF_CHECKOUT_PARAM 检索(来自 Interaction Callbacks)
PF_Cmd_SMART_PRE_RENDER
After Effects requests output from the effect. The effect tells After Effects what input it needs to generate that output, through the use of callback functions, and by manipulating the structures in the extra parameter. An effect cannot access the pixels of any layer inputs it has not checked out during PF_Cmd_SMART_PRE_RENDER. So all layer inputs that an effect might possibly need must be checked out in advance using checkout_layer. If an effect might need certain layer inputs, they must be checked out now, even if later during rendering the effect may decide that the layer isn’t needed. Also, since no parameter array is passed to SmartFX during PF_Cmd_SMART_PRE_RENDER or
PF_Cmd_SMART_RENDER, any non-layer parameters needed must be retrieved usingPF_CHECKOUT_PARAM(from Interaction Callbacks)