Cleanup: Remove mesh edge "tmp tag"
Ref T95966. Also fixes modification of input mesh, which should be considered constant.
This commit is contained in:
parent
5b1ad3d7cf
commit
17567c235a
Notes:
blender-bot
2023-02-14 08:33:26 +01:00
Referenced by issue #95966, Struct of Arrays Refactor for Mesh Edges
|
@ -55,7 +55,6 @@ enum {
|
|||
/* ME_HIDE = (1 << 4), */
|
||||
ME_EDGERENDER = (1 << 5),
|
||||
ME_LOOSEEDGE = (1 << 7),
|
||||
ME_EDGE_TMP_TAG = (1 << 8),
|
||||
ME_SHARP = (1 << 9), /* only reason this flag remains a 'short' */
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue