|
Blender
V2.93
|
#include <ctype.h>#include <stdio.h>#include <string.h>#include "MEM_guardedalloc.h"#include "BLI_blenlib.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "DNA_anim_types.h"#include "DNA_object_types.h"#include "DNA_texture_types.h"#include "BKE_anim_data.h"#include "BKE_animsys.h"#include "BKE_context.h"#include "BKE_fcurve.h"#include "BKE_fcurve_driver.h"#include "BKE_report.h"#include "DEG_depsgraph.h"#include "DEG_depsgraph_build.h"#include "ED_keyframing.h"#include "UI_interface.h"#include "UI_resources.h"#include "WM_api.h"#include "WM_types.h"#include "RNA_access.h"#include "RNA_define.h"#include "anim_intern.h"Go to the source code of this file.
Functions | |
| FCurve * | verify_driver_fcurve (ID *id, const char rna_path[], const int array_index, eDriverFCurveCreationMode creation_mode) |
| struct FCurve * | alloc_driver_fcurve (const char rna_path[], const int array_index, eDriverFCurveCreationMode creation_mode) |
| 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) |
| 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) |
| int | ANIM_add_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type) |
| bool | ANIM_remove_driver (ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag)) |
| void | ANIM_drivers_copybuf_free (void) |
| bool | ANIM_driver_can_paste (void) |
| bool | ANIM_copy_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag)) |
| bool | ANIM_paste_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag)) |
| void | ANIM_driver_vars_copybuf_free (void) |
| bool | ANIM_driver_vars_can_paste (void) |
| bool | ANIM_driver_vars_copy (ReportList *reports, FCurve *fcu) |
| bool | ANIM_driver_vars_paste (ReportList *reports, FCurve *fcu, bool replace) |
| void | ANIM_copy_as_driver (struct ID *target_id, const char *target_path, const char *var_name) |
| static const EnumPropertyItem * | driver_mapping_type_itemsf (bContext *C, PointerRNA *UNUSED(owner_ptr), PropertyRNA *UNUSED(owner_prop), bool *r_free) |
| static bool | add_driver_button_poll (bContext *C) |
| static int | add_driver_button_none (bContext *C, wmOperator *op, short mapping_type) |
| static int | add_driver_button_menu_exec (bContext *C, wmOperator *op) |
| static int | add_driver_button_menu_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) |
| static void UNUSED_FUNCTION() | ANIM_OT_driver_button_add_menu (wmOperatorType *ot) |
| static int | add_driver_button_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) |
| void | ANIM_OT_driver_button_add (wmOperatorType *ot) |
| static int | remove_driver_button_exec (bContext *C, wmOperator *op) |
| void | ANIM_OT_driver_button_remove (wmOperatorType *ot) |
| static int | edit_driver_button_exec (bContext *C, wmOperator *op) |
| void | ANIM_OT_driver_button_edit (wmOperatorType *ot) |
| static int | copy_driver_button_exec (bContext *C, wmOperator *op) |
| void | ANIM_OT_copy_driver_button (wmOperatorType *ot) |
| static int | paste_driver_button_exec (bContext *C, wmOperator *op) |
| void | ANIM_OT_paste_driver_button (wmOperatorType *ot) |
Variables | |
| static FCurve * | channeldriver_copypaste_buf = NULL |
| static ListBase | driver_vars_copybuf = {NULL, NULL} |
| EnumPropertyItem | prop_driver_create_mapping_types [] |
|
static |
Definition at line 1088 of file drivers.c.
References ANIM_add_driver(), BKE_animdata_driver_path_hack(), C, CREATEDRIVER_WITH_DEFAULT_DVAR, CTX_data_main(), PointerRNA::data, DEG_id_tag_update(), DEG_relations_tag_update(), DRIVER_TYPE_PYTHON, ID_RECALC_COPY_ON_WRITE, MEM_freeN, NC_ANIMATION, ND_FCURVES_ORDER, NULL, OPERATOR_INTERFACE, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_property_animateable(), UI_context_active_but_prop_get(), UI_context_update_anim_flag(), UI_popover_panel_invoke(), and WM_event_add_notifier().
Referenced by ANIM_OT_driver_button_add().
|
static |
Definition at line 1026 of file drivers.c.
References add_driver_button_none(), C, CREATEDRIVER_MAPPING_NONE, CREATEDRIVER_MAPPING_NONE_ALL, ELEM, OPERATOR_FINISHED, ot, wmOperator::ptr, RNA_enum_get(), WM_OP_INVOKE_DEFAULT, WM_operator_name_call_ptr(), and WM_operatortype_find().
Referenced by add_driver_button_menu_invoke(), and ANIM_OT_driver_button_add_menu().
|
static |
Definition at line 1045 of file drivers.c.
References add_driver_button_menu_exec(), C, wmOperator::ptr, RNA_property_is_set(), RNA_struct_find_property(), WM_menu_invoke_ex(), and WM_OP_INVOKE_DEFAULT.
Referenced by ANIM_OT_driver_button_add_menu().
|
static |
Definition at line 991 of file drivers.c.
References ANIM_add_driver(), BKE_animdata_driver_path_hack(), C, CREATEDRIVER_MAPPING_NONE_ALL, CREATEDRIVER_WITH_DEFAULT_DVAR, CTX_data_main(), PointerRNA::data, DEG_relations_tag_update(), DRIVER_TYPE_PYTHON, MEM_freeN, NC_ANIMATION, ND_FCURVES_ORDER, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_property_animateable(), UI_context_active_but_prop_get(), UI_context_update_anim_flag(), and WM_event_add_notifier().
Referenced by add_driver_button_menu_exec().
|
static |
Definition at line 966 of file drivers.c.
References BKE_fcurve_find_by_rna_context_ui(), C, PointerRNA::data, FCurve::driver, NULL, PointerRNA::owner_id, ptr, RNA_property_animateable(), and UI_context_active_but_prop_get().
Referenced by ANIM_OT_driver_button_add(), and ANIM_OT_driver_button_add_menu().
|
static |
Definition at line 156 of file drivers.c.
References BLI_sprintfN(), BLI_strdup(), BLI_strncpy(), CREATEDRIVER_WITH_FMODIFIER, PointerRNA::data, FCurve::driver, driver_add_new_variable(), driver_change_variable_type(), DRIVER_FCURVE_GENERATOR, DRIVER_FCURVE_KEYFRAMES, DTAR_TRANSCHAN_LOCX, DTAR_TRANSCHAN_LOCY, DTAR_TRANSCHAN_LOCZ, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ, DTAR_TRANSCHAN_SCALEX, DTAR_TRANSCHAN_SCALEY, DTAR_TRANSCHAN_SCALEZ, DVAR_TYPE_TRANSFORM_CHAN, ELEM, ChannelDriver::expression, FCurve::flag, GS, DriverTarget::id, DriverTarget::idtype, ID::name, NULL, DriverTarget::pchan_name, PROP_UNIT_ROTATION, RNA_Object, DriverTarget::rna_path, RNA_PoseBone, RNA_property_array_check(), RNA_property_identifier(), RNA_property_unit(), RNA_string_get(), STREQ, STRPREFIX, DriverVar::targets, DriverTarget::transChan, ChannelDriver::type, PointerRNA::type, and verify_driver_fcurve().
Referenced by ANIM_add_driver_with_target().
| struct FCurve* alloc_driver_fcurve | ( | const char | rna_path[], |
| const int | array_index, | ||
| eDriverFCurveCreationMode | creation_mode | ||
| ) |
Definition at line 108 of file drivers.c.
References add_fmodifier(), FCurve::array_index, FCurve::auto_smoothing, BEZT_KEYTYPE_KEYFRAME, BKE_fcurve_create(), BLI_strdup(), calchandles_fcurve(), FCurve::driver, DRIVER_FCURVE_EMPTY, DRIVER_FCURVE_GENERATOR, DRIVER_FCURVE_LOOKUP_ONLY, ELEM, FCurve::extend, FCURVE_EXTRAPOLATE_LINEAR, FCURVE_SELECTED, FCURVE_VISIBLE, FCurve::flag, FMODIFIER_TYPE_GENERATOR, insert_vert_fcurve(), INSERTKEY_FAST, INSERTKEY_NO_USERPREF, MEM_callocN, FCurve::modifiers, and FCurve::rna_path.
Referenced by ANIM_copy_as_driver(), and verify_driver_fcurve().
| int ANIM_add_driver | ( | ReportList * | reports, |
| ID * | id, | ||
| const char | rna_path[], | ||
| int | array_index, | ||
| short | flag, | ||
| int | type | ||
| ) |
Main Driver Management API calls: Add a new driver for the specified property on the given ID block
Definition at line 427 of file drivers.c.
References FCurve::array_index, BKE_reportf(), BLI_snprintf(), BLI_str_rstrip_float_zero(), BLI_strncpy(), CREATEDRIVER_WITH_DEFAULT_DVAR, CREATEDRIVER_WITH_FMODIFIER, FCurve::driver, driver_add_new_variable(), driver_change_variable_type(), DRIVER_TYPE_PYTHON, DVAR_TYPE_TRANSFORM_CHAN, ChannelDriver::expression, FCurve::flag, id, ID::name, NULL, PROP_BOOLEAN, PROP_FLOAT, PROP_INT, ptr, RNA_id_pointer_create(), FCurve::rna_path, RNA_path_resolve_property(), RNA_property_array_length(), RNA_property_boolean_get(), RNA_property_boolean_get_index(), RNA_property_float_get(), RNA_property_float_get_index(), RNA_property_int_get(), RNA_property_int_get_index(), RNA_property_type(), RPT_ERROR, type, ChannelDriver::type, and verify_driver_fcurve().
Referenced by add_driver_button_invoke(), add_driver_button_none(), ANIM_add_driver_with_target(), do_outliner_drivers_editop(), and pyrna_struct_driver_add().
| 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 | ||
| ) |
Definition at line 309 of file drivers.c.
References add_driver_with_target(), ANIM_add_driver(), BKE_reportf(), CREATEDRIVER_MAPPING_1_1, CREATEDRIVER_MAPPING_1_N, CREATEDRIVER_MAPPING_N_N, CREATEDRIVER_MAPPING_NONE, CREATEDRIVER_WITH_DEFAULT_DVAR, FCurve::flag, len, MIN2, ID::name, ptr, RNA_id_pointer_create(), RNA_path_resolve_property(), RNA_property_array_check(), RNA_property_array_length(), and RPT_ERROR.
Referenced by driverdropper_sample().
| void ANIM_copy_as_driver | ( | struct ID * | target_id, |
| const char * | target_path, | ||
| const char * | var_name | ||
| ) |
Definition at line 842 of file drivers.c.
References alloc_driver_fcurve(), ANIM_driver_vars_copybuf_free(), ANIM_drivers_copybuf_free(), BLI_strncpy(), channeldriver_copypaste_buf, FCurve::driver, driver_add_new_variable(), DRIVER_FCURVE_KEYFRAMES, driver_variables_copy(), driver_vars_copybuf, ChannelDriver::expression, GS, DriverTarget::id, DriverTarget::idtype, MEM_dupallocN, DriverVar::name, ID::name, NULL, DriverTarget::rna_path, DriverVar::targets, and ChannelDriver::variables.
Referenced by copy_as_driver_button_exec().
| bool ANIM_copy_driver | ( | ReportList * | reports, |
| ID * | id, | ||
| const char | rna_path[], | ||
| int | array_index, | ||
| short | UNUSEDflag | ||
| ) |
Definition at line 627 of file drivers.c.
References ANIM_drivers_copybuf_free(), FCurve::array_index, BKE_fcurve_copy(), BKE_reportf(), channeldriver_copypaste_buf, FCurve::driver, DRIVER_FCURVE_LOOKUP_ONLY, id, ID::name, NULL, ptr, RNA_id_pointer_create(), FCurve::rna_path, RNA_path_resolve_property(), RPT_ERROR, and verify_driver_fcurve().
Referenced by copy_driver_button_exec().
| bool ANIM_driver_can_paste | ( | void | ) |
Definition at line 617 of file drivers.c.
References channeldriver_copypaste_buf, and NULL.
Referenced by ui_popup_context_menu_for_button().
| bool ANIM_driver_vars_can_paste | ( | void | ) |
Definition at line 754 of file drivers.c.
References BLI_listbase_is_empty(), and driver_vars_copybuf.
| bool ANIM_driver_vars_copy | ( | ReportList * | reports, |
| FCurve * | fcu | ||
| ) |
Definition at line 762 of file drivers.c.
References ANIM_driver_vars_copybuf_free(), BKE_report(), BLI_listbase_is_empty(), FCurve::driver, driver_variables_copy(), driver_vars_copybuf, ELEM, NULL, RPT_ERROR, and ChannelDriver::variables.
Referenced by graph_driver_vars_copy_exec().
| void ANIM_driver_vars_copybuf_free | ( | void | ) |
Definition at line 737 of file drivers.c.
References BLI_listbase_clear(), driver_free_variable(), driver_vars_copybuf, ListBase::first, and DriverVar::next.
Referenced by ANIM_copy_as_driver(), ANIM_driver_vars_copy(), and WM_exit_ex().
| bool ANIM_driver_vars_paste | ( | ReportList * | reports, |
| FCurve * | fcu, | ||
| bool | replace | ||
| ) |
Definition at line 785 of file drivers.c.
References FCurve::driver, and NULL.
Referenced by graph_driver_vars_paste_exec().
| void ANIM_drivers_copybuf_free | ( | void | ) |
Definition at line 607 of file drivers.c.
References BKE_fcurve_free(), channeldriver_copypaste_buf, and NULL.
Referenced by ANIM_copy_as_driver(), ANIM_copy_driver(), and WM_exit_ex().
| void ANIM_OT_copy_driver_button | ( | wmOperatorType * | ot | ) |
Definition at line 1260 of file drivers.c.
References copy_driver_button_exec(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_anim().
| void ANIM_OT_driver_button_add | ( | wmOperatorType * | ot | ) |
Definition at line 1125 of file drivers.c.
References add_driver_button_invoke(), add_driver_button_poll(), wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_INTERNAL, OPTYPE_UNDO, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_anim().
|
static |
Definition at line 1061 of file drivers.c.
References add_driver_button_menu_exec(), add_driver_button_menu_invoke(), add_driver_button_poll(), wmOperatorType::description, driver_mapping_type_itemsf(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_INTERNAL, OPTYPE_UNDO, ot, wmOperatorType::poll, wmOperatorType::prop, prop_driver_create_mapping_types, RNA_def_enum(), RNA_def_enum_funcs(), and wmOperatorType::srna.
| void ANIM_OT_driver_button_edit | ( | wmOperatorType * | ot | ) |
Definition at line 1215 of file drivers.c.
References wmOperatorType::description, edit_driver_button_exec(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_anim().
| void ANIM_OT_driver_button_remove | ( | wmOperatorType * | ot | ) |
Definition at line 1178 of file drivers.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_INTERNAL, OPTYPE_UNDO, ot, remove_driver_button_exec(), RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_anim().
| void ANIM_OT_paste_driver_button | ( | wmOperatorType * | ot | ) |
Definition at line 1310 of file drivers.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_INTERNAL, OPTYPE_UNDO, ot, and paste_driver_button_exec().
Referenced by ED_operatortypes_anim().
| bool ANIM_paste_driver | ( | ReportList * | reports, |
| ID * | id, | ||
| const char | rna_path[], | ||
| int | array_index, | ||
| short | UNUSEDflag | ||
| ) |
Definition at line 679 of file drivers.c.
References FCurve::array_index, FCurve::bezt, BKE_report(), BKE_reportf(), channeldriver_copypaste_buf, copy_fmodifiers(), FCurve::driver, DRIVER_FCURVE_EMPTY, FCurve::extend, fcurve_copy_driver(), FCurve::fpt, id, MEM_dupallocN, FCurve::modifiers, ID::name, NULL, ptr, RNA_id_pointer_create(), FCurve::rna_path, RNA_path_resolve_property(), RPT_ERROR, FCurve::totvert, and verify_driver_fcurve().
Referenced by paste_driver_button_exec().
| bool ANIM_remove_driver | ( | ReportList * | UNUSEDreports, |
| ID * | id, | ||
| const char | rna_path[], | ||
| int | array_index, | ||
| short | UNUSEDflag | ||
| ) |
Definition at line 552 of file drivers.c.
References FCurve::array_index, BKE_animdata_from_id(), BKE_fcurve_free(), BKE_fcurve_iter_step(), BLI_remlink(), DRIVER_FCURVE_LOOKUP_ONLY, AnimData::drivers, ListBase::first, FCurve::next, NULL, FCurve::rna_path, and verify_driver_fcurve().
Referenced by do_outliner_drivers_editop(), graph_driver_delete_invalid_exec(), pyrna_struct_driver_remove(), and remove_driver_button_exec().
|
static |
Definition at line 1233 of file drivers.c.
References ANIM_copy_driver(), BKE_animdata_driver_path_hack(), C, PointerRNA::data, MEM_freeN, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_property_animateable(), UI_context_active_but_prop_get(), and UI_context_update_anim_flag().
Referenced by ANIM_OT_copy_driver_button().
|
static |
Definition at line 923 of file drivers.c.
References C, CREATEDRIVER_MAPPING_1_1, CREATEDRIVER_MAPPING_NONE, PointerRNA::data, ELEM, EnumPropertyItem::identifier, NULL, PointerRNA::owner_id, prop_driver_create_mapping_types, ptr, RNA_enum_item_add(), RNA_enum_item_end(), RNA_enum_items_add_value(), RNA_property_animateable(), RNA_property_array_check(), UI_context_active_but_prop_get(), and EnumPropertyItem::value.
Referenced by ANIM_OT_driver_button_add_menu().
|
static |
Definition at line 1199 of file drivers.c.
References C, PointerRNA::data, NULL, OPERATOR_INTERFACE, PointerRNA::owner_id, ptr, wmOperator::reports, UI_context_active_but_prop_get(), and UI_popover_panel_invoke().
Referenced by ANIM_OT_driver_button_edit().
|
static |
Definition at line 1277 of file drivers.c.
References ANIM_paste_driver(), BKE_animdata_driver_path_hack(), C, CTX_data_main(), PointerRNA::data, DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_ANIMATION, MEM_freeN, NC_ANIMATION, ND_KEYFRAME_PROP, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_property_animateable(), UI_context_active_but_prop_get(), UI_context_update_anim_flag(), and WM_event_add_notifier().
Referenced by ANIM_OT_paste_driver_button().
|
static |
Definition at line 1143 of file drivers.c.
References all(), ANIM_remove_driver(), BKE_animdata_driver_path_hack(), C, CTX_data_main(), PointerRNA::data, DEG_relations_tag_update(), MEM_freeN, NC_ANIMATION, ND_FCURVES_ORDER, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, wmOperator::ptr, ptr, wmOperator::reports, RNA_boolean_get(), UI_context_active_but_prop_get(), UI_context_update_anim_flag(), and WM_event_add_notifier().
Referenced by ANIM_OT_driver_button_remove().
| FCurve* verify_driver_fcurve | ( | ID * | id, |
| const char | rna_path[], | ||
| const int | array_index, | ||
| eDriverFCurveCreationMode | creation_mode | ||
| ) |
Definition at line 67 of file drivers.c.
References alloc_driver_fcurve(), BKE_animdata_add_id(), BKE_animdata_from_id(), BKE_fcurve_find(), BLI_addtail(), DRIVER_FCURVE_LOOKUP_ONLY, AnimData::drivers, ELEM, and NULL.
Referenced by add_driver_with_target(), ANIM_add_driver(), ANIM_copy_driver(), ANIM_paste_driver(), ANIM_remove_driver(), and ui_but_anim_expression_create().
Definition at line 604 of file drivers.c.
Referenced by ANIM_copy_as_driver(), ANIM_copy_driver(), ANIM_driver_can_paste(), ANIM_drivers_copybuf_free(), and ANIM_paste_driver().
Definition at line 734 of file drivers.c.
Referenced by ANIM_copy_as_driver(), ANIM_driver_vars_can_paste(), ANIM_driver_vars_copy(), and ANIM_driver_vars_copybuf_free().
| EnumPropertyItem prop_driver_create_mapping_types[] |
Mapping Types enum for operators.
XXX: These names need reviewing.
Definition at line 891 of file drivers.c.
Referenced by ANIM_OT_driver_button_add_menu(), driver_mapping_type_itemsf(), and UI_OT_eyedropper_driver().