|
Blender V4.3
|
#include <cctype>#include <cstdio>#include <cstring>#include "MEM_guardedalloc.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "DNA_anim_types.h"#include "DNA_texture_types.h"#include "BKE_anim_data.hh"#include "BKE_context.hh"#include "BKE_fcurve.hh"#include "BKE_fcurve_driver.h"#include "BKE_report.hh"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_build.hh"#include "ED_keyframing.hh"#include "UI_interface.hh"#include "UI_resources.hh"#include "WM_api.hh"#include "WM_types.hh"#include "RNA_access.hh"#include "RNA_define.hh"#include "RNA_path.hh"#include "RNA_prototypes.hh"#include "ANIM_fcurve.hh"#include "anim_intern.hh"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) |
| FCurve * | alloc_driver_fcurve (const char rna_path[], const int array_index, eDriverFCurveCreationMode creation_mode) |
| static int | add_driver_with_target (ReportList *, 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) |
| Main Driver Management API calls. | |
| int | ANIM_add_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type) |
| Main Driver Management API calls. | |
| bool | ANIM_remove_driver (ID *id, const char rna_path[], int array_index) |
| Main Driver Management API calls. | |
| void | ANIM_drivers_copybuf_free () |
| bool | ANIM_driver_can_paste () |
| bool | ANIM_copy_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short) |
| Main Driver Management API calls. | |
| bool | ANIM_paste_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short) |
| Main Driver Management API calls. | |
| void | ANIM_driver_vars_copybuf_free () |
| bool | ANIM_driver_vars_can_paste () |
| 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 (ID *target_id, const char *target_path, const char *var_name) |
| static const EnumPropertyItem * | driver_mapping_type_itemf (bContext *C, PointerRNA *, PropertyRNA *, 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 *) |
| static void UNUSED_FUNCTION | ANIM_OT_driver_button_add_menu (wmOperatorType *ot) |
| static int | add_driver_button_invoke (bContext *C, wmOperator *op, const wmEvent *) |
| 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 = nullptr |
| static ListBase | driver_vars_copybuf = {nullptr, nullptr} |
| const EnumPropertyItem | prop_driver_create_mapping_types [] |
|
static |
Definition at line 1025 of file drivers.cc.
References ANIM_add_driver(), CREATEDRIVER_WITH_DEFAULT_DVAR, CTX_data_main(), PointerRNA::data, DEG_id_tag_update(), DEG_relations_tag_update(), DRIVER_TYPE_PYTHON, ID_RECALC_SYNC_TO_EVAL, NC_ANIMATION, ND_FCURVES_ORDER, OPERATOR_INTERFACE, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_path_from_ID_to_property(), RNA_property_driver_editable(), 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 962 of file drivers.cc.
References add_driver_button_none(), 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 981 of file drivers.cc.
References add_driver_button_menu_exec(), 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 929 of file drivers.cc.
References ANIM_add_driver(), CREATEDRIVER_MAPPING_NONE_ALL, CREATEDRIVER_WITH_DEFAULT_DVAR, CTX_data_main(), PointerRNA::data, DEG_relations_tag_update(), DRIVER_TYPE_PYTHON, NC_ANIMATION, ND_FCURVES_ORDER, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_path_from_ID_to_property(), RNA_property_driver_editable(), 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 904 of file drivers.cc.
References BKE_fcurve_find_by_rna_context_ui(), PointerRNA::data, FCurve::driver, PointerRNA::owner_id, ptr, RNA_property_driver_editable(), 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 140 of file drivers.cc.
References BLI_sprintfN(), BLI_strdup(), 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, flag, GS, DriverTarget::id, DriverTarget::idtype, ID::name, DriverTarget::pchan_name, PROP_UNIT_ROTATION, DriverTarget::rna_path, RNA_property_array_check(), RNA_property_identifier(), RNA_property_unit(), RNA_string_get(), STREQ, STRNCPY, STRPREFIX, DriverVar::targets, DriverTarget::transChan, ChannelDriver::type, PointerRNA::type, and verify_driver_fcurve().
Referenced by ANIM_add_driver_with_target().
| FCurve * alloc_driver_fcurve | ( | const char | rna_path[], |
| const int | array_index, | ||
| eDriverFCurveCreationMode | creation_mode ) |
Definition at line 91 of file drivers.cc.
References add_fmodifier(), FCurve::array_index, FCurve::auto_smoothing, BKE_fcurve_create(), BKE_fcurve_handles_recalc(), BLI_strdup(), 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, INSERTKEY_FAST, 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 399 of file drivers.cc.
References 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, flag, PROP_BOOLEAN, PROP_FLOAT, PROP_INT, ptr, RNA_id_pointer_create(), 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, ChannelDriver::type, and verify_driver_fcurve().
Referenced by add_driver_button_invoke(), add_driver_button_none(), ANIM_add_driver_with_target(), blender::ed::outliner::do_outliner_drivers_editop(), pyrna_struct_driver_add(), and blender::interface::tests::CopyDriversToSelected::SetUp().
| 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.
Add a new driver for the specified property on the given ID block, and make it be driven by the specified target.
This is intended to be used in conjunction with a modal "eyedropper" for picking the variable that is going to be used to drive this one.
| flag | eCreateDriverFlags |
| driver_type | eDriver_Types |
| mapping_type | eCreateDriver_MappingTypes |
Definition at line 285 of file drivers.cc.
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, flag, len, 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 | ( | ID * | target_id, |
| const char * | target_path, | ||
| const char * | var_name ) |
Create a driver & variable that reads the specified property, and store it in the buffers for Paste Driver and Paste Variables.
Definition at line 785 of file drivers.cc.
References alloc_driver_fcurve(), ANIM_driver_vars_copybuf_free(), ANIM_drivers_copybuf_free(), BLI_strdup(), channeldriver_copypaste_buf, FCurve::driver, driver_add_new_variable(), DRIVER_FCURVE_KEYFRAMES, driver_variables_copy(), driver_vars_copybuf, ChannelDriver::expression, GS, DriverTarget::idtype, DriverVar::name, ID::name, STRNCPY, 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 | flag ) |
Main Driver Management API calls.
Make a copy of the driver for the specified property on the given ID block.
Definition at line 580 of file drivers.cc.
References ANIM_drivers_copybuf_free(), BKE_fcurve_copy(), BKE_reportf(), channeldriver_copypaste_buf, FCurve::driver, DRIVER_FCURVE_LOOKUP_ONLY, 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 | ( | ) |
Returns whether there is a driver in the copy/paste buffer to paste.
Definition at line 573 of file drivers.cc.
References channeldriver_copypaste_buf.
Referenced by ui_popup_context_menu_for_button().
| bool ANIM_driver_vars_can_paste | ( | ) |
Checks if there are driver variables in the copy/paste buffer.
Definition at line 701 of file drivers.cc.
References BLI_listbase_is_empty(), and driver_vars_copybuf.
| bool ANIM_driver_vars_copy | ( | ReportList * | reports, |
| FCurve * | fcu ) |
Copy the given driver's variables to the buffer.
Definition at line 708 of file drivers.cc.
References ANIM_driver_vars_copybuf_free(), BKE_report(), BLI_listbase_is_empty(), FCurve::driver, driver_variables_copy(), driver_vars_copybuf, ELEM, RPT_ERROR, and ChannelDriver::variables.
Referenced by graph_driver_vars_copy_exec().
| void ANIM_driver_vars_copybuf_free | ( | ) |
Clear copy-paste buffer for driver variable sets.
Definition at line 685 of file drivers.cc.
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 ) |
Paste the variables in the buffer to the given FCurve.
Definition at line 730 of file drivers.cc.
References BKE_driver_invalidate_expression(), BKE_report(), BLI_listbase_clear(), BLI_listbase_is_empty(), FCurve::driver, driver_free_variable_ex(), driver_variables_copy(), driver_vars_copybuf, ELEM, ListBase::first, ListBase::last, DriverVar::next, DriverVar::prev, RPT_ERROR, and ChannelDriver::variables.
Referenced by graph_driver_vars_paste_exec().
| void ANIM_drivers_copybuf_free | ( | ) |
Clear copy-paste buffer for drivers.
Definition at line 564 of file drivers.cc.
References BKE_fcurve_free(), and channeldriver_copypaste_buf.
Referenced by ANIM_copy_as_driver(), ANIM_copy_driver(), and WM_exit_ex().
| void ANIM_OT_copy_driver_button | ( | wmOperatorType * | ot | ) |
Definition at line 1184 of file drivers.cc.
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 1060 of file drivers.cc.
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 998 of file drivers.cc.
References add_driver_button_menu_exec(), add_driver_button_menu_invoke(), add_driver_button_poll(), wmOperatorType::description, driver_mapping_type_itemf(), 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 1144 of file drivers.cc.
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 1108 of file drivers.cc.
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 1229 of file drivers.cc.
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 | flag ) |
Main Driver Management API calls.
Add a new driver for the specified property on the given ID block or replace an existing one with the driver + driver-curve data from the buffer.
Definition at line 628 of file drivers.cc.
References FCurve::bezt, BKE_report(), BKE_reportf(), channeldriver_copypaste_buf, copy_fmodifiers(), FCurve::driver, DRIVER_FCURVE_EMPTY, FCurve::extend, fcurve_copy_driver(), FCurve::fpt, MEM_dupallocN, FCurve::modifiers, ptr, RNA_id_pointer_create(), RNA_path_resolve_property(), RPT_ERROR, FCurve::totvert, and verify_driver_fcurve().
Referenced by paste_driver_button_exec().
Main Driver Management API calls.
Remove the driver for the specified property on the given ID block.
Definition at line 523 of file drivers.cc.
References BKE_animdata_from_id(), BKE_fcurve_free(), BKE_fcurve_iter_step(), BLI_remlink(), DRIVER_FCURVE_LOOKUP_ONLY, AnimData::drivers, ListBase::first, FCurve::next, and verify_driver_fcurve().
Referenced by blender::ed::outliner::do_outliner_drivers_editop(), graph_driver_delete_invalid_exec(), pyrna_struct_driver_remove(), and remove_driver_button_exec().
|
static |
Definition at line 1162 of file drivers.cc.
References ANIM_copy_driver(), PointerRNA::data, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_path_from_ID_to_property(), RNA_property_driver_editable(), UI_context_active_but_prop_get(), and UI_context_update_anim_flag().
Referenced by ANIM_OT_copy_driver_button().
|
static |
Definition at line 861 of file drivers.cc.
References CREATEDRIVER_MAPPING_1_1, CREATEDRIVER_MAPPING_NONE, PointerRNA::data, ELEM, PointerRNA::owner_id, prop_driver_create_mapping_types, ptr, RNA_enum_item_add(), RNA_enum_item_end(), RNA_enum_items_add_value(), RNA_property_array_check(), RNA_property_driver_editable(), and UI_context_active_but_prop_get().
Referenced by ANIM_OT_driver_button_add_menu().
|
static |
Definition at line 1129 of file drivers.cc.
References PointerRNA::data, 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 1201 of file drivers.cc.
References ANIM_paste_driver(), CTX_data_main(), PointerRNA::data, DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_ANIMATION, NC_ANIMATION, ND_KEYFRAME_PROP, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_path_from_ID_to_property(), RNA_property_driver_editable(), 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 1078 of file drivers.cc.
References ANIM_remove_driver(), CTX_data_main(), PointerRNA::data, DEG_relations_tag_update(), NC_ANIMATION, ND_FCURVES_ORDER, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::ptr, RNA_boolean_get(), RNA_path_from_ID_to_property(), 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[], | ||
| int | array_index, | ||
| eDriverFCurveCreationMode | creation_mode ) |
Get (or add relevant data to be able to do so) F-Curve from the driver stack, for the given Animation Data block. This assumes that all the destinations are valid.
Definition at line 50 of file drivers.cc.
References alloc_driver_fcurve(), BKE_animdata_ensure_id(), BKE_animdata_from_id(), BKE_fcurve_find(), BLI_addtail(), DRIVER_FCURVE_LOOKUP_ONLY, AnimData::drivers, and ELEM.
Referenced by add_driver_with_target(), ANIM_add_driver(), ANIM_copy_driver(), ANIM_paste_driver(), ANIM_remove_driver(), and ui_but_anim_expression_create().
|
static |
Definition at line 562 of file drivers.cc.
Referenced by ANIM_copy_as_driver(), ANIM_copy_driver(), ANIM_driver_can_paste(), ANIM_drivers_copybuf_free(), and ANIM_paste_driver().
|
static |
Definition at line 683 of file drivers.cc.
Referenced by ANIM_copy_as_driver(), ANIM_driver_vars_can_paste(), ANIM_driver_vars_copy(), ANIM_driver_vars_copybuf_free(), and ANIM_driver_vars_paste().
| const EnumPropertyItem prop_driver_create_mapping_types[] |
Mapping Types enum for operators.
Definition at line 828 of file drivers.cc.
Referenced by ANIM_OT_driver_button_add_menu(), driver_mapping_type_itemf(), and UI_OT_eyedropper_driver().