From 469005f1f6ade2d3d403fae4531afdd3da55cd96 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 7 Nov 2018 10:34:50 +0300 Subject: [PATCH] Dopesheet: correctly use floating point threshold in ActKeyColumn tree. After some thinking, since the tree itself does always use floating point numbers, it is better to use the threshold - but correctly. --- .../blender/editors/animation/keyframes_draw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 09f81042a47..5ad10b3cf84 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -245,15 +245,10 @@ static void nupdate_ak_bezt(void *node, void *data) /* Comparator callback used for ActKeyColumns and GPencil frame */ static short compare_ak_gpframe(void *node, void *data) { - ActKeyColumn *ak = (ActKeyColumn *)node; bGPDframe *gpf = (bGPDframe *)data; - if (gpf->framenum < ak->cfra) - return -1; - else if (gpf->framenum > ak->cfra) - return 1; - else - return 0; + float frame = gpf->framenum; + return compare_ak_cfraPtr(node, &frame); } /* New node callback used for building ActKeyColumns from GPencil frames */ @@ -295,15 +290,10 @@ static void nupdate_ak_gpframe(void *node, void *data) /* Comparator callback used for ActKeyColumns and GPencil frame */ static short compare_ak_masklayshape(void *node, void *data) { - ActKeyColumn *ak = (ActKeyColumn *)node; MaskLayerShape *masklay_shape = (MaskLayerShape *)data; - if (masklay_shape->frame < ak->cfra) - return -1; - else if (masklay_shape->frame > ak->cfra) - return 1; - else - return 0; + float frame = masklay_shape->frame; + return compare_ak_cfraPtr(node, &frame); } /* New node callback used for building ActKeyColumns from GPencil frames */