[Bf-blender-cvs] [a5c01917e8b] soc-2021-adaptive-cloth: adaptive_cloth: squash unused parameters warnings in release mode
ishbosamiya
noreply at git.blender.org
Mon Sep 6 11:47:39 CEST 2021
Commit: a5c01917e8b2174f7aa45676507ad253014c4231
Author: ishbosamiya
Date: Wed Sep 1 14:56:17 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBa5c01917e8b2174f7aa45676507ad253014c4231
adaptive_cloth: squash unused parameters warnings in release mode
All unused parameter warnings in BKE_cloth_remesh.hh and
cloth_remesh.cc have been fixed either by adding a #ifndef NDEBUG
directive or by changing the code slightly.
===================================================================
M source/blender/blenkernel/BKE_cloth_remesh.hh
M source/blender/blenkernel/intern/cloth_remesh.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh b/source/blender/blenkernel/BKE_cloth_remesh.hh
index ca0c3688952..696234e1067 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2401,22 +2401,29 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
return true;
}
- /**
- * Flips the edge specified and ensures triangulation of the Mesh.
- *
- * @param across_seams If true, think of edge as world space edge
- * and not UV space, this means, all the faces across all the edges
- * formed between the nodes of the given edge are used for flipping
- * regardless if it on a seam or not.
- *
- * Returns the `MeshDiff` that lead to the operation.
- *
- * Note, the caller must ensure the adjacent faces to the edge are
- * triangulated and that they are flippable using
- * `is_edge_flippable()`. In debug mode, it will assert, in release
- * mode, it is undefined behaviour.
- **/
+/**
+ * Flips the edge specified and ensures triangulation of the Mesh.
+ *
+ * @param across_seams If true, think of edge as world space edge
+ * and not UV space, this means, all the faces across all the edges
+ * formed between the nodes of the given edge are used for flipping
+ * regardless if it on a seam or not.
+ *
+ * Returns the `MeshDiff` that lead to the operation.
+ *
+ * Note, the caller must ensure the adjacent faces to the edge are
+ * triangulated and that they are flippable using
+ * `is_edge_flippable()`. In debug mode, it will assert, in release
+ * mode, it is undefined behaviour.
+ **/
+# ifndef NDEBUG
+ /* TODO(ish): In debug mode, across seams is used. This is confusing
+ * and bad code but prevents the warning for now, will fix later. */
MeshDiff<END, EVD, EED, EFD> flip_edge_triangulate(EdgeIndex edge_index, bool across_seams)
+# else
+ MeshDiff<END, EVD, EED, EFD> flip_edge_triangulate(EdgeIndex edge_index,
+ bool UNUSED(across_seams))
+# endif
{
BLI_assert(this->is_edge_flippable(edge_index, across_seams));
diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 91a84634572..b8c6f6279ac 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -1756,9 +1756,8 @@ static void set_cloth_information_when_new_mesh(Object *ob, ClothModifierData *c
{
BLI_assert(clmd != nullptr);
BLI_assert(mesh != nullptr);
- Cloth &cloth = *clmd->clothObject;
- BLI_assert(cloth.verts != nullptr);
- BLI_assert(cloth.mvert_num == mesh->totvert);
+ BLI_assert(clmd->clothObject->verts != nullptr);
+ BLI_assert(clmd->clothObject->mvert_num == mesh->totvert);
cloth_from_mesh(clmd, ob, mesh, false);
@@ -1799,19 +1798,25 @@ void BKE_cloth_serialize_adaptive_mesh(Object *ob,
BLI_assert(cloth.verts);
return internal::ClothNodeData(cloth.verts[index]);
};
- params.post_extra_data_to_end = [](Cloth & /*unused*/) {
+ params.post_extra_data_to_end = [](Cloth &UNUSED(cloth)) {
/* Do nothing */
};
params.end_to_extra_data =
- [](Cloth & /*unused*/, internal::ClothNodeData /*unused*/, size_t /*unused*/) {
+ [](Cloth &UNUSED(cloth), internal::ClothNodeData UNUSED(node_data), size_t UNUSED(index)) {
/* Do nothing */
};
+#ifndef NDEBUG
params.pre_end_to_extra_data = [](Cloth &cloth, size_t num_nodes) {
/* Do not allocate cloth.verts, it shouldn't have been modified */
BLI_assert(cloth.verts != nullptr);
BLI_assert(cloth.mvert_num == num_nodes);
};
+#else
+ params.pre_end_to_extra_data = [](Cloth &UNUSED(cloth), size_t UNUSED(num_nodes)) {
+ /* Do nothing */
+ };
+#endif
const auto remeshing = clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_REMESH;
Mesh *cloth_to_object_res = nullptr;
@@ -1853,9 +1858,12 @@ Mesh *BKE_cloth_remesh(Object *ob, ClothModifierData *clmd, Mesh *mesh)
mesh = clmd->prev_frame_mesh;
}
+#ifndef NDEBUG
Mesh *cloth_to_object_res = cloth_to_object(ob, clmd, mesh, false);
-
BLI_assert(cloth_to_object_res == nullptr);
+#else
+ cloth_to_object(ob, clmd, mesh, false);
+#endif
AdaptiveRemeshParams<internal::ClothNodeData, Cloth> params;
params.size_min = clmd->sim_parms->remeshing_size_min;
More information about the Bf-blender-cvs
mailing list