Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Trickey <howard.trickey@gmail.com>2020-06-30 22:31:00 +0300
committerHoward Trickey <howard.trickey@gmail.com>2020-06-30 22:31:00 +0300
commita62bca844ce10dec2e4835db804f3c84c3ff5d58 (patch)
tree8fdcdd193702ae432659901999a551ae7c39c63c
parent028f8b5b64993c46c0013617748db783d1c078a3 (diff)
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.
-rw-r--r--source/blender/blenlib/BLI_boolean.h7
-rw-r--r--source/blender/blenlib/intern/boolean.cc7
-rw-r--r--tests/gtests/blenlib/BLI_map_test.cc2
-rw-r--r--tests/gtests/blenlib/CMakeLists.txt1
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<mpq3> vert;
Array<Array<int>> face;
- Optional<Array<Array<IndexedTriangle>>> triangulation;
- Optional<PolyMeshOrig> orig;
+ /* triangulation can have zero length: then boolean will do it. */
+ Array<Array<IndexedTriangle>> 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<int(int)> 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<Array<IndexedTriangle>> &tri_arrays = pm.triangulation.value();
+ const Array<Array<IndexedTriangle>> &tri_arrays = pm.triangulation;
int tot_tri = 0;
for (const Array<IndexedTriangle> &a : tri_arrays) {
tot_tri += static_cast<int>(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")