Blender V4.3
BKE_fcurve_driver.h File Reference
#include "DNA_curve_types.h"

Go to the source code of this file.

Classes

struct  DriverTargetContext
 

Macros

#define DRIVER_TARGETS_LOOPER_BEGIN(dvar)
 
#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
 
#define DRIVER_TARGETS_LOOPER_END
 

Typedefs

typedef struct DriverTargetContext DriverTargetContext
 
typedef enum eDriverVariablePropertyResult eDriverVariablePropertyResult
 

Enumerations

enum  eDriverVariablePropertyResult { DRIVER_VAR_PROPERTY_SUCCESS , DRIVER_VAR_PROPERTY_FALLBACK , DRIVER_VAR_PROPERTY_INVALID , DRIVER_VAR_PROPERTY_INVALID_INDEX }
 

Functions

void fcurve_free_driver (struct FCurve *fcu)
 
struct ChannelDriverfcurve_copy_driver (const struct ChannelDriver *driver)
 
bool driver_get_target_property (const DriverTargetContext *driver_target_context, struct DriverVar *dvar, struct DriverTarget *dtar, struct PointerRNA *r_prop)
 
void driver_variables_copy (struct ListBase *dst_vars, const struct ListBase *src_vars)
 
void BKE_driver_target_matrix_to_rot_channels (float mat[4][4], int auto_order, int rotation_mode, int channel, bool angles, float r_buf[4])
 
void driver_free_variable (struct ListBase *variables, struct DriverVar *dvar)
 
void driver_free_variable_ex (struct ChannelDriver *driver, struct DriverVar *dvar)
 
void driver_change_variable_type (struct DriverVar *dvar, int type)
 
void driver_variable_name_validate (struct DriverVar *dvar)
 
void driver_variable_unique_name (struct DriverVar *dvar)
 
struct DriverVardriver_add_new_variable (struct ChannelDriver *driver)
 
float driver_get_variable_value (const struct AnimationEvalContext *anim_eval_context, struct ChannelDriver *driver, struct DriverVar *dvar)
 
