43 #include "RNA_prototypes.h"
51 const char rna_path[],
52 const int array_index,
141 const char dst_path[],
144 const char src_path[],
203 if (
ELEM(src_ptr->
type, &RNA_Object, &RNA_PoseBone) &&
204 (
STREQ(prop_name,
"location") ||
STREQ(prop_name,
"scale") ||
217 if (src_ptr->
type == &RNA_PoseBone) {
222 if (
STREQ(prop_name,
"location")) {
223 if (src_index == 2) {
226 else if (src_index == 1) {
233 else if (
STREQ(prop_name,
"scale")) {
234 if (src_index == 2) {
237 else if (src_index == 1) {
248 if (src_index == 2) {
251 else if (src_index == 1) {
278 return (fcu !=
NULL);
283 const char dst_path[],
286 const char src_path[],
305 "Could not add driver, as RNA path is invalid for the given ID (ID = %s, path = %s)",
320 switch (mapping_type) {
328 int len =
MIN2(dst_len, src_len);
330 for (
int i = 0; i <
len; i++) {
352 for (
int i = 0; i <
len; i++) {
410 "Could not add driver, as RNA path is invalid for the given ID (ID = %s, path = %s)",
427 array_index_max += 1;
469 BLI_snprintf(expression, maxlen,
"%s%s", dvar_prefix, (val) ?
"True" :
"False");
479 BLI_snprintf(expression, maxlen,
"%s%d", dvar_prefix, val);
489 BLI_snprintf(expression, maxlen,
"%s%.3f", dvar_prefix, fval);
510 done_tot += (fcu !=
NULL);
525 bool success =
false;
537 fcu_iter = fcu->
next;
599 "Could not find driver to copy, as RNA path is invalid for the given ID (ID = %s, "
648 "Could not paste driver, as RNA path is invalid for the given ID (ID = %s, path = %s)",
683 return (fcu !=
NULL);
807 target->
id = target_id;
815 for (
int i = 0; var->
name[i]; i++) {
816 if (!(i > 0 ? isalnum(var->
name[i]) : isalpha(var->
name[i]))) {
841 "Drive all components of this property using the target picked"},
845 "Single from Target",
846 "Drive this component of this property using the target picked"},
852 "Create drivers for each pair of corresponding elements"},
857 "Manually Create Later",
858 "Create drivers for all properties without assigning any targets yet"},
862 "Manually Create Later (Single)",
863 "Create driver for this property only and without assigning any targets yet"},
891 while (
input->identifier) {
916 bool driven, special;
1009 ot->
name =
"Add Driver Menu";
1010 ot->
idname =
"ANIM_OT_driver_button_add_menu";
1011 ot->
description =
"Add driver(s) for the property(s) represented by the highlighted button";
1027 "Method used to match target and driven properties");
1046 bool changed =
false;
1074 ot->
idname =
"ANIM_OT_driver_button_add";
1075 ot->
description =
"Add driver for the property under the cursor";
1092 bool changed =
false;
1126 ot->
name =
"Remove Driver";
1127 ot->
idname =
"ANIM_OT_driver_button_remove";
1129 "Remove the driver(s) for the property(s) connected represented by the highlighted button";
1163 ot->
name =
"Edit Driver";
1164 ot->
idname =
"ANIM_OT_driver_button_edit";
1166 "Edit the drivers for the property connected represented by the highlighted button";
1182 bool changed =
false;
1208 ot->
name =
"Copy Driver";
1209 ot->
idname =
"ANIM_OT_copy_driver_button";
1210 ot->
description =
"Copy the driver for the highlighted button";
1226 bool changed =
false;
1258 ot->
name =
"Paste Driver";
1259 ot->
idname =
"ANIM_OT_paste_driver_button";
1260 ot->
description =
"Paste the driver in the copy/paste buffer for the highlighted button";
struct AnimData * BKE_animdata_ensure_id(struct ID *id)
struct AnimData * BKE_animdata_from_id(const struct ID *id)
struct Main * CTX_data_main(const bContext *C)
void copy_fmodifiers(ListBase *dst, const ListBase *src)
void BKE_fcurve_free(struct FCurve *fcu)
struct FCurve * BKE_fcurve_find_by_rna_context_ui(struct bContext *C, const struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct AnimData **r_animdata, struct bAction **r_action, bool *r_driven, bool *r_special)
struct FCurve * BKE_fcurve_copy(const struct FCurve *fcu)
struct FCurve * BKE_fcurve_iter_step(struct FCurve *fcu_iter, const char rna_path[])
void BKE_fcurve_handles_recalc(struct FCurve *fcu)
struct FModifier * add_fmodifier(ListBase *modifiers, int type, struct FCurve *owner_fcu)
struct FCurve * BKE_fcurve_create(void)
struct FCurve * BKE_fcurve_find(ListBase *list, const char rna_path[], int array_index)
void BKE_driver_invalidate_expression(struct ChannelDriver *driver, bool expr_changed, bool varname_changed)
void driver_variables_copy(struct ListBase *dst_vars, const struct ListBase *src_vars)
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)
void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar)
void driver_free_variable(struct ListBase *variables, struct DriverVar *dvar)
void driver_change_variable_type(struct DriverVar *dvar, int type)
struct ChannelDriver * fcurve_copy_driver(const struct ChannelDriver *driver)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
int BLI_str_rstrip_float_zero(char *str, char pad) ATTR_NONNULL()
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define UNUSED_FUNCTION(x)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
@ DVAR_TYPE_TRANSFORM_CHAN
@ FMODIFIER_TYPE_GENERATOR
@ FCURVE_EXTRAPOLATE_LINEAR
Object is a sort of wrapper for general info.
@ CREATEDRIVER_WITH_FMODIFIER
@ CREATEDRIVER_WITH_DEFAULT_DVAR
@ CREATEDRIVER_MAPPING_NONE_ALL
@ CREATEDRIVER_MAPPING_1_N
@ CREATEDRIVER_MAPPING_NONE
@ CREATEDRIVER_MAPPING_N_N
@ CREATEDRIVER_MAPPING_1_1
eDriverFCurveCreationMode
@ DRIVER_FCURVE_LOOKUP_ONLY
@ DRIVER_FCURVE_KEYFRAMES
@ DRIVER_FCURVE_GENERATOR
_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
Read Guarded memory(de)allocation.
uiBut * UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
int UI_popover_panel_invoke(struct bContext *C, const char *idname, bool keep_open, struct ReportList *reports)
void UI_context_update_anim_flag(const struct bContext *C)
__forceinline bool all(const avxb &b)
static int add_driver_button_none(bContext *C, wmOperator *op, short mapping_type)
void ANIM_copy_as_driver(struct ID *target_id, const char *target_path, const char *var_name)
void ANIM_OT_driver_button_remove(wmOperatorType *ot)
static int remove_driver_button_exec(bContext *C, wmOperator *op)
void ANIM_driver_vars_copybuf_free(void)
void ANIM_OT_driver_button_add(wmOperatorType *ot)
static void UNUSED_FUNCTION() ANIM_OT_driver_button_add_menu(wmOperatorType *ot)
static int edit_driver_button_exec(bContext *C, wmOperator *op)
static int add_driver_button_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void ANIM_OT_driver_button_edit(wmOperatorType *ot)
static int add_driver_button_menu_exec(bContext *C, wmOperator *op)
static bool add_driver_button_poll(bContext *C)
static int add_driver_with_target(ReportList *UNUSED(reports), ID *dst_id, const char dst_path[], int dst_index, ID *src_id, const char src_path[], int src_index, PointerRNA *dst_ptr, PropertyRNA *dst_prop, PointerRNA *src_ptr, PropertyRNA *src_prop, short flag, int driver_type)
bool ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
static const EnumPropertyItem * driver_mapping_type_itemf(bContext *C, PointerRNA *UNUSED(owner_ptr), PropertyRNA *UNUSED(owner_prop), bool *r_free)
bool ANIM_driver_vars_copy(ReportList *reports, FCurve *fcu)
bool ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
bool ANIM_driver_can_paste(void)
EnumPropertyItem prop_driver_create_mapping_types[]
int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
Main Driver Management API calls.
int ANIM_add_driver_with_target(ReportList *reports, ID *dst_id, const char dst_path[], int dst_index, ID *src_id, const char src_path[], int src_index, short flag, int driver_type, short mapping_type)
Main Driver Management API calls.
bool ANIM_driver_vars_paste(ReportList *reports, FCurve *fcu, bool replace)
void ANIM_OT_paste_driver_button(wmOperatorType *ot)
bool ANIM_driver_vars_can_paste(void)
bool ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
struct FCurve * alloc_driver_fcurve(const char rna_path[], const int array_index, eDriverFCurveCreationMode creation_mode)
static int add_driver_button_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void ANIM_OT_copy_driver_button(wmOperatorType *ot)
static ListBase driver_vars_copybuf
void ANIM_drivers_copybuf_free(void)
static int paste_driver_button_exec(bContext *C, wmOperator *op)
FCurve * verify_driver_fcurve(ID *id, const char rna_path[], const int array_index, eDriverFCurveCreationMode creation_mode)
static int copy_driver_button_exec(bContext *C, wmOperator *op)
static FCurve * channeldriver_copypaste_buf
ccl_global KernelShaderEvalInput * input
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
Main Key-framing API call.
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
const char * RNA_property_identifier(const PropertyRNA *prop)
bool RNA_property_animateable(const PointerRNA *ptr, PropertyRNA *prop)
PropertyUnit RNA_property_unit(PropertyRNA *prop)
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
PropertyType RNA_property_type(PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
char * RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
int WM_menu_invoke_ex(bContext *C, wmOperator *op, wmOperatorCallContext opcontext)