Modifier: Fix cage option for deform modifiers

Show-on-cage and show-in-editmode options now work as it did in 2.7x
(but only for deformation).
This commit is contained in:
Campbell Barton
2018-10-10 15:50:13 +11:00
parent 606ac3eb7f
commit 84cf670d1d
3 changed files with 14 additions and 4 deletions

View File

@@ -576,6 +576,7 @@ void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int
/* This is a direct copy of a main mesh, so for now it has the same topology. */
me_dst->runtime.deformed_only = 1;
}
me_dst->runtime.is_original = false;
me_dst->mselect = MEM_dupallocN(me_dst->mselect);
me_dst->bb = MEM_dupallocN(me_dst->bb);
@@ -709,7 +710,7 @@ Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference)
}
Mesh *result;
BKE_id_copy_ex( NULL, &source->id, (ID **)&result, flags, false);
BKE_id_copy_ex(NULL, &source->id, (ID **)&result, flags, false);
return result;
}
@@ -770,10 +771,13 @@ Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(
BMEditMesh *em, CustomDataMask data_mask, float (*vertexCos)[3])
{
Mesh *me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, data_mask);
/* Use editmesh directly where possible. */
me->runtime.is_original = true;
if (vertexCos) {
/* We will own this array in the future. */
BKE_mesh_apply_vert_coords(me, vertexCos);
MEM_freeN(vertexCos);
me->runtime.is_original = false;
}
return me;
}

View File

@@ -4471,7 +4471,7 @@ GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(
const bool use_em_final = (
me->edit_btmesh &&
me->edit_btmesh->mesh_eval_final &&
(me->edit_btmesh->mesh_eval_final->runtime.deformed_only == false));
(me->edit_btmesh->mesh_eval_final->runtime.is_original == false));
Mesh me_fake;
if (use_em_final) {
me_fake = *me->edit_btmesh->mesh_eval_final;

View File

@@ -100,8 +100,14 @@ typedef struct Mesh_Runtime {
/** 'BVHCache', for 'BKE_bvhutil.c' */
struct LinkNode *bvh_cache;
int deformed_only; /* set by modifier stack if only deformed from original */
char padding[4];
/** Set by modifier stack if only deformed from original. */
char deformed_only;
/**
* Copied from edit-mesh (hint, draw with editmesh data).
* In the future we may leave the mesh-data empty
* since its not needed if we can use edit-mesh data. */
char is_original;
char padding[6];
} Mesh_Runtime;
typedef struct Mesh {