[Bf-blender-cvs] [ec4b5006a8a] temp-vert-normals-cleanup: Don't write or copy normal layers
Hans Goudey
noreply at git.blender.org
Sun Dec 12 18:59:16 CET 2021
Commit: ec4b5006a8abf3771bbfd25bff76f147ec3a3980
Author: Hans Goudey
Date: Sun Dec 12 11:59:07 2021 -0600
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBec4b5006a8abf3771bbfd25bff76f147ec3a3980
Don't write or copy normal layers
===================================================================
M source/blender/blenkernel/intern/customdata.c
M source/blender/blenkernel/intern/mesh.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 33371e5a4d0..8e3d9bd434c 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1907,13 +1907,13 @@ const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX = {
};
const CustomData_MeshMasks CD_MASK_MESH = {
.vmask = (CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | CD_MASK_PAINT_MASK |
- CD_MASK_PROP_ALL | CD_MASK_PROP_COLOR | CD_MASK_NORMAL),
+ CD_MASK_PROP_ALL | CD_MASK_PROP_COLOR),
.emask = (CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL),
.fmask = 0,
.lmask = (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL |
CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL),
.pmask = (CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL |
- CD_MASK_SCULPT_FACE_SETS | CD_MASK_NORMAL),
+ CD_MASK_SCULPT_FACE_SETS),
};
const CustomData_MeshMasks CD_MASK_EDITMESH = {
.vmask = (CD_MASK_MDEFORMVERT | CD_MASK_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 679f4165a7b..936925936eb 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -152,10 +152,11 @@ static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
mesh_dst->mselect = (MSelect *)MEM_dupallocN(mesh_dst->mselect);
- /* Copy dirty flags, essential for normal layers to avoid recomputation and
- * to ensure that when no normal layers exist, they are marked as dirty. */
- mesh_dst->runtime.cd_dirty_poly = mesh_src->runtime.cd_dirty_poly;
- mesh_dst->runtime.cd_dirty_vert = mesh_src->runtime.cd_dirty_vert;
+ /* Set normal layers dirty, since they aren't included in CD_MASK_MESH and are therefore not
+ * copied to the destination mesh. Alternatively normal layers could be copied if they aren't
+ * dirty, avoiding recomputation in some cases. However, a copied mesh is often changed anyway,
+ * so that idea is not clearly better. */
+ BKE_mesh_normals_tag_dirty(mesh_dst);
/* TODO: Do we want to add flag to prevent this? */
if (mesh_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
More information about the Bf-blender-cvs
mailing list