************* Drivers Panel ************* .. figure:: /images/animation_drivers_drivers-panel_panel.png :align: right Edit Driver popover. .. admonition:: Reference :class: refbox :Editor: Graph editor :Mode: Drivers :Panel: :menuselection:`Sidebar region --> Drivers` :Hotkey: :kbd:`N` .. admonition:: Reference :class: refbox :Menu: :menuselection:`Context menu --> Edit Driver` :Hotkey: :kbd:`Ctrl-D` This panel is visible in Sidebar of the :doc:`Drivers Editor ` or as a popover when adding a driver to a property. It shows the property that is being driven, followed by a series of settings that determine how the driver works. Driver Settings =============== Type ---- There are two categories of drivers: - **Built-in functions** (*Average*, *Sum*, *Min* and *Max*) 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. - **Custom** (*Scripted Expression*). An arbitrary Python expression that can refer to the *Driver Variables* by name. See `Expressions`_. Driver Value ------------ The current result of the driver setup. Useful for debug purposes. Variables --------- See `Driver Variables`_. Update Dependencies ------------------- Forces an update for the Driver Value dependencies. Show in Drivers Editor ---------------------- Opens the fully featured :doc:`Drivers Editor `. This button only appears in the popover version of the Drivers panel. .. _drivers-variables: Driver Variables ================ Variables are references to properties, transformation channels, or the result of a comparison between transformations of two objects. Drivers should access object data via *Driver Variables*, rather than direct references in the Python expression, in order for dependencies to be correctly tracked. .. figure:: /images/animation_drivers_drivers-panel_add-variable.png :align: right Add, Copy, Paste buttons. Add Input Variable Adds a new Driver Variable. Copy/Paste Variables Copies the current variable list so it can be pasted into another driver's variable list. .. list-table:: * - .. figure:: /images/animation_drivers_drivers-panel_single-property.png Single property. - .. figure:: /images/animation_drivers_drivers-panel_transform-channel2.png Transform channel. - .. figure:: /images/animation_drivers_drivers-panel_distance.png Distance. Name Name for use in scripted expressions. The name must start with a letter, and only contain letters, digits, or ``_``. Variable Type The type of variable to use. Single Property 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. See also :ref:`files-data_blocks-custom-properties`. ID Type The ID-block type. For example: Key, Image, Object, Material. ID The ID of the ID-block type. For example: "Material.001". RNA Path The RNA name of the property, based on a subset of Python attribute access syntax. For example: ``location.x`` or ``location[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 :ref:`Copy As New Driver ` context menu option of the input property, and paste the result into the driver via :ref:`Paste Driver Variables `. Transform Channel Retrieves the value of a Transform channel from an object or bone. ID ID of the object. For example: Cube, Armature, Camera. Bone ID of the Armature bone. For example: "Bone", "Bone.002", "Arm.r". This option is for armatures. Type For example, X Location, X Rotation, X Scale. 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. Space World Space, Transform Space, Local Space. Rotational Difference Provides the value of the rotational difference between two objects or bones, in radians. Distance Provides the value of the distance between two objects or bones. Value Shows the value of the variable. Expressions =========== Expression 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 :ref:`driver namespace example `. For performance reasons it is best to use the `Simple Expressions`_ subset as much as possible. Use Self If this option is enabled, the variable ``self`` can be used for drivers to reference their own data. Useful for objects and bones to avoid having creating a *Driver Variable* pointing to itself. Example: ``self.location.x`` applied to the Y rotation property of the same object will make the object tumble when moving. Note that dependencies for properties accessed via ``self`` may not be fully tracked. .. _drivers-simple-expressions: Simple Expressions ------------------ Blender can evaluate a useful subset of Python driver expressions directly, which significantly improves performance, especially on multi-core systems. To take advantage of this, the driver expression must only use the following features: Variable Names Use only ASCII characters. Literals Floating point and decimal integer. Globals ``frame`` Constants ``pi``, ``True``, ``False`` Operators ``+``, ``-``, ``*``, ``/``, ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``, ``and``, ``or``, ``not``, conditional operator/ ternary if Functions ``min``, ``max``, ``radians``, ``degrees``, ``abs``, ``fabs``, ``floor``, ``ceil``, ``trunc``, ``int``, ``sin``, ``cos``, ``tan``, ``asin``, ``acos``, ``atan``, ``atan2``, ``exp``, ``log``, ``sqrt``, ``pow``, ``fmod`` Simple expressions are evaluated even when Python script execution is disabled. 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. .. seealso:: - :ref:`Extending Blender with Python `. - `Python `__ and its `documentation `__. - `functions.wolfram.com `__.