[Bf-blender-cvs] [de4881374bf] temp-vert-normals-cleanup: Improve marking normals dirty when copying a mesh
Hans Goudey
noreply at git.blender.org
Wed Dec 29 19:23:34 CET 2021
Commit: de4881374bf561f270d81dc56a6f3cbda30903b8
Author: Hans Goudey
Date: Wed Dec 29 12:20:25 2021 -0600
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBde4881374bf561f270d81dc56a6f3cbda30903b8
Improve marking normals dirty when copying a mesh
===================================================================
M source/blender/blenkernel/intern/mesh.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index e475058380d..b85b9f9b8f3 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1107,11 +1107,18 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
mesh_tessface_clear_intern(me_dst, false);
}
- /* Copy dirty flags, essential for normal layers to avoid recomputation and
- * to ensure that when no normal layers exist, they are marked as dirty. */
me_dst->runtime.cd_dirty_poly = me_src->runtime.cd_dirty_poly;
me_dst->runtime.cd_dirty_vert = me_src->runtime.cd_dirty_vert;
+ /* Ensure that when no normal layers exist, they are marked dirty,
+ * because normals might not have been included in the mask. */
+ if (!CustomData_has_layer(&me_dst->vdata, CD_NORMAL)) {
+ me_dst->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
+ }
+ if (!CustomData_has_layer(&me_dst->pdata, CD_NORMAL)) {
+ me_dst->runtime.cd_dirty_poly |= CD_MASK_NORMAL;
+ }
+
/* The destination mesh should at least have valid primary CD layers,
* even in cases where the source mesh does not. */
mesh_ensure_cdlayers_primary(me_dst, do_tessface);
More information about the Bf-blender-cvs
mailing list