驱动器面板

    编辑驱动器弹窗。

    参考

    参考

    这个面板在 右侧工具栏可见,或者给属性添加驱动器时弹出。

    开头显示的是正被驱动的属性名称,然后是决定驱动器如何作用的一系列设置。

    有两类驱动程序:

    • 内置函数 (平均, 求和, 最小值 and 最大值)

      驱动属性将获得被引用 驱动器变量 数值的平均值、总和、最低或最高值。如果只有一个驱动器变量,这些函数将产生相同的结果。

    驱动器值

    当前驱动器的计算结果。

    驱动器变量

    更新依赖

    强制更新驱动器值相关性。

    打开全功能的 。该按钮仅显示弹出菜单形式的驱动器。

    变量可以是物体单个属性、变换通道(位置缩放等信息)、两个物体的旋转角度差值、两个物体的距离。

    驱动器通过 驱动器变量 访问物体数据,而不是以Python表达式形式引用,以便正确跟踪依赖项。

    添加、复制、粘贴按钮。

    添加变量

    添加新的驱动变量。

    复制/粘贴变量

    复制当前的变量列表,供粘贴到其他驱动器的变量列表中。

    名称

    用于脚本表达式的变量名。必须以字母开头,仅允许包含字母、数字或者下划线。

    变量类型

    使用的变量类型。

    • 单个属性

      检索由数据块引用和路径字符串指定的 RNA 属性的值。

      在变换属性的情况下,这将返回 UI 属性的确切值,而变换通道将根据需要考虑父项和/或约束。

      另见 自定义属性.

      • ID类型

        ID

        数据块的ID,如: “Material.001”。

        RNA路径

        属性的 RNA 名称,基于 Python 属性访问语法的子集。比如, 或 location[0] 表示X向位置坐标值,或者 ["prop_name"] 访问自定义属性。

      Tip

      创建此类型的变量的最简单方法是使用输入属性的 上下文菜单,并通过 粘贴驱动器变量 将结果粘贴到驱动器。

      形变通道

      使用物体或骨骼的某一变换通道。

      • ID

        物体的ID。如: Cube, Armature, Camera。

        骨骼

        骨架中的骨骼ID。如 “Bone”, “Bone.002”, “Arm.r”。该选项仅适用于骨架。

        类型

        如, X 位移, X 旋转, X 缩放。

        平均缩放 选项检索合并后的缩放值,计算为总体积变化的立方根。与 X/Y/Z 缩放 不同,如果物体被负值缩放翻转,则该值也可以是负数。

        模式(旋转)

        For rotation channels, specifies the type of rotation data to use, including different explicit orders. Defaults to using the Euler order of the target. See Rotation Channel Modes.

        空间

        世界空间、变换空间、自身空间。

      旋转差值

      使用两个物体或骨骼的旋转差值。

      距离

      使用两个物体或骨骼之间的距离。

    显示变量数值。

    Rotation Channel Modes

    Rotation Transform Channels support a number of operation modes, including:

    Auto Euler

    Uses the order of the target to decompose rotation into channels.

    XYZ Euler, …

    Explicitly specifies the Euler rotation order to use.

    Quaternion

    Provides the representation of the rotation.

    Swing and X/Y/Z Twist

    Decomposes the rotation into two parts: a swing rotation that aims the specified axis in its final direction, followed by a twist rotation around that axis. This is often necessary for driving corrective Shape Keys and bones for organic joint rotation.

    The channels values for Swing and Y Twist are:

    ../../_images/animation_drivers_drivers-panel_angle-curve.png

    Falloff curves for weighted angles.

    • Y 旋转

      True angle of the twist rotation.

      W 旋转

      True angle of the swing rotation, independent of its direction.

      X Rotation, Z Rotation

      Weighted angles that represent the amount of swing around the X/Z axis.

      The magnitude of the angle equals W Rotation when the rotation is purely around that axis, and fades out to zero as the direction changes toward the other axis, following the falloff curves from the graph on the right.

    Mathematically, the swing angles are computed from quaternion components, using \(2 \arccos(w)\) for W and \(2 \arcsin(x)\) etc. for the others. The component of the swing rotation that corresponds to the twist axis is always 0, and is replaced by the twist angle.

    表达式

    一个文本框,可以在其中输入一个任意 Python 表达式,该表达式以名称引用 驱动器变量

    表达式可以访问 驱动器命名空间 中提供的一组标准常量和数学函数。有关向命名空间添加自定义函数的示例见 。

    为了优化性能,最好尽可能使用 简单表达式

    使用自身

    使用 self 变量引用自身数据。用于物体、骨骼,避免创建指向自身属性的变量。

    举例: self.location.x 可用于同一对象的Y旋转属性,使对象在移动时旋转。

    请注意,可能无法完全跟踪通过 self 访问的属性的依赖项。

    Blender可以直接使用Python的函数表达方法,显著提高性能,尤其是在多个系统中。要利用此功能,驱动程序的表达式必须且仅使用以下功能:

    变量名称

    仅使用ASCII字符。

    常量

    浮点和十进制整数。

    全局变量

    frame

    常量

    pi, True, False

    运算符号

    +, -, *, /, ==, , <, <=, >, >=, and, or, not, conditional operator/ ternary if

    函数

    min, max, radians, degrees, abs, fabs, floor, , trunc, int, sin, cos, tan, asin, acos, atan, atan2, exp, log, sqrt, pow, fmod

    即使禁用Python脚本执行,也会计算简单表达式。

    When an expression outside of this subset is used, Blender displays a “Slow Python expression” warning. However, as long as the majority of drivers use simple expressions, using a complex expression in select few is OK.