diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-05-15 14:26:24 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-05-16 13:41:48 +0300 |
commit | dbe4189dcd3ac715e5e3d39b7d7a0e6e52651f07 (patch) | |
tree | bc402b3f789757e28b73f6b5751d1480f954bda1 /source | |
parent | 46aec45b2a37aabcb4d1a391cdc587dc7a869ed0 (diff) |
Save 'deform_only' flag in Mesh.runtime
This flag is copied when converting between DM and Mesh.
This flag is set to true in get_mesh(), to mimick the behaviour of
CDDM_from_mesh_ex. This is necessary for the particle system to work
correctly.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mesh_types.h | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 1 |
5 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index c58d946cc99..beef57a6867 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -749,6 +749,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool CustomData_copy(&dm->loopData, &tmp.ldata, mask, alloctype, totloop); CustomData_copy(&dm->polyData, &tmp.pdata, mask, alloctype, totpoly); tmp.cd_flag = dm->cd_flag; + tmp.runtime.deformed_only = dm->deformedOnly; if (CustomData_has_layer(&dm->vertData, CD_SHAPEKEY)) { KeyBlock *kb; @@ -2397,7 +2398,7 @@ static void mesh_calc_modifiers( append_mask |= CD_MASK_PREVIEW_MLOOPCOL; } - // dm->deformedOnly = false; // XXX: Does Mesh need this? Looks to be used only by particle system + mesh->runtime.deformed_only = false; } isPrevDeform = (mti->type == eModifierTypeType_OnlyDeform); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 46dd376e065..e585c4ca666 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -608,7 +608,7 @@ DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh, int alloctype) DM_init(dm, DM_TYPE_CDDM, mesh->totvert, mesh->totedge, 0 /* mesh->totface */, mesh->totloop, mesh->totpoly); - dm->deformedOnly = 1; + dm->deformedOnly = mesh->runtime.deformed_only; dm->cd_flag = mesh->cd_flag; if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a64eb5aa071..efafdf949dc 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -553,6 +553,7 @@ void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int me_dst->edit_btmesh = NULL; me_dst->runtime.batch_cache = NULL; me_dst->runtime.bvh_cache = NULL; + me_dst->runtime.deformed_only = me_src->runtime.deformed_only; me_dst->mselect = MEM_dupallocN(me_dst->mselect); me_dst->bb = MEM_dupallocN(me_dst->bb); diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 5ce24916c54..4e347cc4363 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -93,6 +93,9 @@ typedef struct MeshRuntime { /** 'BVHCache', for 'BKE_bvhutil.c' */ struct LinkNode *bvh_cache; + + int deformed_only; /* set by modifier stack if only deformed from original */ + char padding[4]; } MeshRuntime; typedef struct Mesh { diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index f3da8d054ec..c5593cd004e 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -313,6 +313,7 @@ Mesh *get_mesh( LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW, false); + mesh->runtime.deformed_only = 1; } /* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether |