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:
authorHans Goudey <h.goudey@me.com>2022-07-31 19:51:38 +0300
committerHans Goudey <h.goudey@me.com>2022-07-31 19:56:44 +0300
commit17567c235ac62f6d0f7e3bf0cea50593633099da (patch)
tree226af260493750476827298c4ba322393e216f00 /source/blender/modifiers
parent5b1ad3d7cfc29f69b6f340169e1fe2b0db7e3b45 (diff)
Cleanup: Remove mesh edge "tmp tag"
Ref T95966. Also fixes modification of input mesh, which should be considered constant.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_solidify_extrude.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c b/source/blender/modifiers/intern/MOD_solidify_extrude.c
index 80af23054e4..4b744cd8350 100644
--- a/source/blender/modifiers/intern/MOD_solidify_extrude.c
+++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c
@@ -53,7 +53,13 @@ BLI_INLINE bool edgeref_is_init(const EdgeFaceRef *edge_ref)
* \param poly_nors: Precalculated face normals.
* \param r_vert_nors: Return vert normals.
*/
-static void mesh_calc_hq_normal(Mesh *mesh, const float (*poly_nors)[3], float (*r_vert_nors)[3])
+static void mesh_calc_hq_normal(Mesh *mesh,
+ const float (*poly_nors)[3],
+ float (*r_vert_nors)[3],
+#ifdef USE_NONMANIFOLD_WORKAROUND
+ BLI_bitmap *edge_tmp_tag
+#endif
+)
{
int i, verts_num, edges_num, polys_num;
MPoly *mpoly, *mp;
@@ -103,7 +109,7 @@ static void mesh_calc_hq_normal(Mesh *mesh, const float (*poly_nors)[3], float (
/* 3+ faces using an edge, we can't handle this usefully */
edge_ref->p1 = edge_ref->p2 = -1;
#ifdef USE_NONMANIFOLD_WORKAROUND
- medge[ml->e].flag |= ME_EDGE_TMP_TAG;
+ BLI_BITMAP_ENABLE(edge_tmp_tag, ml->e);
#endif
}
/* --- done --- */
@@ -319,9 +325,20 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
BLI_assert(newEdges == 0);
}
+#ifdef USE_NONMANIFOLD_WORKAROUND
+ BLI_bitmap *edge_tmp_tag = BLI_BITMAP_NEW(mesh->totedge, __func__);
+#endif
+
if (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
vert_nors = MEM_calloc_arrayN(verts_num, sizeof(float[3]), "mod_solid_vno_hq");
- mesh_calc_hq_normal(mesh, poly_nors, vert_nors);
+ mesh_calc_hq_normal(mesh,
+ poly_nors,
+ vert_nors
+#ifdef USE_NONMANIFOLD_WORKAROUND
+ ,
+ edge_tmp_tag
+#endif
+ );
}
result = BKE_mesh_new_nomain_from_template(mesh,
@@ -740,8 +757,8 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
#ifdef USE_NONMANIFOLD_WORKAROUND
/* skip 3+ face user edges */
if ((check_non_manifold == false) ||
- LIKELY(((orig_medge[ml[i_curr].e].flag & ME_EDGE_TMP_TAG) == 0) &&
- ((orig_medge[ml[i_next].e].flag & ME_EDGE_TMP_TAG) == 0))) {
+ LIKELY(!BLI_BITMAP_TEST(edge_tmp_tag, ml[i_curr].e) &&
+ !BLI_BITMAP_TEST(edge_tmp_tag, ml[i_next].e))) {
vert_angles[vidx] += shell_v3v3_normalized_to_dist(vert_nors[vidx], poly_nors[i]) *
angle;
}
@@ -949,6 +966,10 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
MEM_freeN(vert_angles);
}
+#ifdef USE_NONMANIFOLD_WORKAROUND
+ MEM_SAFE_FREE(edge_tmp_tag);
+#endif
+
if (vert_nors) {
MEM_freeN(vert_nors);
}