From a62bca844ce10dec2e4835db804f3c84c3ff5d58 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Tue, 30 Jun 2020 15:31:00 -0400 Subject: Fix problem after master merge with Optional -> optional migration. On Mac, there's an error re using the value() member of std::optional. Working around it for now. --- source/blender/blenlib/BLI_boolean.h | 7 ++++--- source/blender/blenlib/intern/boolean.cc | 7 +++---- tests/gtests/blenlib/BLI_map_test.cc | 2 +- tests/gtests/blenlib/CMakeLists.txt | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/blender/blenlib/BLI_boolean.h b/source/blender/blenlib/BLI_boolean.h index 87b778c94e6..c28c71d3be6 100644 --- a/source/blender/blenlib/BLI_boolean.h +++ b/source/blender/blenlib/BLI_boolean.h @@ -59,7 +59,6 @@ void BLI_boolean_trimesh_free(Boolean_trimesh_output *output); # include "BLI_array.hh" # include "BLI_mesh_intersect.hh" # include "BLI_mpq3.hh" -# include "BLI_optional.hh" # include "gmpxx.h" namespace blender { @@ -74,8 +73,10 @@ struct PolyMeshOrig { struct PolyMesh { Array vert; Array> face; - Optional>> triangulation; - Optional orig; + /* triangulation can have zero length: then boolean will do it. */ + Array> triangulation; + /* orig can be dummy for boolean input, but has useful information for its output. */ + PolyMeshOrig orig; }; PolyMesh boolean(PolyMesh &pm, int bool_optype, int nshapes, std::function shape_fn); diff --git a/source/blender/blenlib/intern/boolean.cc b/source/blender/blenlib/intern/boolean.cc index 7fa946870ce..6f0b18f42d1 100644 --- a/source/blender/blenlib/intern/boolean.cc +++ b/source/blender/blenlib/intern/boolean.cc @@ -28,7 +28,6 @@ #include "BLI_math.h" #include "BLI_mesh_intersect.hh" #include "BLI_mpq3.hh" -#include "BLI_optional.hh" #include "BLI_set.hh" #include "BLI_span.hh" #include "BLI_stack.hh" @@ -1332,7 +1331,7 @@ static void triangulate_polymesh(PolyMesh &pm) face_tris[f] = triangulate_poly(f, pm.face[f], pm.vert); } } - pm.triangulation.set(face_tris); + pm.triangulation = face_tris; } /* Will add triangulation if it isn't already there. */ @@ -1340,10 +1339,10 @@ static TriMesh trimesh_from_polymesh(PolyMesh &pm) { TriMesh ans; ans.vert = pm.vert; - if (!pm.triangulation.has_value()) { + if (pm.triangulation.size() == 0) { triangulate_polymesh(pm); } - const Array> &tri_arrays = pm.triangulation.value(); + const Array> &tri_arrays = pm.triangulation; int tot_tri = 0; for (const Array &a : tri_arrays) { tot_tri += static_cast(a.size()); diff --git a/tests/gtests/blenlib/BLI_map_test.cc b/tests/gtests/blenlib/BLI_map_test.cc index 7a67255d8d3..74ad632b52f 100644 --- a/tests/gtests/blenlib/BLI_map_test.cc +++ b/tests/gtests/blenlib/BLI_map_test.cc @@ -94,7 +94,7 @@ TEST(map, PopTry) value = map.pop_try(2); EXPECT_EQ(map.size(), 1u); EXPECT_TRUE(value.has_value()); - EXPECT_EQ(value.value(), 7); + EXPECT_EQ(*value, 7); EXPECT_EQ(*map.pop_try(1), 5); EXPECT_EQ(map.size(), 0u); } diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt index d3fbc6bfaba..db933cbf990 100644 --- a/tests/gtests/blenlib/CMakeLists.txt +++ b/tests/gtests/blenlib/CMakeLists.txt @@ -69,7 +69,6 @@ BLENDER_TEST(BLI_math_matrix "bf_blenlib") BLENDER_TEST(BLI_math_vector "bf_blenlib") BLENDER_TEST(BLI_memiter "bf_blenlib") BLENDER_TEST(BLI_mesh_intersect "bf_blenlib") -BLENDER_TEST(BLI_optional "bf_blenlib") BLENDER_TEST(BLI_path_util "${BLI_path_util_extra_libs}") BLENDER_TEST(BLI_polyfill_2d "bf_blenlib") BLENDER_TEST(BLI_set "bf_blenlib") -- cgit v1.2.3