eDriverVariablePropertyResult driver_get_variable_property (const struct AnimationEvalContext *anim_eval_context, struct ChannelDriver *driver, struct DriverVar *dvar, struct DriverTarget *dtar, bool allow_no_index, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
 
bool BKE_driver_has_simple_expression (struct ChannelDriver *driver)
 
bool BKE_driver_expression_depends_on_time (struct ChannelDriver *driver)
 
void BKE_driver_invalidate_expression (struct ChannelDriver *driver, bool expr_changed, bool varname_changed)
 
float evaluate_driver (struct PathResolvedRNA *anim_rna, struct ChannelDriver *driver, struct ChannelDriver *driver_orig, const struct AnimationEvalContext *anim_eval_context)
 

Macro Definition Documentation

◆ DRIVER_TARGETS_LOOPER_BEGIN

#define DRIVER_TARGETS_LOOPER_BEGIN ( dvar)
Value:
{ \
DriverTarget *dtar = &dvar->targets[0]; \
int tarIndex = 0; \
for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
#define MAX_DRIVER_TARGETS

Definition at line 36 of file BKE_fcurve_driver.h.

Referenced by BKE_fcurve_blend_read_data(), do_version_bbone_easing_fcurve_fix(), do_version_bbone_len_scale_fcurve_fix(), do_version_bbone_scale_fcurve_fix(), driver_free_variable(), and driver_variables_copy().

◆ DRIVER_TARGETS_LOOPER_END

◆ DRIVER_TARGETS_USED_LOOPER_BEGIN

Typedef Documentation

◆ DriverTargetContext

typedef struct DriverTargetContext DriverTargetContext

Get property from which the specific property can be found from.

This depends on the type of dvar:

  • For the Single Property the r_prop is a pointer to an ID, which is used to resolve the target rna_path.
  • For Transform Channel, Rotational Difference, Distance the r_prop is a pointer to an object from which transformation is read.
  • For Context Property the r_prop points to a resolved data corresponding to the dtar->context_property accessed from the given evaluated context. This could either be an ID property for Active Scene, or a data property for Active View Layer.

If the target property can not be resolved false is returned.

◆ eDriverVariablePropertyResult

Enumeration Type Documentation

◆ eDriverVariablePropertyResult

Enumerator
DRIVER_VAR_PROPERTY_SUCCESS 

The property reference has been successfully resolved and can be accessed.

DRIVER_VAR_PROPERTY_FALLBACK 

Evaluation should use the fallback value.

DRIVER_VAR_PROPERTY_INVALID 

The target property could not be resolved.

DRIVER_VAR_PROPERTY_INVALID_INDEX 

The property was resolved (output parameters are set), but the array index is out of bounds.

Definition at line 138 of file BKE_fcurve_driver.h.

Function Documentation

◆ BKE_driver_expression_depends_on_time()

bool BKE_driver_expression_depends_on_time ( struct ChannelDriver * driver)

◆ BKE_driver_has_simple_expression()

bool BKE_driver_has_simple_expression ( struct ChannelDriver * driver)

Check if the expression in the driver conforms to the simple subset.

Definition at line 1222 of file fcurve_driver.cc.

References BLI_expr_pylike_is_valid(), driver_compile_simple_expr(), and ChannelDriver::expr_simple.

Referenced by BKE_driver_expression_depends_on_time(), and graph_draw_driver_settings_panel().

◆ BKE_driver_invalidate_expression()

void BKE_driver_invalidate_expression ( struct ChannelDriver * driver,
bool expr_changed,
bool varname_changed )

◆ BKE_driver_target_matrix_to_rot_channels()

void BKE_driver_target_matrix_to_rot_channels ( float mat[4][4],
int auto_order,
int rotation_mode,
int channel,
bool angles,
float r_buf[4] )

◆ driver_add_new_variable()

◆ driver_change_variable_type()

◆ driver_free_variable()

void driver_free_variable ( struct ListBase * variables,
struct DriverVar * dvar )

Perform actual freeing driver variable and remove it from the given list.

Definition at line 858 of file fcurve_driver.cc.

References BLI_freelinkN(), DRIVER_TARGETS_LOOPER_BEGIN, DRIVER_TARGETS_LOOPER_END, and MEM_freeN().

Referenced by ANIM_driver_vars_copybuf_free(), and driver_free_variable_ex().

◆ driver_free_variable_ex()

void driver_free_variable_ex ( struct ChannelDriver * driver,
struct DriverVar * dvar )

Free the driver variable and do extra updates.

Definition at line 882 of file fcurve_driver.cc.

References BKE_driver_invalidate_expression(), driver_free_variable(), and ChannelDriver::variables.

Referenced by ANIM_driver_vars_paste(), driver_delete_var_cb(), and fcurve_free_driver().

◆ driver_get_target_property()

◆ driver_get_variable_property()

eDriverVariablePropertyResult driver_get_variable_property ( const struct AnimationEvalContext * anim_eval_context,
struct ChannelDriver * driver,
struct DriverVar * dvar,
struct DriverTarget * dtar,
bool allow_no_index,
struct PointerRNA * r_ptr,
struct PropertyRNA ** r_prop,
int * r_index )

Same as 'dtar_get_prop_val'. but get the RNA property.

Referenced by pyrna_driver_get_variable_value().

◆ driver_get_variable_value()

float driver_get_variable_value ( const struct AnimationEvalContext * anim_eval_context,
struct ChannelDriver * driver,
struct DriverVar * dvar )

Evaluate a Driver Variable to get a value that contributes to the final.

Referenced by BPY_driver_exec().

◆ driver_variable_name_validate()

◆ driver_variable_unique_name()

void driver_variable_unique_name ( struct DriverVar * dvar)

Ensure the driver variable's name is unique.

Assumes the driver variable has already been assigned to the driver, so that the prev/next pointers can be used to find the other variables.

Definition at line 1006 of file fcurve_driver.cc.

References BLI_listbase_from_link(), BLI_uniquename(), DriverVar::name, and offsetof.

◆ driver_variables_copy()

void driver_variables_copy ( struct ListBase * dst_vars,
const struct ListBase * src_vars )

Copy driver variables from src_vars list to dst_vars list.

Referenced by ANIM_copy_as_driver(), ANIM_driver_vars_copy(), and ANIM_driver_vars_paste().

◆ evaluate_driver()

float evaluate_driver ( struct PathResolvedRNA * anim_rna,
struct ChannelDriver * driver,
struct ChannelDriver * driver_orig,
const struct AnimationEvalContext * anim_eval_context )

Evaluate an Channel-Driver to get a 'time' value to use instead of anim_eval_context->eval_time.

  • anim_eval_context->eval_time is the frame at which F-Curve is being evaluated.
  • Has to return a float value.
  • driver_orig is where we cache Python expressions, in case of copy-on-eval

Referenced by blender::animrig::evaluate_driver_from_rna_pointer(), and evaluate_fcurve_driver().

◆ fcurve_copy_driver()

struct ChannelDriver * fcurve_copy_driver ( const struct ChannelDriver * driver)

This makes a copy of the given driver.

Referenced by ANIM_paste_driver(), and BKE_fcurve_copy().

◆ fcurve_free_driver()