驱动器面板¶
参考
编辑器: | 曲线编辑器 |
---|---|
模式: | 驱动器面板 |
面板: | |
快捷键: | N |
参考
面板: | |
---|---|
快捷键: | Ctrl-D |
这个面板在 驱动编辑器 右侧工具栏可见,或者给属性添加驱动器时弹出。
It shows the property that is being driven, followed by a series of settings that determine how the driver works.
驱动器设置¶
类型¶
有两类驱动程序:
内置函数 (平均, 求和, 最小值 and 最大值)
The driven property will have the value of the average, sum, lowest or highest (respectively) of the values of the referenced Driver Variables. If there is only one driver variable, these functions will yield the same result.
自定义 (脚本表达式).
An arbitrary Python expression that can refer to the Driver Variables by name. See Expressions.
驱动器值¶
当前驱动器的计算结果。
更新相关性¶
强制更新驱动器值相关性。
在驱动器编辑器中显示¶
Opens the fully featured Drivers Editor. This button only appears in the popover version of the Drivers panel.
驱动变量¶
变量可以是物体单个属性、变换通道(位置缩放等信息)、两个物体的旋转角度差值、两个物体的距离。
Drivers should access object data via Driver Variables, rather than direct references in the Python expression, in order for dependencies to be correctly tracked.
- 添加变量
- 添加新的驱动变量。
- Copy/Paste Variables
- Copies the current variable list so it can be pasted into another driver's variable list.
- 名称
- Name for use in scripted expressions.
The name must start with a letter, and only contain letters, digits, or
_
. - 变量类型
使用的变量类型。
- 单个属性
Retrieves the value of a RNA property, specified by a data-block reference and a path string.
In case of transform properties, this will return the exact value of the UI property, while Transform Channel will take parenting and/or constraints into account as needed.
另见 自定义属性.
- ID类型
- 标识类型。例如:关键帧,图像,物体,材质。
- ID
- 数据块的ID,如: "Material.001"。
- RNA路径
- The RNA name of the property, based on a subset of Python attribute access syntax.
For example:
location.x
orlocation[0]
for the raw X location value, or["prop_name"]
for a custom property.
Tip
The easiest way to create a variable of this type is to use the Copy As New Driver context menu option of the input property, and paste the result into the driver via Paste Driver Variables.
- 形变通道
使用物体或骨骼的某一变换通道。
- ID
- 物体的ID。如: Cube, Armature, Camera。
- 骨骼
- 骨架中的骨骼ID。如 "Bone", "Bone.002", "Arm.r"。该选项仅适用于骨架。
- 类型
如, X 位移, X 旋转, X 缩放。
The Average Scale option retrieves the combined scale value, computed as the cubic root of the total change in volume. Unlike X/Y/Z Scale, this value can be negative if the object is flipped by negative scaling.
- 空间
- 世界空间、变换空间、自身空间。
- 旋转差值
- 使用两个物体或骨骼的旋转差值。
- 距离
- 使用两个物体或骨骼之间的距离。
- 值
- 显示变量数值。
表达式¶
- 表达式
A text field where you can enter an arbitrary Python expression that refers to Driver Variables by their names.
The expression has access to a set of standard constants and math functions provided in the Driver Namespace. For an example of adding a custom function to the namespace, see the driver namespace example.
For performance reasons it is best to use the Simple Expressions subset as much as possible.
- Use Self
使用
self
变量引用自身数据。用于物体、骨骼,避免创建指向自身属性的变量。举例:
self.location.x
可用于同一对象的Y旋转属性,使对象在移动时旋转。Note that dependencies for properties accessed via
self
may not be fully tracked.
简单表达式¶
Blender可以直接使用Python的函数表达方法,显著提高性能,尤其是在多个系统中。要利用此功能,驱动程序的表达式必须且仅使用以下功能:
- 变量名称
- 仅使用ASCII字符。
- 常量
- 浮点和十进制整数。
- 全局变量
frame
- 常量
pi
,True
,False
- 运算符号
+
,-
,*
,/
,==
,!=
,<
,<=
,>
,>=
,and
,or
,not
, conditional operator/ ternary if- 函数
min
,max
,radians
,degrees
,abs
,fabs
,floor
,ceil
,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.
See also