|
Blender V4.5
|
#include <cctype>#include <cstdio>#include <cstring>#include "MEM_guardedalloc.h"#include "BLI_listbase.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "DNA_anim_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.
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 1026 of file drivers.cc.
References ANIM_add_driver(), C, CREATEDRIVER_WITH_DEFAULT_DVAR, CTX_data_main(), DEG_id_tag_update(), DEG_relations_tag_update(), DRIVER_TYPE_PYTHON, ID_RECALC_SYNC_TO_EVAL, NC_ANIMATION, ND_FCURVES_ORDER, OPERATOR_INTERFACE, 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 961 of file drivers.cc.
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 980 of file drivers.cc.
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 928 of file drivers.cc.
References ANIM_add_driver(), C, CREATEDRIVER_MAPPING_NONE_ALL, CREATEDRIVER_WITH_DEFAULT_DVAR, CTX_data_main(), DEG_relations_tag_update(), DRIVER_TYPE_PYTHON, NC_ANIMATION, ND_FCURVES_ORDER, OPERATOR_CANCELLED, OPERATOR_FINISHED, 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 903 of file drivers.cc.
References BKE_fcurve_find_by_rna_context_ui(), C, FCurve::driver, 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 139 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, blender::animrig::get_keyframe_settings(), blender::animrig::insert_vert_fcurve(), INSERTKEY_FAST, MEM_callocN(), FCurve::modifiers, FCurve::rna_path, and U.
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 398 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, ID::name, PROP_BOOLEAN, PROP_FLOAT, PROP_INT, ptr, reports, 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 284 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, i, len, ID::name, ptr, reports, 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 784 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, i, DriverTarget::id, DriverTarget::idtype, DriverVar::name, ID::name, DriverTarget::rna_path, 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 579 of file drivers.cc.
References ANIM_drivers_copybuf_free(), BKE_fcurve_copy(), BKE_reportf(), channeldriver_copypaste_buf, FCurve::driver, DRIVER_FCURVE_LOOKUP_ONLY, ID::name, ptr, reports, 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 572 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 700 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 707 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, reports, 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 684 of file drivers.cc.
References BLI_listbase_clear(), driver_free_variable(), driver_vars_copybuf, 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 729 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, reports, 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 563 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 1188 of file drivers.cc.
References copy_driver_button_exec(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_anim().
| void ANIM_OT_driver_button_add | ( | wmOperatorType * | ot | ) |
Definition at line 1063 of file drivers.cc.
References add_driver_button_invoke(), add_driver_button_poll(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_anim().
|
static |
Definition at line 999 of file drivers.cc.
References add_driver_button_menu_exec(), add_driver_button_menu_invoke(), add_driver_button_poll(), ANIM_OT_driver_button_add_menu(), driver_mapping_type_itemf(), OPTYPE_INTERNAL, OPTYPE_UNDO, ot, prop_driver_create_mapping_types, RNA_def_enum(), and RNA_def_enum_funcs().
Referenced by ANIM_OT_driver_button_add_menu().
| void ANIM_OT_driver_button_edit | ( | wmOperatorType * | ot | ) |
Definition at line 1148 of file drivers.cc.
References edit_driver_button_exec(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_anim().
| void ANIM_OT_driver_button_remove | ( | wmOperatorType * | ot | ) |
Definition at line 1112 of file drivers.cc.
References OPTYPE_INTERNAL, OPTYPE_UNDO, ot, remove_driver_button_exec(), and RNA_def_boolean().
Referenced by ED_operatortypes_anim().
| void ANIM_OT_paste_driver_button | ( | wmOperatorType * | ot | ) |
Definition at line 1233 of file drivers.cc.
References 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 627 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, ID::name, ptr, reports, RNA_id_pointer_create(), RNA_path_resolve_property(), RPT_ERROR, FCurve::totvert, and verify_driver_fcurve().
Referenced by paste_driver_button_exec().
| bool ANIM_remove_driver | ( | ID * | id, |
| const char | rna_path[], | ||
| int | array_index ) |
Main Driver Management API calls.
Remove the driver for the specified property on the given ID block.
Definition at line 522 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 1166 of file drivers.cc.
References ANIM_copy_driver(), C, OPERATOR_CANCELLED, OPERATOR_FINISHED, 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 860 of file drivers.cc.
References C, CREATEDRIVER_MAPPING_1_1, CREATEDRIVER_MAPPING_NONE, ELEM, input, 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 1133 of file drivers.cc.
References C, OPERATOR_INTERFACE, 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 1205 of file drivers.cc.
References ANIM_paste_driver(), C, CTX_data_main(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_ANIMATION, NC_ANIMATION, ND_KEYFRAME_PROP, OPERATOR_CANCELLED, OPERATOR_FINISHED, 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 1081 of file drivers.cc.
References all(), ANIM_remove_driver(), C, CTX_data_main(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_ANIMATION, NC_ANIMATION, ND_FCURVES_ORDER, OPERATOR_CANCELLED, OPERATOR_FINISHED, 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().
Definition at line 561 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().
Definition at line 682 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 827 of file drivers.cc.
Referenced by ANIM_OT_driver_button_add_menu(), driver_mapping_type_itemf(), and UI_OT_eyedropper_driver().