Blender  V3.3
BKE_fcurve_driver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation, Joshua Leung. All rights reserved. */
3 
4 #pragma once
5 
10 #include "DNA_curve_types.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
17 struct ChannelDriver;
18 struct DriverTarget;
19 struct DriverVar;
20 struct FCurve;
21 struct PathResolvedRNA;
22 struct PointerRNA;
23 struct PropertyRNA;
24 
25 /* ************** F-Curve Drivers ***************** */
26 
27 /* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
28  * accessed directly from the code using them, but it is not recommended that their
29  * values be changed to point at other slots...
30  */
31 
32 /* convenience looper over ALL driver targets for a given variable (even the unused ones) */
33 #define DRIVER_TARGETS_LOOPER_BEGIN(dvar) \
34  { \
35  DriverTarget *dtar = &dvar->targets[0]; \
36  int tarIndex = 0; \
37  for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
38 
39 /* convenience looper over USED driver targets only */
40 #define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar) \
41  { \
42  DriverTarget *dtar = &dvar->targets[0]; \
43  int tarIndex = 0; \
44  for (; tarIndex < dvar->num_targets; tarIndex++, dtar++)
45 
46 /* tidy up for driver targets loopers */
47 #define DRIVER_TARGETS_LOOPER_END \
48  } \
49  ((void)0)
50 
51 /* ---------------------- */
52 
56 void fcurve_free_driver(struct FCurve *fcu);
60 struct ChannelDriver *fcurve_copy_driver(const struct ChannelDriver *driver);
61 
65 void driver_variables_copy(struct ListBase *dst_vars, const struct ListBase *src_vars);
66 
71  float mat[4][4], int auto_order, int rotation_mode, int channel, bool angles, float r_buf[4]);
72 
76 void driver_free_variable(struct ListBase *variables, struct DriverVar *dvar);
80 void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar);
81 
85 void driver_change_variable_type(struct DriverVar *dvar, int type);
90 void driver_variable_name_validate(struct DriverVar *dvar);
97 void driver_variable_unique_name(struct DriverVar *dvar);
101 struct DriverVar *driver_add_new_variable(struct ChannelDriver *driver);
102 
106 float driver_get_variable_value(struct ChannelDriver *driver, struct DriverVar *dvar);
110 bool driver_get_variable_property(struct ChannelDriver *driver,
111  struct DriverTarget *dtar,
112  struct PointerRNA *r_ptr,
113  struct PropertyRNA **r_prop,
114  int *r_index);
115 
128  bool expr_changed,
129  bool varname_changed);
130 
139 float evaluate_driver(struct PathResolvedRNA *anim_rna,
140  struct ChannelDriver *driver,
141  struct ChannelDriver *driver_orig,
142  const struct AnimationEvalContext *anim_eval_context);
143 
144 #ifdef __cplusplus
145 }
146 #endif
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)
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)
bool driver_get_variable_property(struct ChannelDriver *driver, struct DriverTarget *dtar, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
float driver_get_variable_value(struct ChannelDriver *driver, struct DriverVar *dvar)
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)
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)
void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar)
void fcurve_free_driver(struct FCurve *fcu)
void driver_free_variable(struct ListBase *variables, struct DriverVar *dvar)
void driver_change_variable_type(struct DriverVar *dvar, int type)
void driver_variable_name_validate(struct DriverVar *dvar)
struct ChannelDriver * fcurve_copy_driver(const struct ChannelDriver *driver)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
ListBase variables