Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/keyframing.c
| Show First 20 Lines • Show All 633 Lines • ▼ Show 20 Lines | if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE) == 0) { | ||||
| } | } | ||||
| } | } | ||||
| /* don't recalculate handles if fast is set | /* don't recalculate handles if fast is set | ||||
| * - this is a hack to make importers faster | * - this is a hack to make importers faster | ||||
| * - we may calculate twice (due to auto-handle needing to be calculated twice) | * - we may calculate twice (due to auto-handle needing to be calculated twice) | ||||
| */ | */ | ||||
| if ((flag & INSERTKEY_FAST) == 0) { | if ((flag & INSERTKEY_FAST) == 0) { | ||||
| calchandles_fcurve(fcu); | BKE_fcurve_handles_recalc(fcu); | ||||
| } | } | ||||
| /* return the index at which the keyframe was added */ | /* return the index at which the keyframe was added */ | ||||
| return a; | return a; | ||||
| } | } | ||||
| /* -------------- 'Smarter' Keyframing Functions -------------------- */ | /* -------------- 'Smarter' Keyframing Functions -------------------- */ | ||||
| /* return codes for new_key_needed */ | /* return codes for new_key_needed */ | ||||
| ▲ Show 20 Lines • Show All 626 Lines • ▼ Show 20 Lines | if (flag & INSERTKEY_NEEDED) { | ||||
| /* insert new keyframe at current frame */ | /* insert new keyframe at current frame */ | ||||
| if (insert_vert_fcurve(fcu, cfra, curval, keytype, flag) < 0) { | if (insert_vert_fcurve(fcu, cfra, curval, keytype, flag) < 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* delete keyframe immediately before/after newly added */ | /* delete keyframe immediately before/after newly added */ | ||||
| switch (insert_mode) { | switch (insert_mode) { | ||||
| case KEYNEEDED_DELPREV: | case KEYNEEDED_DELPREV: | ||||
| delete_fcurve_key(fcu, fcu->totvert - 2, 1); | BKE_fcurve_delete_key(fcu, fcu->totvert - 2); | ||||
| BKE_fcurve_handles_recalc(fcu); | |||||
| break; | break; | ||||
| case KEYNEEDED_DELNEXT: | case KEYNEEDED_DELNEXT: | ||||
| delete_fcurve_key(fcu, 1, 1); | BKE_fcurve_delete_key(fcu, 1); | ||||
| BKE_fcurve_handles_recalc(fcu); | |||||
sybren: These two calls originally passed `do_recalc=true`, which means here the calls to… | |||||
| break; | break; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
Done Inline ActionsThis is a subtle semantic change. There are four possible values for insert_mode. Before, handles were only recalculated for two of those, and the new code recalculates handles for all four of them. Just put the BKE_fcurve_handles_recalc(fcu); calls directly underneath the BKE_fcurve_delete_key() calls. sybren: This is a subtle semantic change. There are four possible values for `insert_mode`. Before… | |||||
| /* just insert keyframe */ | /* just insert keyframe */ | ||||
| return insert_vert_fcurve(fcu, cfra, curval, keytype, flag) >= 0; | return insert_vert_fcurve(fcu, cfra, curval, keytype, flag) >= 0; | ||||
| } | } | ||||
| bool insert_keyframe_direct(ReportList *reports, | bool insert_keyframe_direct(ReportList *reports, | ||||
| PointerRNA ptr, | PointerRNA ptr, | ||||
| PropertyRNA *prop, | PropertyRNA *prop, | ||||
| ▲ Show 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| bool found; | bool found; | ||||
| int i; | int i; | ||||
| /* try to find index of beztriple to get rid of */ | /* try to find index of beztriple to get rid of */ | ||||
| i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found); | i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found); | ||||
| if (found) { | if (found) { | ||||
| /* delete the key at the index (will sanity check + do recalc afterwards) */ | /* delete the key at the index (will sanity check + do recalc afterwards) */ | ||||
| delete_fcurve_key(fcu, i, 1); | BKE_fcurve_delete_key(fcu, i); | ||||
| BKE_fcurve_handles_recalc(fcu); | |||||
Done Inline Actionsmissing call to BKE_fcurve_handles_recalc(fcu); sybren: missing call to `BKE_fcurve_handles_recalc(fcu);` | |||||
| /* 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)) { | ||||
| ANIM_fcurve_delete_from_animdata(NULL, adt, fcu); | ANIM_fcurve_delete_from_animdata(NULL, adt, fcu); | ||||
| } | } | ||||
| /* return success */ | /* return success */ | ||||
| return true; | return true; | ||||
| ▲ Show 20 Lines • Show All 1,009 Lines • ▼ Show 20 Lines | if (BKE_nlastrip_has_curves_for_property(&ptr, prop)) { | ||||
| */ | */ | ||||
| bool found = false; | bool found = false; | ||||
| int i; | int i; | ||||
| /* try to find index of beztriple to get rid of */ | /* try to find index of beztriple to get rid of */ | ||||
| i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found); | i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found); | ||||
| if (found) { | if (found) { | ||||
| /* delete the key at the index (will sanity check + do recalc afterwards) */ | /* delete the key at the index (will sanity check + do recalc afterwards) */ | ||||
| delete_fcurve_key(fcu, i, 1); | BKE_fcurve_delete_key(fcu, i); | ||||
| BKE_fcurve_handles_recalc(fcu); | |||||
Done Inline Actionsmissing call to BKE_fcurve_handles_recalc(fcu); sybren: missing call to `BKE_fcurve_handles_recalc(fcu);` | |||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* standard properties */ | /* standard properties */ | ||||
| path = RNA_path_from_ID_to_property(&ptr, prop); | path = RNA_path_from_ID_to_property(&ptr, prop); | ||||
| ▲ Show 20 Lines • Show All 502 Lines • Show Last 20 Lines | |||||
These two calls originally passed do_recalc=true, which means here the calls to BKE_fcurve_handles_recalc(fcu); is missing.