Blender V5.3
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
11#include "DNA_listBase.h"
12
13namespace blender {
14
16struct ChannelDriver;
17struct DriverTarget;
18struct DriverVar;
19struct FCurve;
20struct ListBase;
21struct PathResolvedRNA;
22struct PointerRNA;
23struct PropertyRNA;
24struct Scene;
25struct ViewLayer;
26
27enum eDriverVar_Types : char;
28
29/* ************** F-Curve Drivers ***************** */
30
31/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
32 * accessed directly from the code using them, but it is not recommended that their
33 * values be changed to point at other slots...
34 */
35
36/* convenience looper over ALL driver targets for a given variable (even the unused ones) */
37#define DRIVER_TARGETS_LOOPER_BEGIN(dvar) \
38 { \
39 auto *dtar = &(dvar)->targets[0]; \
40 int tarIndex = 0; \
41 for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
42
43/* convenience looper over USED driver targets only */
44#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar) \
45 { \
46 auto *dtar = &(dvar)->targets[0]; \
47 int tarIndex = 0; \
48 for (; tarIndex < (dvar)->num_targets; tarIndex++, dtar++)
49
50/* tidy up for driver targets loopers */
51#define DRIVER_TARGETS_LOOPER_END \
52 } \
53 ((void)0)
54
55/* ---------------------- */
56
60void fcurve_free_driver(struct FCurve *fcu);
64struct ChannelDriver *fcurve_copy_driver(const struct ChannelDriver *driver);
65
87bool driver_get_target_property(const DriverTargetContext *driver_target_context,
88 struct DriverVar *dvar,
89 struct DriverTarget *dtar,
90 struct PointerRNA *r_prop);
91
95void driver_variables_copy(ListBaseT<DriverVar> *dst_vars, const ListBaseT<DriverVar> *src_vars);
96
101 float mat[4][4], int auto_order, int rotation_mode, int channel, bool angles, float r_buf[4]);
102
106void driver_free_variable(ListBaseT<DriverVar> *variables, struct DriverVar *dvar);
110void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar);
111
126void driver_variable_unique_name(struct DriverVar *dvar);
130struct DriverVar *driver_add_new_variable(struct ChannelDriver *driver);
131
135float driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context,
136 struct ChannelDriver *driver,
137 struct DriverVar *dvar);
138
152
157 const struct AnimationEvalContext *anim_eval_context,
158 struct ChannelDriver *driver,
159 struct DriverVar *dvar,
160 struct DriverTarget *dtar,
161 struct PointerRNA *r_ptr,
162 struct PropertyRNA **r_prop,
163 int *r_index);
164
177 bool expr_changed,
178 bool varname_changed);
179
188float evaluate_driver(struct PathResolvedRNA *anim_rna,
189 struct ChannelDriver *driver,
190 struct ChannelDriver *driver_orig,
191 const struct AnimationEvalContext *anim_eval_context);
192
193} // namespace blender
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
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)
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])
struct ChannelDriver * fcurve_copy_driver(const struct ChannelDriver *driver)
void driver_free_variable_ex(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, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
bool driver_get_target_property(const DriverTargetContext *driver_target_context, struct DriverVar *dvar, struct DriverTarget *dtar, struct PointerRNA *r_prop)
@ DRIVER_VAR_PROPERTY_SUCCESS
@ DRIVER_VAR_PROPERTY_FALLBACK
@ DRIVER_VAR_PROPERTY_INVALID_INDEX
@ DRIVER_VAR_PROPERTY_INVALID
void driver_variable_name_validate(struct DriverVar *dvar)
float driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context, struct ChannelDriver *driver, struct DriverVar *dvar)
void driver_variable_unique_name(struct DriverVar *dvar)
bool BKE_driver_expression_depends_on_time(struct ChannelDriver *driver)
void fcurve_free_driver(struct FCurve *fcu)
bool BKE_driver_has_simple_expression(struct ChannelDriver *driver)
void driver_change_variable_type(struct DriverVar *dvar, eDriverVar_Types type)
void driver_variables_copy(ListBaseT< DriverVar > *dst_vars, const ListBaseT< DriverVar > *src_vars)
void driver_free_variable(ListBaseT< DriverVar > *variables, struct DriverVar *dvar)
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)