diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-22 17:22:24 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-22 18:07:59 +0300 |
commit | 6953c57d2c9317f46387b3a80c1b68108c2c0dfa (patch) | |
tree | 47c9fc0daa812e304f25542b70da62017f9fc956 /source/blender/blenkernel/intern/mesh.c | |
parent | 1b164cf81e10523491ad525bc86f7ff3bbdcf4b0 (diff) |
Fix T55149: missing mesh custom data after modifier stack, after recent changes.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 16 |
1 files changed, 11 insertions, 5 deletions
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); |