Mesh: Only check dirty normals flag of current domain
The code that checked whether vertex normals needed to be recalculated was checking the dirty tag for face normals and vertex normals, in an attempt at increased safety. However, those tags are always set together anyway. Only checking the vertex dirty tag allows potentially allocating or updating the normals on the two domains independently, which could allow further skipping of calculations in some cases.
This commit is contained in:
parent
23f8fc38d9
commit
a5190dce9d
Notes:
blender-bot
2023-02-14 11:34:30 +01:00
Referenced by issue #101075, Regression: Screw Modifier Calculate Order is broken
|
@ -345,7 +345,7 @@ void BKE_mesh_calc_normals_poly_and_vertex(const MVert *mvert,
|
|||
|
||||
const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3]
|
||||
{
|
||||
if (!(BKE_mesh_vertex_normals_are_dirty(mesh) || BKE_mesh_poly_normals_are_dirty(mesh))) {
|
||||
if (!BKE_mesh_vertex_normals_are_dirty(mesh)) {
|
||||
BLI_assert(mesh->runtime.vert_normals != nullptr || mesh->totvert == 0);
|
||||
return mesh->runtime.vert_normals;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3]
|
|||
|
||||
ThreadMutex *normals_mutex = (ThreadMutex *)mesh->runtime.normals_mutex;
|
||||
BLI_mutex_lock(normals_mutex);
|
||||
if (!(BKE_mesh_vertex_normals_are_dirty(mesh) || BKE_mesh_poly_normals_are_dirty(mesh))) {
|
||||
if (!BKE_mesh_vertex_normals_are_dirty(mesh)) {
|
||||
BLI_assert(mesh->runtime.vert_normals != nullptr);
|
||||
BLI_mutex_unlock(normals_mutex);
|
||||
return mesh->runtime.vert_normals;
|
||||
|
|
Loading…
Reference in New Issue