Blender
V3.3
|
#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 "RNA_path.h"
#include "RNA_prototypes.h"
#include "anim_intern.h"
Go to the source code of this file.
Variables | |
static FCurve * | channeldriver_copypaste_buf = NULL |
static ListBase | driver_vars_copybuf = {NULL, NULL} |
EnumPropertyItem | prop_driver_create_mapping_types [] |
|
static |
Definition at line 1033 of file drivers.c.
References ANIM_add_driver(), 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_path_from_ID_to_property(), 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 971 of file drivers.c.
References add_driver_button_none(), C, CREATEDRIVER_MAPPING_NONE, CREATEDRIVER_MAPPING_NONE_ALL, ELEM, NULL, 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 990 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 936 of file drivers.c.
References ANIM_add_driver(), 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_path_from_ID_to_property(), 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().
Definition at line 911 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 139 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, DriverTarget::rna_path, 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 91 of file drivers.c.
References add_fmodifier(), FCurve::array_index, FCurve::auto_smoothing, BEZT_KEYTYPE_KEYFRAME, 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, 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 | ( | struct ReportList * | reports, |
struct 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 395 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 | ( | struct ReportList * | reports, |
struct ID * | dst_id, | ||
const char | dst_path[], | ||
int | dst_index, | ||
struct 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 281 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().
Create a driver & variable that reads the specified property, and store it in the buffers for Paste Driver and Paste Variables.
Definition at line 792 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 587 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().
Returns whether there is a driver in the copy/paste buffer to paste.
Definition at line 580 of file drivers.c.
References channeldriver_copypaste_buf, and NULL.
Referenced by ui_popup_context_menu_for_button().
Checks if there are driver variables in the copy/paste buffer.
Definition at line 708 of file drivers.c.
References BLI_listbase_is_empty(), and driver_vars_copybuf.
bool ANIM_driver_vars_copy | ( | struct ReportList * | reports, |
struct FCurve * | fcu | ||
) |
Copy the given driver's variables to the buffer.
Definition at line 715 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().
Clear copy-paste buffer for driver variable sets.
Definition at line 692 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 | ( | struct ReportList * | reports, |
struct FCurve * | fcu, | ||
bool | replace | ||
) |
Paste the variables in the buffer to the given FCurve.
Definition at line 737 of file drivers.c.
References FCurve::driver, and NULL.
Referenced by graph_driver_vars_paste_exec().
Clear copy-paste buffer for drivers.
Definition at line 571 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 1205 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 1070 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 1006 of file drivers.c.
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 1160 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 1123 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 1255 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 635 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 517 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 1178 of file drivers.c.
References ANIM_copy_driver(), C, PointerRNA::data, MEM_freeN, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA::owner_id, ptr, wmOperator::reports, RNA_path_from_ID_to_property(), 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 868 of file drivers.c.
References C, CREATEDRIVER_MAPPING_1_1, CREATEDRIVER_MAPPING_NONE, PointerRNA::data, ELEM, input, 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(), and UI_context_active_but_prop_get().
Referenced by ANIM_OT_driver_button_add_menu().
|
static |
Definition at line 1144 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 1222 of file drivers.c.
References ANIM_paste_driver(), 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_path_from_ID_to_property(), 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 1088 of file drivers.c.
References all(), ANIM_remove_driver(), 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(), 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 | ( | struct 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.c.
References alloc_driver_fcurve(), BKE_animdata_ensure_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 569 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 690 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.
Definition at line 835 of file drivers.c.
Referenced by ANIM_OT_driver_button_add_menu(), driver_mapping_type_itemf(), and UI_OT_eyedropper_driver().