diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-10 07:50:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-10 07:53:52 +0300 |
commit | 84cf670d1d86f69aecbb6307aa49650e958d7845 (patch) | |
tree | 34229fcf531111ed8297937f0bb0b765284a37f5 /source | |
parent | 606ac3eb7f4c93466eb666fe0ae9b6494a4e1bb6 (diff) |
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).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mesh_types.h | 10 |
3 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index ff8c0076f7b..b58bf58750e 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -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; } diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 43ae3f5f483..d81780fcd9b 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -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; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 656f9fa3034..c591b57002a 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -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 { |