From 596cb0ea314f3331aa4602451d28f8bc7ee74ed8 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 10 Oct 2022 13:48:16 +0200 Subject: Remove debug code. --- source/blender/blenkernel/BKE_uv_islands.hh | 116 ---------------------------- 1 file changed, 116 deletions(-) diff --git a/source/blender/blenkernel/BKE_uv_islands.hh b/source/blender/blenkernel/BKE_uv_islands.hh index 6fdd3976d74..8a8d14aeab5 100644 --- a/source/blender/blenkernel/BKE_uv_islands.hh +++ b/source/blender/blenkernel/BKE_uv_islands.hh @@ -21,14 +21,6 @@ #include "PIL_time_utildefines.h" namespace blender::bke::uv_islands { -/* - * When enabled various parts of the code would generate an SVG file to visual see how the - * algorithm makes decisions. - * - * TODO: These will be removed before this patch will land in master. - */ -//#define DEBUG_SVG -//#define VALIDATE struct MeshEdge; struct MeshPrimitive; @@ -133,22 +125,6 @@ struct MeshData { init_primitives(); init_edges(); init_primitive_uv_island_ids(); - -#ifdef VALIDATE - for (const MeshVertex &v : vertices) { - printf("Vert {v%lld}\n", v.v); - for (const MeshEdge *e : v.edges) { - printf("-Edge {v%lld v%lld}\n", e->vert1->v, e->vert2->v); - for (const MeshPrimitive *p : e->primitives) { - printf(" -Prim {p%lld, v%lld v%lld v%lld}\n", - p->index, - p->vertices[0].vertex->v, - p->vertices[1].vertex->v, - p->vertices[2].vertex->v); - } - } - } -#endif TIMEIT_END(init_mesh_data); } @@ -580,10 +556,6 @@ struct UVBorder { static std::optional extract_from_edges(Vector &edges); -#ifdef VALIDATE - void validate() const; -#endif - /** Remove edge from the border. updates the indexes. */ void remove(int64_t index) { @@ -722,75 +694,8 @@ struct UVIsland { } } } - -#ifdef VALIDATE - void validate_primitives() const - { - /* Each UVPrimitive that points to the same mesh primitive should contain the same mesh - * vertices (and can be retrieved in the same order). */ - for (const VectorList::UsedVector &primitives : uv_primitives) { - for (const UVPrimitive &prim_a : primitives) { - validate_primitive(prim_a); - } - } - } - void validate_primitive(const UVPrimitive &prim_a) const - { - /* Each UVPrimitive that points to the same mesh primitive should contain the same mesh - * vertices (and can be retrieved in the same order). */ - for (const VectorList::UsedVector &primitives : uv_primitives) { - for (const UVPrimitive &prim_b : primitives) { - if (prim_a.primitive != prim_b.primitive) { - continue; - } - for (int i = 0; i < 3; i++) { - const UVVertex *v1 = prim_a.get_uv_vertex(i); - const UVVertex *v2 = prim_b.get_uv_vertex(i); - BLI_assert(v1->vertex->v == v2->vertex->v); - } - } - } - } - - void validate_border() const - { - /* Each UVPrimitive that points to the same mesh primitive should contain the same mesh - * vertices (and can be retrieved in the same order). */ - for (const VectorList::UsedVector &primitives_a : uv_primitives) { - for (const UVPrimitive &prim_a : primitives_a) { - for (const VectorList::UsedVector &primitives_b : uv_primitives) { - for (const UVPrimitive &prim_b : primitives_b) { - if (prim_a.primitive != prim_b.primitive) { - continue; - } - for (int i = 0; i < 3; i++) { - const UVVertex *v1 = prim_a.get_uv_vertex(i); - const UVVertex *v2 = prim_b.get_uv_vertex(i); - BLI_assert(v1->vertex->v == v2->vertex->v); - } - } - } - } - } - for (const UVBorder &border : borders) { - border.validate(); - } - } -#endif }; -#ifdef DEBUG_SVG -/* Debug functions to export to a SVG file. */ -void svg_header(std::ostream &ss); -void svg(std::ostream &ss, const UVIsland &islands, int step); -void svg(std::ostream &ss, const UVIslands &islands, int step); -void svg(std::ostream &ss, const UVPrimitive &primitive); -void svg(std::ostream &ss, const UVPrimitive &primitive, int step); -void svg(std::ostream &ss, const UVIslandsMask &mask, int step); -void svg(std::ostream &ss, const UVBorder &border, int step); -void svg_footer(std::ostream &ss); -#endif - struct UVIslands { Vector islands; @@ -798,27 +703,6 @@ struct UVIslands { void extract_borders(); void extend_borders(const UVIslandsMask &islands_mask); - -#ifdef VALIDATE - private: - bool validate() const - { - /* After operations it is not allowed that islands share any edges. In that case it should - * already be merged. */ - for (int i = 0; i < islands.size() - 1; i++) { - for (int j = i + 1; j < islands.size(); j++) { - for (const VectorList::UsedVector &primitives : islands[j].uv_primitives) { - for (const UVPrimitive &prim : primitives) { - if (islands[i].has_shared_edge(prim)) { - return false; - } - } - } - } - } - return true; - } -#endif }; /** Mask to find the index of the UVIsland for a given UV coordinate. */ -- cgit v1.2.3