Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/keyframing.c
| Show First 20 Lines • Show All 1,317 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * The flag argument is used for special settings that alter the behavior of | * The flag argument is used for special settings that alter the behavior of | ||||
| * the keyframe insertion. These include the 'visual' keyframing modes, quick refresh, | * the keyframe insertion. These include the 'visual' keyframing modes, quick refresh, | ||||
| * and extra keyframe filtering. | * and extra keyframe filtering. | ||||
| * | * | ||||
| * index of -1 keys all array indices | * index of -1 keys all array indices | ||||
| */ | */ | ||||
| short insert_keyframe(Main *bmain, | short insert_keyframe(Main *bmain, | ||||
| Depsgraph *depsgraph, | |||||
| ReportList *reports, | ReportList *reports, | ||||
| ID *id, | ID *id, | ||||
| bAction *act, | bAction *act, | ||||
| const char group[], | const char group[], | ||||
| const char rna_path[], | const char rna_path[], | ||||
| int array_index, | int array_index, | ||||
| float cfra, | float cfra, | ||||
| eBezTriple_KeyframeType keytype, | eBezTriple_KeyframeType keytype, | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | short insert_keyframe(Main *bmain, | ||||
| } | } | ||||
| /* apply NLA-mapping to frame to use (if applicable) */ | /* apply NLA-mapping to frame to use (if applicable) */ | ||||
| adt = BKE_animdata_from_id(id); | adt = BKE_animdata_from_id(id); | ||||
| if (adt && adt->action == act) { | if (adt && adt->action == act) { | ||||
| /* Get NLA context for value remapping. */ | /* Get NLA context for value remapping. */ | ||||
| nla_context = BKE_animsys_get_nla_keyframing_context( | nla_context = BKE_animsys_get_nla_keyframing_context( | ||||
| nla_cache ? nla_cache : &tmp_nla_cache, depsgraph, &id_ptr, adt, cfra); | nla_cache ? nla_cache : &tmp_nla_cache, &id_ptr, adt, cfra, false); | ||||
| /* Apply NLA-mapping to frame. */ | /* Apply NLA-mapping to frame. */ | ||||
| cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); | cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); | ||||
| } | } | ||||
| /* Obtain values to insert. */ | /* Obtain values to insert. */ | ||||
| float value_buffer[RNA_MAX_ARRAY_LENGTH]; | float value_buffer[RNA_MAX_ARRAY_LENGTH]; | ||||
| int value_count; | int value_count; | ||||
| ▲ Show 20 Lines • Show All 950 Lines • ▼ Show 20 Lines | void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot) | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /* Insert Key Button Operator ------------------------ */ | /* Insert Key Button Operator ------------------------ */ | ||||
| static int insert_key_button_exec(bContext *C, wmOperator *op) | static int insert_key_button_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | |||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| PointerRNA ptr = {{NULL}}; | PointerRNA ptr = {{NULL}}; | ||||
| PropertyRNA *prop = NULL; | PropertyRNA *prop = NULL; | ||||
| char *path; | char *path; | ||||
| uiBut *but; | uiBut *but; | ||||
| float cfra = (float)CFRA; | float cfra = (float)CFRA; | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | else { | ||||
| } | } | ||||
| if (all) { | if (all) { | ||||
| /* -1 indicates operating on the entire array (or the property itself otherwise) */ | /* -1 indicates operating on the entire array (or the property itself otherwise) */ | ||||
| index = -1; | index = -1; | ||||
| } | } | ||||
| success = insert_keyframe(bmain, | success = insert_keyframe(bmain, | ||||
| depsgraph, | |||||
| op->reports, | op->reports, | ||||
| ptr.id.data, | ptr.id.data, | ||||
| NULL, | NULL, | ||||
| group, | group, | ||||
| path, | path, | ||||
| index, | index, | ||||
| cfra, | cfra, | ||||
| ts->keyframe_type, | ts->keyframe_type, | ||||
| ▲ Show 20 Lines • Show All 554 Lines • Show Last 20 Lines | |||||