Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-20 01:08:02 +0300
committerHans Goudey <h.goudey@me.com>2022-04-20 01:08:02 +0300
commit6a3c3c77b3ebdbcd44559bf91ea7d5cf3c5e4953 (patch)
tree619854e36d34502c1f81f0fd1ec7b0454fecc5b3 /source/blender/nodes
parent9ec94c3882a414dc60dd17abfa12838f94f63c24 (diff)
Mesh: Avoid unnecessary normal calculation and dirty tags
This is mostly a cleanup to avoid hardcoding the eager calculation of normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals` and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh is newly created and already has dirty normals anyway. This reduces boilerplate code and makes the "dirty by default" state more clear. Any regressions from this commit should be easy to fix, though the lazy calculation is solid enough that none are expected.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_edge_split.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transform.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_triangulate.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc1
10 files changed, 0 insertions, 13 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
index 87f000897ed..877dc05211d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
@@ -131,8 +131,6 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
}
plConvexHullDelete(hull);
-
- BKE_mesh_normals_tag_dirty(result);
return result;
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
index c3b1a141f4a..8a0c900fbde 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
@@ -1225,8 +1225,6 @@ static void do_mesh_separation(GeometrySet &geometry_set,
}
BKE_mesh_calc_edges_loose(mesh_out);
- /* Tag to recalculate normals later. */
- BKE_mesh_normals_tag_dirty(mesh_out);
geometry_set.replace_mesh(mesh_out);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
index 2894e608819..dcd9bcfb034 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
@@ -897,7 +897,6 @@ static void calc_dual_mesh(GeometrySet &geometry_set,
copy_v3_v3(mesh_out->mvert[i].co, vertex_positions[i]);
}
memcpy(mesh_out->medge, new_edges.data(), sizeof(MEdge) * new_edges.size());
- BKE_mesh_normals_tag_dirty(mesh_out);
geometry_set.replace_mesh(mesh_out);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
index c03a340a0c8..84acab47661 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
@@ -41,8 +41,6 @@ static Mesh *mesh_edge_split(const Mesh &mesh, const IndexMask selection)
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, nullptr, &mesh);
BM_mesh_free(bm);
- BKE_mesh_normals_tag_dirty(result);
-
return result;
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
index e53be5213f6..636ecb8ab41 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
@@ -407,7 +407,6 @@ Mesh *create_cuboid_mesh(const float3 size,
calculate_polys(config, {mesh->mpoly, mesh->totpoly}, {mesh->mloop, mesh->totloop});
BKE_mesh_calc_edges(mesh, false, false);
- BKE_mesh_normals_tag_dirty(mesh);
calculate_uvs(config, mesh);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc
index e1f85be0f80..3c0ccb01673 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc
@@ -50,7 +50,6 @@ static void geometry_set_mesh_subdivide(GeometrySet &geometry_set, const int lev
}
Mesh *mesh_out = BKE_subdiv_to_mesh(subdiv, &mesh_settings, mesh_in);
- BKE_mesh_normals_tag_dirty(mesh_out);
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
mesh_component.replace(mesh_out);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
index a5fe491e12b..4832feac5bd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
@@ -119,7 +119,6 @@ static void node_geo_exec(GeoNodeExecParams params)
}
Mesh *mesh_out = BKE_subdiv_to_mesh(subdiv, &mesh_settings, mesh_in);
- BKE_mesh_normals_tag_dirty(mesh_out);
mesh_component.replace(mesh_out);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
index cc115ee3b3f..e95db205920 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transform.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
@@ -43,7 +43,6 @@ static void translate_mesh(Mesh &mesh, const float3 translation)
static void transform_mesh(Mesh &mesh, const float4x4 &transform)
{
BKE_mesh_transform(&mesh, transform.values, false);
- BKE_mesh_normals_tag_dirty(&mesh);
}
static void translate_pointcloud(PointCloud &pointcloud, const float3 translation)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
index 76cdbfb140f..992470e8279 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
@@ -62,7 +62,6 @@ static Mesh *triangulate_mesh_selection(const Mesh &mesh,
BM_mesh_triangulate(bm, quad_method, ngon_method, min_vertices, true, nullptr, nullptr, nullptr);
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, &mesh);
BM_mesh_free(bm);
- BKE_mesh_normals_tag_dirty(result);
return result;
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
index c30c05bdd0d..e5827c24320 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
@@ -139,7 +139,6 @@ static Mesh *create_mesh_from_volume_grids(Span<openvdb::GridBase::ConstPtr> gri
}
BKE_mesh_calc_edges(mesh, false, false);
- BKE_mesh_normals_tag_dirty(mesh);
return mesh;
}