Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_graph/graph_edit.c
| Show First 20 Lines • Show All 717 Lines • ▼ Show 20 Lines | static bool delete_graph_keys(bAnimContext *ac) | ||||
| /* Loop through filtered data and delete selected keys. */ | /* Loop through filtered data and delete selected keys. */ | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| FCurve *fcu = (FCurve *)ale->key_data; | FCurve *fcu = (FCurve *)ale->key_data; | ||||
| AnimData *adt = ale->adt; | AnimData *adt = ale->adt; | ||||
| bool changed; | bool changed; | ||||
| /* Delete selected keyframes only. */ | /* Delete selected keyframes only. */ | ||||
| changed = delete_fcurve_keys(fcu); | changed = BKE_fcurve_delete_keys_selected(fcu); | ||||
| if (changed) { | if (changed) { | ||||
| ale->update |= ANIM_UPDATE_DEFAULT; | ale->update |= ANIM_UPDATE_DEFAULT; | ||||
| changed_final = true; | changed_final = true; | ||||
| } | } | ||||
| /* Only delete curve too if it won't be doing anything anymore. */ | /* Only delete curve too if it won't be doing anything anymore. */ | ||||
| if (BKE_fcurve_is_empty(fcu)) { | if (BKE_fcurve_is_empty(fcu)) { | ||||
| ▲ Show 20 Lines • Show All 748 Lines • ▼ Show 20 Lines | filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY | | ||||
| ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); | ||||
| ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ||||
| /* Loop through setting BezTriple interpolation | /* Loop through setting BezTriple interpolation | ||||
| * NOTE: we do not supply KeyframeEditData to the looper yet. | * NOTE: we do not supply KeyframeEditData to the looper yet. | ||||
| * Currently that's not necessary here. | * Currently that's not necessary here. | ||||
| */ | */ | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, BKE_fcurve_handles_recalc); | ||||
| ale->update |= ANIM_UPDATE_DEFAULT_NOHANDLES; | ale->update |= ANIM_UPDATE_DEFAULT_NOHANDLES; | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | ANIM_animdata_update(ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY | | ||||
| ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); | ||||
| ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ||||
| /* Loop through setting BezTriple easing. | /* Loop through setting BezTriple easing. | ||||
| * NOTE: we do not supply KeyframeEditData to the looper yet. | * NOTE: we do not supply KeyframeEditData to the looper yet. | ||||
| * Currently that's not necessary here. | * Currently that's not necessary here. | ||||
| */ | */ | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, BKE_fcurve_handles_recalc); | ||||
| ale->update |= ANIM_UPDATE_DEFAULT_NOHANDLES; | ale->update |= ANIM_UPDATE_DEFAULT_NOHANDLES; | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | ANIM_animdata_update(ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | static void sethandles_graph_keys(bAnimContext *ac, short mode) | ||||
| * Currently that's not necessary here. | * Currently that's not necessary here. | ||||
| */ | */ | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| FCurve *fcu = (FCurve *)ale->key_data; | FCurve *fcu = (FCurve *)ale->key_data; | ||||
| /* Any selected keyframes for editing? */ | /* Any selected keyframes for editing? */ | ||||
| if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { | if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { | ||||
| /* Change type of selected handles. */ | /* Change type of selected handles. */ | ||||
| ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, BKE_fcurve_handles_recalc); | ||||
| ale->update |= ANIM_UPDATE_DEFAULT; | ale->update |= ANIM_UPDATE_DEFAULT; | ||||
| } | } | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | ANIM_animdata_update(ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 629 Lines • ▼ Show 20 Lines | if (mode == GRAPHKEYS_SNAP_VALUE) { | ||||
| ac->scene, ale->id, ale->key_data, mapping_flag, &offset); | ac->scene, ale->id, ale->key_data, mapping_flag, &offset); | ||||
| ked.f1 = (cursor_value / unit_scale) - offset; | ked.f1 = (cursor_value / unit_scale) - offset; | ||||
| } | } | ||||
| /* Perform snapping. */ | /* Perform snapping. */ | ||||
| if (adt) { | if (adt) { | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc); | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); | ||||
| } | } | ||||
| else { | else { | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc); | ||||
| } | } | ||||
| ale->update |= ANIM_UPDATE_DEFAULT; | ale->update |= ANIM_UPDATE_DEFAULT; | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | ANIM_animdata_update(ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | if (mode == GRAPHKEYS_MIRROR_VALUE) { | ||||
| ac->scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS, &offset); | ac->scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS, &offset); | ||||
| ked.f1 = (cursor_value - offset) / unit_scale; | ked.f1 = (cursor_value - offset) / unit_scale; | ||||
| } | } | ||||
| /* Perform actual mirroring. */ | /* Perform actual mirroring. */ | ||||
| if (adt) { | if (adt) { | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc); | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); | ||||
| } | } | ||||
| else { | else { | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc); | ||||
| } | } | ||||
| ale->update |= ANIM_UPDATE_DEFAULT; | ale->update |= ANIM_UPDATE_DEFAULT; | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | ANIM_animdata_update(ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 581 Lines • Show Last 20 Lines | |||||