[Bf-blender-cvs] [938aa52313b] blender2.8: Dope Sheet: fix assert in new hold code when bezier keys are not sorted.
Alexander Gavrilov
noreply at git.blender.org
Wed Oct 17 15:31:09 CEST 2018
Commit: 938aa52313bba9bd001ea3e9a697658d12e3308e
Author: Alexander Gavrilov
Date: Wed Oct 17 16:07:52 2018 +0300
Branches: blender2.8
https://developer.blender.org/rB938aa52313bba9bd001ea3e9a697658d12e3308e
Dope Sheet: fix assert in new hold code when bezier keys are not sorted.
Turns out this can happen during duplicate+drag operations.
===================================================================
M source/blender/editors/animation/keyframes_draw.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list