Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_anim.c
| Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) | ||||
| if (fcu == NULL) { | if (fcu == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (special) { | if (special) { | ||||
| /* NLA Strip property */ | /* NLA Strip property */ | ||||
| if (IS_AUTOKEY_ON(scene)) { | if (IS_AUTOKEY_ON(scene)) { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| ReportList *reports = CTX_wm_reports(C); | ReportList *reports = CTX_wm_reports(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| insert_keyframe_direct( | insert_keyframe_direct( | ||||
| depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, NULL, 0); | depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, NULL, 0); | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); | ||||
| } | } | ||||
| } | } | ||||
| else if (driven) { | else if (driven) { | ||||
| /* Driver - Try to insert keyframe using the driver's input as the frame, | /* Driver - Try to insert keyframe using the driver's input as the frame, | ||||
| * making it easier to set up corrective drivers | * making it easier to set up corrective drivers | ||||
| */ | */ | ||||
| if (IS_AUTOKEY_ON(scene)) { | if (IS_AUTOKEY_ON(scene)) { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| ReportList *reports = CTX_wm_reports(C); | ReportList *reports = CTX_wm_reports(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| insert_keyframe_direct(depsgraph, | insert_keyframe_direct(depsgraph, | ||||
| reports, | reports, | ||||
| but->rnapoin, | but->rnapoin, | ||||
| but->rnaprop, | but->rnaprop, | ||||
| fcu, | fcu, | ||||
| cfra, | cfra, | ||||
| ts->keyframe_type, | ts->keyframe_type, | ||||
| NULL, | NULL, | ||||
| INSERTKEY_DRIVER); | INSERTKEY_DRIVER); | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| id = but->rnapoin.id.data; | id = but->rnapoin.id.data; | ||||
| /* TODO: this should probably respect the keyingset only option for anim */ | /* TODO: this should probably respect the keyingset only option for anim */ | ||||
| if (autokeyframe_cfra_can_key(scene, id)) { | if (autokeyframe_cfra_can_key(scene, id)) { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| ReportList *reports = CTX_wm_reports(C); | ReportList *reports = CTX_wm_reports(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| short flag = ANIM_get_keyframing_flags(scene, 1); | short flag = ANIM_get_keyframing_flags(scene, 1); | ||||
| fcu->flag &= ~FCURVE_SELECTED; | fcu->flag &= ~FCURVE_SELECTED; | ||||
| /* Note: We use but->rnaindex instead of fcu->array_index, | /* Note: We use but->rnaindex instead of fcu->array_index, | ||||
| * because a button may control all items of an array at once. | * because a button may control all items of an array at once. | ||||
| ▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines | |||||