[Bf-blender-cvs] [469005f1f6a] blender2.8: Dopesheet: correctly use floating point threshold in ActKeyColumn tree.

Alexander Gavrilov noreply at git.blender.org
Wed Nov 7 08:41:43 CET 2018


Commit: 469005f1f6ade2d3d403fae4531afdd3da55cd96
Author: Alexander Gavrilov
Date:   Wed Nov 7 10:34:50 2018 +0300
Branches: blender2.8
https://developer.blender.org/rB469005f1f6ade2d3d403fae4531afdd3da55cd96

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.

===================================================================

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 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 */



More information about the Bf-blender-cvs mailing list