Blender V5.0
BKE_fcurve_driver.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
12struct ChannelDriver;
13struct DriverTarget;
14struct DriverVar;
15struct FCurve;
16struct PathResolvedRNA;
17struct PointerRNA;
18struct PropertyRNA;
19struct Scene;
20struct ViewLayer;
21
22/* ************** F-Curve Drivers ***************** */
23
24/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
25 * accessed directly from the code using them, but it is not recommended that their
26 * values be changed to point at other slots...
27 */
28
29/* convenience looper over ALL driver targets for a given variable (even the unused ones) */
30#define DRIVER_TARGETS_LOOPER_BEGIN(dvar) \
31 { \
32 DriverTarget *dtar = &dvar->targets[0]; \
33 int tarIndex = 0; \
34 for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
35
36/* convenience looper over USED driver targets only */
37#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar) \
38 { \
39 DriverTarget *dtar = &dvar->targets[0]; \
40 int tarIndex = 0; \
41 for (; tarIndex < dvar->num_targets; tarIndex++, dtar++)
42
43/* tidy up for driver targets loopers */
44#define DRIVER_TARGETS_LOOPER_END \
45 } \
46 ((void)0)
47
48/* ---------------------- */
49
53void fcurve_free_driver(struct FCurve *fcu);
57struct ChannelDriver *fcurve_copy_driver(const struct ChannelDriver *driver);
58
80bool driver_get_target_property(const DriverTargetContext *driver_target_context,
81 struct DriverVar *dvar,
82 struct DriverTarget *dtar,
83 struct PointerRNA *r_prop);
84
88void driver_variables_copy(struct ListBase *dst_vars, const struct ListBase *src_vars);
89
94 float mat[4][4], int auto_order, int rotation_mode, int channel, bool angles, float r_buf[4]);
95
99void driver_free_variable(struct ListBase *variables, struct DriverVar *dvar);
103void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar);
104
108void driver_change_variable_type(struct DriverVar *dvar, int type);
119void driver_variable_unique_name(struct DriverVar *dvar);
123struct DriverVar *driver_add_new_variable(struct ChannelDriver *driver);
124
128float driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context,
129 struct ChannelDriver *driver,
130 struct DriverVar *dvar);
131
145
150 const struct AnimationEvalContext *anim_eval_context,
151 struct ChannelDriver *driver,
152 struct DriverVar *dvar,
153 struct DriverTarget *dtar,
154 bool allow_no_index,
155 struct PointerRNA *r_ptr,
156 struct PropertyRNA **r_prop,
157 int *r_index);
158
171 bool expr_changed,
172 bool varname_changed);
173
182float evaluate_driver(struct PathResolvedRNA *anim_rna,
183 struct ChannelDriver *driver,
184 struct ChannelDriver *driver_orig,
185 const struct AnimationEvalContext *anim_eval_context);
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)
float evaluate_driver(struct PathResolvedRNA *anim_rna, struct ChannelDriver *driver, struct ChannelDriver *driver_orig, const struct AnimationEvalContext *anim_eval_context)
void driver_variable_unique_name(struct DriverVar *dvar)
struct ChannelDriver * fcurve_copy_driver(const struct ChannelDriver *driver)
void BKE_driver_invalidate_expression(struct ChannelDriver *driver, bool expr_changed, bool varname_changed)
bool BKE_driver_has_simple_expression(struct ChannelDriver *driver)
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])
bool BKE_driver_expression_depends_on_time(struct ChannelDriver *driver)
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)
void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar)
eDriverVariablePropertyResult
@ DRIVER_VAR_PROPERTY_SUCCESS
@ DRIVER_VAR_PROPERTY_FALLBACK
@ DRIVER_VAR_PROPERTY_INVALID_INDEX
@ DRIVER_VAR_PROPERTY_INVALID
void fcurve_free_driver(struct FCurve *fcu)
bool driver_get_target_property(const DriverTargetContext *driver_target_context, struct DriverVar *dvar, struct DriverTarget *dtar, struct PointerRNA *r_prop)
void driver_free_variable(struct ListBase *variables, struct DriverVar *dvar)
float driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context, struct ChannelDriver *driver, struct DriverVar *dvar)
void driver_change_variable_type(struct DriverVar *dvar, int type)
void driver_variable_name_validate(struct DriverVar *dvar)
struct ViewLayer * view_layer