[Bf-blender-cvs] [7a475a89eb3] blender-v2.93-release: Fix T87823: Select similar doesn't work with small faces

Campbell Barton noreply at git.blender.org
Thu Apr 29 09:21:13 CEST 2021


Commit: 7a475a89eb398ca5f42ddfdef3c04aa8051858f2
Author: Campbell Barton
Date:   Thu Apr 29 17:16:23 2021 +1000
Branches: blender-v2.93-release
https://developer.blender.org/rB7a475a89eb398ca5f42ddfdef3c04aa8051858f2

Fix T87823: Select similar doesn't work with small faces

FLT_EPSILON was added to the threshold when comparing values,
this caused problems selecting similar small faces since the areas
can be very small in this case.

Also increase the displayed precision so it's easier to use
smaller numbers.

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

M	source/blender/editors/mesh/editmesh_select_similar.c
M	source/blender/editors/util/select_utils.c

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

diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index f9651454dee..f3c0da67ecc 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -1325,7 +1325,9 @@ void MESH_OT_select_similar(wmOperatorType *ot)
 
   RNA_def_enum(ot->srna, "compare", prop_similar_compare_types, SIM_CMP_EQ, "Compare", "");
 
-  RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
+  prop = RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
+  /* Very small values are needed sometimes, similar area of small faces for e.g: see T87823 */
+  RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 5);
 }
 
 /** \} */
diff --git a/source/blender/editors/util/select_utils.c b/source/blender/editors/util/select_utils.c
index 14a6d751bb1..4e8cf1e92e6 100644
--- a/source/blender/editors/util/select_utils.c
+++ b/source/blender/editors/util/select_utils.c
@@ -88,11 +88,11 @@ int ED_select_similar_compare_float(const float delta, const float thresh, const
 {
   switch (compare) {
     case SIM_CMP_EQ:
-      return (fabsf(delta) < thresh + FLT_EPSILON);
+      return (fabsf(delta) <= thresh);
     case SIM_CMP_GT:
-      return ((delta + thresh) > -FLT_EPSILON);
+      return ((delta + thresh) >= 0.0);
     case SIM_CMP_LT:
-      return ((delta - thresh) < FLT_EPSILON);
+      return ((delta - thresh) <= 0.0);
     default:
       BLI_assert_unreachable();
       return 0;



More information about the Bf-blender-cvs mailing list