From 258a9b5fc1f024a371bd43cefeb94a5b2d1f3ce5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 24 Apr 2014 16:46:54 +0200 Subject: Fix T39867: Hotkey is not displayed in the node editor's menu. Making both keymap and menu values the same, and adding a (debug only) check in IDP_EqualsProperties_ex() warning when comparing two floats with nearly the same value. --- source/blender/blenkernel/intern/idprop.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 23d55ad90df..8b9231204de 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -35,6 +35,7 @@ #include "BLI_utildefines.h" #include "BLI_string.h" #include "BLI_listbase.h" +#include "BLI_math.h" #include "BKE_idprop.h" #include "BKE_library.h" @@ -820,6 +821,19 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is case IDP_INT: return (IDP_Int(prop1) == IDP_Int(prop2)); case IDP_FLOAT: +#ifdef DEBUG + { + float p1 = IDP_Float(prop1); + float p2 = IDP_Float(prop2); + if ((p1 != p2) && ((fabs(p1 - p2) / max_ff(p1, p2)) < 0.001)) { + printf("WARNING: Comparing two float properties that have nearly the same value (%f vs. %f)\n", p1, p2); + printf(" p1: "); + IDP_spit(prop1); + printf(" p2: "); + IDP_spit(prop2); + } + } +#endif return (IDP_Float(prop1) == IDP_Float(prop2)); case IDP_DOUBLE: return (IDP_Double(prop1) == IDP_Double(prop2)); -- cgit v1.2.3