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-03-22 17:33:50 +0300
committerHans Goudey <h.goudey@me.com>2022-03-22 17:33:50 +0300
commit64cd927519748bbd50b856c25f7e4eac17d8c780 (patch)
treeca23f3b5d63c5d6a01afcb8aa0177a84ee01851f /source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
parent86d87fcbdbd5f4a18d2fdcc4f827d9bee6b5ed32 (diff)
Fix T96308: Mesh to BMesh conversion doesn't calculate vertex normals
Currently there is a "calc_face_normal" argument to mesh to bmesh conversion, but vertex normals had always implicitly inherited whatever dirty state the mesh input's vertex normals were in. Probably they were most often assumed to not be dirty, but this was never really correct in the general case. Ever since the refactor to move vertex normals out of mesh vertices, cfa53e0fbeed7178c7, the copying logic has been explicit: copy the normals when they are not dirty. But it turns out that more control is needed, and sometimes normals should be calculated for the resulting BMesh. This commit adds an option to the conversion to calculate vertex normals, true by default. In almost all places except the decimate and edge split modifiers, I just copied the value of the "calc_face_normals" argument. Differential Revision: https://developer.blender.org/D14406
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_triangulate.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_triangulate.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
index 5ded8413cf9..76cdbfb140f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
@@ -44,7 +44,13 @@ static Mesh *triangulate_mesh_selection(const Mesh &mesh,
CustomData_MeshMasks cd_mask_extra = {
CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, 0, CD_MASK_ORIGINDEX};
BMeshCreateParams create_params{0};
- BMeshFromMeshParams from_mesh_params{true, 1, 1, 1, cd_mask_extra};
+ BMeshFromMeshParams from_mesh_params{};
+ from_mesh_params.calc_face_normal = true;
+ from_mesh_params.calc_vert_normal = true;
+ from_mesh_params.add_key_index = true;
+ from_mesh_params.use_shapekey = true;
+ from_mesh_params.active_shapekey = 1;
+ from_mesh_params.cd_mask_extra = cd_mask_extra;
BMesh *bm = BKE_mesh_to_bmesh_ex(&mesh, &create_params, &from_mesh_params);
/* Tag faces to be triangulated from the selection mask. */