[Bf-blender-cvs] [6953c57d2c9] blender2.8: Fix T55149: missing mesh custom data after modifier stack, after recent changes.

Brecht Van Lommel noreply at git.blender.org
Tue May 22 17:08:06 CEST 2018


Commit: 6953c57d2c9317f46387b3a80c1b68108c2c0dfa
Author: Brecht Van Lommel
Date:   Tue May 22 16:22:24 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB6953c57d2c9317f46387b3a80c1b68108c2c0dfa

Fix T55149: missing mesh custom data after modifier stack, after recent changes.

===================================================================

M	source/blender/blenkernel/intern/mesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index aea3e5f4281..f99818f39b9 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -534,15 +534,21 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
 void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int flag)
 {
 	const bool do_tessface = ((me_src->totface != 0) && (me_src->totpoly == 0)); /* only do tessface if we have no polys */
+	CustomDataMask mask = CD_MASK_MESH;
+
+	if (me_src->id.tag & LIB_TAG_NO_MAIN) {
+		/* For copies in depsgraph, keep data like origindex and orco. */
+		mask |= CD_MASK_DERIVEDMESH;
+	}
 
 	me_dst->mat = MEM_dupallocN(me_src->mat);
 
-	CustomData_copy(&me_src->vdata, &me_dst->vdata, CD_MASK_MESH, CD_DUPLICATE, me_dst->totvert);
-	CustomData_copy(&me_src->edata, &me_dst->edata, CD_MASK_MESH, CD_DUPLICATE, me_dst->totedge);
-	CustomData_copy(&me_src->ldata, &me_dst->ldata, CD_MASK_MESH, CD_DUPLICATE, me_dst->totloop);
-	CustomData_copy(&me_src->pdata, &me_dst->pdata, CD_MASK_MESH, CD_DUPLICATE, me_dst->totpoly);
+	CustomData_copy(&me_src->vdata, &me_dst->vdata, mask, CD_DUPLICATE, me_dst->totvert);
+	CustomData_copy(&me_src->edata, &me_dst->edata, mask, CD_DUPLICATE, me_dst->totedge);
+	CustomData_copy(&me_src->ldata, &me_dst->ldata, mask, CD_DUPLICATE, me_dst->totloop);
+	CustomData_copy(&me_src->pdata, &me_dst->pdata, mask, CD_DUPLICATE, me_dst->totpoly);
 	if (do_tessface) {
-		CustomData_copy(&me_src->fdata, &me_dst->fdata, CD_MASK_MESH, CD_DUPLICATE, me_dst->totface);
+		CustomData_copy(&me_src->fdata, &me_dst->fdata, mask, CD_DUPLICATE, me_dst->totface);
 	}
 	else {
 		mesh_tessface_clear_intern(me_dst, false);



More information about the Bf-blender-cvs mailing list