[Bf-blender-cvs] [6e4eb2be283] master: RNA: expose comparison tolerance for Mesh.unit_test_compare

Habib Gahbiche noreply at git.blender.org
Tue Mar 24 09:42:51 CET 2020


Commit: 6e4eb2be283606a8cea45904ab57584dc07d1e05
Author: Habib Gahbiche
Date:   Tue Mar 24 19:41:46 2020 +1100
Branches: master
https://developer.blender.org/rB6e4eb2be283606a8cea45904ab57584dc07d1e05

RNA: expose comparison tolerance for Mesh.unit_test_compare

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

M	source/blender/makesrna/intern/rna_mesh_api.c

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

diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index cc0b2eacd13..d162917ea0c 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -44,9 +44,11 @@
 #  include "BKE_mesh_tangent.h"
 #  include "ED_mesh.h"
 
-static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, struct Mesh *mesh2)
+static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh,
+                                              struct Mesh *mesh2,
+                                              float threshold)
 {
-  const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON * 60);
+  const char *ret = BKE_mesh_cmp(mesh, mesh2, threshold);
 
   if (!ret) {
     ret = "Same";
@@ -317,6 +319,15 @@ void RNA_api_mesh(StructRNA *srna)
 
   func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
   RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
+  RNA_def_float_factor(func,
+                       "threshold",
+                       FLT_EPSILON * 60,
+                       0.0f,
+                       FLT_MAX,
+                       "Threshold",
+                       "Comparison tolerance threshold",
+                       0.0f,
+                       FLT_MAX);
   /* return value */
   parm = RNA_def_string(
       func, "result", "nothing", 64, "Return value", "String description of result of comparison");



More information about the Bf-blender-cvs mailing list