Mesh: Replace auto smooth with node group #108014

Merged
Hans Goudey merged 149 commits from HooglyBoogly/blender:refactor-mesh-corner-normals-lazy into main 2023-10-20 16:54:20 +02:00
1 changed files with 4 additions and 2 deletions
Showing only changes of commit 95d4ba381b - Show all commits

View File

@ -816,9 +816,10 @@ static void create_mesh(Scene *scene,
const blender::OffsetIndices faces = b_mesh.faces();
const blender::Span<int> corner_verts = b_mesh.corner_verts();
const blender::bke::AttributeAccessor b_attributes = b_mesh.attributes();
const blender::bke::MeshNormalDomain normals_domain = b_mesh.normals_domain();
int numfaces = (!subdivision) ? b_mesh.looptris().size() : faces.size();
bool use_loop_normals = b_mesh.normals_domain() == blender::bke::MeshNormalDomain::Corner &&
bool use_loop_normals = normals_domain == blender::bke::MeshNormalDomain::Corner &&
(mesh->get_subdivision_type() != Mesh::SUBDIVISION_CATMULL_CLARK);
/* If no faces, create empty mesh. */
@ -937,7 +938,8 @@ static void create_mesh(Scene *scene,
}
}
else {
std::fill(smooth, smooth + numtris, true);
/* If only face normals are needed, all faces are sharp. */
std::fill(smooth, smooth + numtris, normals_domain != blender::bke::MeshNormalDomain::Face);
}
if (use_loop_normals && !corner_normals.is_empty()) {