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.
This commit is contained in:
parent
46aec45b2a
commit
dbe4189dcd
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue