diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-08 09:29:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-08 09:31:32 +0300 |
commit | 772c4d6313ad842bbdfe101267f0bd34186e8a6f (patch) | |
tree | 10dc427c3368d0152c9fd7fea30e463665387cd6 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | 215c23590aa7ea0cbb113d75c32ccf57ffee3fd3 (diff) |
Edit Mesh: basic show in edit mode support
Note this is just using the derived-mesh data at the moment,
to support this properly we'll need to remove derived-mesh.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 4fe7a32a824..e1787c2650b 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -53,6 +53,7 @@ #include "BKE_mesh.h" #include "BKE_mesh_tangent.h" #include "BKE_colorband.h" +#include "BKE_cdderivedmesh.h" #include "bmesh.h" @@ -4459,6 +4460,19 @@ GPUBatch **DRW_mesh_batch_cache_get_surface_shaded( MeshBatchCache *cache = mesh_batch_cache_get(me); if (cache->shaded_triangles == NULL) { + + /* Hack to show the final result. */ + const bool use_em_final = ( + me->edit_btmesh && + me->edit_btmesh->derivedFinal && + (me->edit_btmesh->derivedFinal->type == DM_TYPE_CDDM)); + Mesh me_fake; + if (use_em_final) { + memset(&me_fake, 0x0, sizeof(me_fake)); + CDDM_to_mesh__fast_borrow(me->edit_btmesh->derivedFinal, &me_fake, me); + me = &me_fake; + } + /* create batch from DM */ const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI | |