Blender V4.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
11#include "DNA_curve_types.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
18struct ChannelDriver;
19struct DriverTarget;
20struct DriverVar;
21struct FCurve;
22struct PathResolvedRNA;
23struct PointerRNA;
24struct PropertyRNA;
25struct Scene;
26struct ViewLayer;
27
28/* ************** F-Curve Drivers ***************** */
29
30/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
31 * accessed directly from the code using them, but it is not recommended that their
32 * values be changed to point at other slots...
33 */
34
35/* convenience looper over ALL driver targets for a given variable (even the unused ones) */
36#define DRIVER_TARGETS_LOOPER_BEGIN(dvar) \
37 { \
38 DriverTarget *dtar = &dvar->targets[0]; \
39 int tarIndex = 0; \
40 for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
41
42/* convenience looper over USED driver targets only */
43#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar) \
44 { \
45 DriverTarget *dtar = &dvar->targets[0]; \
46 int tarIndex = 0; \
47 for (; tarIndex < dvar->num_targets; tarIndex++, dtar++)
48
49/* tidy up for driver targets loopers */
50#define DRIVER_TARGETS_LOOPER_END \
51 } \
52 ((void)0)
53
54/* ---------------------- */
55
59void fcurve_free_driver(struct FCurve *fcu);
63struct ChannelDriver *fcurve_copy_driver(const struct ChannelDriver *driver);
64
86bool driver_get_target_property(const DriverTargetContext *driver_target_context,
87 struct DriverVar *dvar,
88 struct DriverTarget *dtar,
89 struct PointerRNA *r_prop);
90
94void driver_variables_copy(struct ListBase *dst_vars, const struct ListBase *src_vars);
95
100 float mat[4][4], int auto_order, int rotation_mode, int channel, bool angles, float r_buf[4]);
101
105void driver_free_variable(struct ListBase *variables, struct DriverVar *dvar);
109void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar);
110
114void driver_change_variable_type(struct DriverVar *dvar, int type);
125void driver_variable_unique_name(struct DriverVar *dvar);
129struct DriverVar *driver_add_new_variable(struct ChannelDriver *driver);
130
134float driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context,
135 struct ChannelDriver *driver,
136 struct DriverVar *dvar);
137
149
154 const struct AnimationEvalContext *anim_eval_context,
155 struct ChannelDriver *driver,
156 struct DriverVar *dvar,
157 struct DriverTarget *dtar,
158 bool allow_no_index,
159 struct PointerRNA *r_ptr,
160 struct PropertyRNA **r_prop,
161 int *r_index);
162
175 bool expr_changed,
176 bool varname_changed);
177
186float evaluate_driver(struct PathResolvedRNA *anim_rna,
187 struct ChannelDriver *driver,
188 struct ChannelDriver *driver_orig,
189 const struct AnimationEvalContext *anim_eval_context);
190
191#ifdef __cplusplus
192}
193#endif
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)
struct DriverTargetContext DriverTargetContext
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