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
4 changed files with 9 additions and 15 deletions
Showing only changes of commit 88d2175666 - Show all commits

View File

@ -93,7 +93,8 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
* UV are not empty. */
if (mesh.is_editmode() ||
(mesh.normal_domain_all_info() == BL::Mesh::normal_domain_all_info_CORNER &&
subdivision_type == Mesh::SUBDIVISION_NONE)) {
subdivision_type == Mesh::SUBDIVISION_NONE))
{
BL::Depsgraph depsgraph(PointerRNA_NULL);
mesh = b_ob_info.real_object.to_mesh(false, depsgraph);
}
@ -118,7 +119,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
if ((bool)mesh && subdivision_type == Mesh::SUBDIVISION_NONE) {
if (mesh.normal_domain_all_info() == BL::Mesh::normal_domain_all_info_CORNER) {
mesh.split_faces(false);
mesh.split_faces();
}
mesh.calc_loop_triangles();

View File

@ -227,9 +227,11 @@ static Mesh *remesh_voxel_volume_to_mesh(const openvdb::FloatGrid::Ptr level_set
MutableSpan<int> poly_offsets = mesh->poly_offsets_for_write();
MutableSpan<int> mesh_corner_verts = mesh->corner_verts_for_write();
poly_offsets.take_front(quads.size()).fill(4);
poly_offsets.drop_front(quads.size()).fill(3);
blender::offset_indices::accumulate_counts_to_offsets(poly_offsets);
if (!poly_offsets.is_empty()) {
poly_offsets.take_front(quads.size()).fill(4);
poly_offsets.drop_front(quads.size()).fill(3);
blender::offset_indices::accumulate_counts_to_offsets(poly_offsets);
}
for (const int i : vert_positions.index_range()) {
vert_positions[i] = float3(vertices[i].x(), vertices[i].y(), vertices[i].z());

View File

@ -164,11 +164,6 @@ static void rna_Mesh_flip_normals(Mesh *mesh)
DEG_id_tag_update(&mesh->id, 0);
}
static void rna_Mesh_split_faces(Mesh *mesh, bool UNUSED(free_loop_normals))
{
ED_mesh_split_faces(mesh);
}
static void rna_Mesh_update_gpu_tag(Mesh *mesh)
{
BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL);
@ -218,11 +213,8 @@ void RNA_api_mesh(StructRNA *srna)
func, "Set the sharp edge status for edges based on the angle of incident faces");
RNA_def_float(func, "angle", M_PI, 0.0f, M_PI, "Angle", "", 0.0f, M_PI);
func = RNA_def_function(srna, "split_faces", "rna_Mesh_split_faces");
func = RNA_def_function(srna, "split_faces", "ED_mesh_split_faces");
RNA_def_function_ui_description(func, "Split faces based on the edge angle");
/* TODO: This parameter has no effect anymore, since the internal code does not need to
* compute temporary CD_NORMAL loop data. It should be removed for next major release (4.0). */
RNA_def_boolean(func, "free_loop_normals", 1, "Free Loop Normals", "Deprecated, has no effect");
func = RNA_def_function(srna, "calc_tangents", "rna_Mesh_calc_tangents");
RNA_def_function_flag(func, FUNC_USE_REPORTS);

View File

@ -188,7 +188,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext * /*ctx*/, M
rmd->scale,
rmd->depth));
BLI_mutex_unlock(&dualcon_mutex);
output->mesh->poly_offsets_for_write().last() = output->mesh->totloop;
result = output->mesh;
MEM_freeN(output);
}