Added BKE_mesh_ensure_normals()
This calls BKE_mesh_calc_normals() only if the mesh vertex normals are marked as dirty.
This commit is contained in:
@@ -202,6 +202,7 @@ void BKE_mesh_calc_normals_poly(
|
||||
int numLoops, int numPolys, float (*r_polyNors)[3],
|
||||
const bool only_face_normals);
|
||||
void BKE_mesh_calc_normals(struct Mesh *me);
|
||||
void BKE_mesh_ensure_normals(struct Mesh *me);
|
||||
void BKE_mesh_calc_normals_tessface(
|
||||
struct MVert *mverts, int numVerts,
|
||||
const struct MFace *mfaces, int numFaces,
|
||||
|
||||
@@ -332,6 +332,15 @@ void BKE_mesh_calc_normals_poly(
|
||||
MEM_freeN(lnors_weighted);
|
||||
}
|
||||
|
||||
void BKE_mesh_ensure_normals(Mesh *mesh)
|
||||
{
|
||||
if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) {
|
||||
BKE_mesh_calc_normals(mesh);
|
||||
}
|
||||
BLI_assert((mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) == 0);
|
||||
}
|
||||
|
||||
/* Note that this does not update the CD_NORMAL layer, but does update the normals in the CD_MVERT layer. */
|
||||
void BKE_mesh_calc_normals(Mesh *mesh)
|
||||
{
|
||||
#ifdef DEBUG_TIME
|
||||
|
||||
Reference in New Issue
Block a user