Cleanup: Remove redundant asserts about dirty normals

These asserts basically just reiterated the way things work-- there's no
no way for them to trigger with the current code. And even if they did,
that sort of change wouldn't happen by mistake, so it's not worth
an assert.
This commit is contained in:
Hans Goudey 2023-08-31 14:22:22 -04:00
parent 74bd927f7c
commit bb181fb8f1
4 changed files with 7 additions and 21 deletions

View File

@ -321,16 +321,10 @@ void BKE_mesh_recalc_looptri(const int *corner_verts,
/* *** mesh_normals.cc *** */
/**
* Return true if the mesh vertex normals either are not stored or are dirty.
* This can be used to help decide whether to transfer them when copying a mesh.
*/
/** Return true if the mesh vertex normals either are not stored or are dirty. */
bool BKE_mesh_vert_normals_are_dirty(const struct Mesh *mesh);
/**
* Return true if the mesh face normals either are not stored or are dirty.
* This can be used to help decide whether to transfer them when copying a mesh.
*/
/** Return true if the mesh face normals either are not stored or are dirty. */
bool BKE_mesh_face_normals_are_dirty(const struct Mesh *mesh);
/**

View File

@ -1058,9 +1058,6 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
CustomData_add_layer(&me_dst->fdata_legacy, CD_MFACE, CD_SET_DEFAULT, me_dst->totface_legacy);
}
/* Expect that normals aren't copied at all, since the destination mesh is new. */
BLI_assert(BKE_mesh_vert_normals_are_dirty(me_dst));
return me_dst;
}

View File

@ -1196,6 +1196,11 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH_GEOMETRY);
Mesh *result = subdiv_context.subdiv_mesh;
/* NOTE: Using normals from the limit surface gives different results than Blender's vertex
* normal calculation. Since vertex normals are supposed to be a consistent cache, don't bother
* calculating them here. The work may have been pointless anyway if the mesh is deformed or
* changed afterwards. */
/* Move the optimal display edge array to the final bit vector. */
if (!subdiv_context.subdiv_display_edges.is_empty()) {
const Span<bool> span = subdiv_context.subdiv_display_edges;
@ -1224,12 +1229,6 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
// BKE_mesh_validate(result, true, true);
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH);
/* Using normals from the limit surface gives different results than Blender's vertex normal
* calculation. Since vertex normals are supposed to be a consistent cache, don't bother
* calculating them here. The work may have been pointless anyway if the mesh is deformed or
* changed afterwards. */
BLI_assert(BKE_mesh_vert_normals_are_dirty(result) || BKE_mesh_face_normals_are_dirty(result));
/* Free used memory. */
subdiv_mesh_context_free(&subdiv_context);
return result;
}

View File

@ -825,10 +825,6 @@ static void undomesh_to_editmesh(UndoMesh *um, Object *ob, BMEditMesh *em)
em_tmp = BKE_editmesh_create(bm);
*em = *em_tmp;
/* Normals should not be stored in the undo mesh, so recalculate them. The edit
* mesh is expected to have valid normals and there is no tracked dirty state. */
BLI_assert(BKE_mesh_vert_normals_are_dirty(&um->me));
/* Calculate face normals and tessellation at once since it's multi-threaded. */
BKE_editmesh_looptri_and_normals_calc(em);