diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-10-17 16:07:52 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-10-17 16:30:34 +0300 |
commit | 938aa52313bba9bd001ea3e9a697658d12e3308e (patch) | |
tree | 9978927d815ec3e763dca009eda79f5ec346afdf /source/blender/editors/animation | |
parent | e6adf9ac9a32f0c9b9690fef1b9066e030683a45 (diff) |
Dope Sheet: fix assert in new hold code when bezier keys are not sorted.
Turns out this can happen during duplicate+drag operations.
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/keyframes_draw.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index d517ae7295b..10881ac15fd 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -328,6 +328,29 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *keys, BezTriple *bezt, int be /* Insert real blocks. */ for (int v = 1; col != NULL && v < bezt_len; v++, bezt++) { + /* Wrong order of bezier keys: resync position. */ + if (is_cfra_lt(bezt[1].vec[1][0], bezt[0].vec[1][0])) { + /* Backtrack to find the right location. */ + if (is_cfra_lt(bezt[1].vec[1][0], col->cfra)) { + ActKeyColumn *newcol = (ActKeyColumn*)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &bezt[1].vec[1][0]); + + if (newcol != NULL) { + col = newcol; + + /* The previous keyblock is garbage too. */ + if (col->prev != NULL) { + add_keyblock_info(col->prev, &dummy_keyblock); + } + } + else { + BLI_assert(false); + } + } + + continue; + } + + /* Normal sequence */ BLI_assert(is_cfra_eq(col->cfra, bezt[0].vec[1][0])); compute_keyblock_data(&block, bezt, bezt + 1); |