Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-05 22:33:28 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-05 23:57:49 +0300
commit0424ee86f0082db3a62f2f833bca63dd2e899dae (patch)
tree9e1c589c1ee89bb96e6600ca125f96d9734632ee
parentefe769f3f0d3cf5e5aea202717b2d9e60a16c651 (diff)
Fix T58407: Wire frames are not showing with subdivision surfaces
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c23
-rw-r--r--source/blender/draw/modes/overlay_mode.c20
2 files changed, 39 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 3a87cd70a45..3904cdc78af 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -4413,7 +4413,6 @@ static GPUTexture *mesh_batch_cache_get_edges_overlay_texture_buf(
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI));
- BLI_assert(rdata->edit_bmesh == NULL); /* Not supported in edit mode */
if (cache->edges_face_overlay_tx != NULL) {
return cache->edges_face_overlay_tx;
@@ -5109,6 +5108,28 @@ void DRW_mesh_batch_cache_get_wireframes_face_texbuf(
if (cache->edges_face_overlay_tx == NULL || cache->pos_in_order_tx == NULL) {
const int options = MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI;
+ /* Hack to show the final result. */
+ BMesh *bm_mapped = NULL;
+ const int *p_origindex = NULL;
+ const bool use_em_final = (
+ me->edit_btmesh &&
+ me->edit_btmesh->mesh_eval_final &&
+ (me->edit_btmesh->mesh_eval_final->runtime.is_original == false));
+ Mesh me_fake;
+ if (use_em_final) {
+ /* Pass in mapped args. */
+ bm_mapped = me->edit_btmesh->bm;
+ p_origindex = CustomData_get_layer(&me->edit_btmesh->mesh_eval_final->pdata, CD_ORIGINDEX);
+ if (p_origindex == NULL) {
+ bm_mapped = NULL;
+ }
+
+ me_fake = *me->edit_btmesh->mesh_eval_final;
+ me_fake.mat = me->mat;
+ me_fake.totcol = me->totcol;
+ me = &me_fake;
+ }
+
MeshRenderData *rdata = mesh_render_data_create(me, options);
mesh_batch_cache_get_edges_overlay_texture_buf(rdata, cache, reduce_len);
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c
index 43ec7ab26bb..46330d4d81c 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -23,8 +23,10 @@
* \ingroup draw_engine
*/
+#include "DNA_mesh_types.h"
#include "DNA_view3d_types.h"
+#include "BKE_editmesh.h"
#include "BKE_object.h"
#include "GPU_shader.h"
@@ -251,8 +253,20 @@ static void overlay_cache_populate(void *vedata, Object *ob)
(ob->dtx & OB_DRAWWIRE) ||
(ob->dt == OB_WIRE))
{
- /* Don't do that in edit Mesh mode. */
- if (((ob != draw_ctx->object_edit) && !BKE_object_is_in_editmode(ob)) || ob->type != OB_MESH) {
+ bool has_edit_mesh_cage = false;
+ if (ob->type == OB_MESH) {
+ /* TODO: Should be its own function. */
+ Mesh *me = (Mesh *)ob->data;
+ BMEditMesh *embm = me->edit_btmesh;
+ if (embm) {
+ has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
+ }
+ }
+
+ /* Don't do that in edit Mesh mode, unless there is a modifier preview. */
+ if ((((ob != draw_ctx->object_edit) && !BKE_object_is_in_editmode(ob)) || has_edit_mesh_cage) ||
+ ob->type != OB_MESH)
+ {
const bool is_active = (ob == draw_ctx->obact);
const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0;
const bool all_wires = (stl->g_data->overlay.wireframe_threshold == 1.0f) ||
@@ -295,7 +309,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
DRW_cache_object_face_wireframe_get(ob, &verts, &faceids, &tri_count, reduced_tri_len);
if (verts) {
float *rim_col = ts.colorWire;
- if ((ob->base_flag & BASE_SELECTED) != 0) {
+ if (!has_edit_mesh_cage && ((ob->base_flag & BASE_SELECTED) != 0)) {
rim_col = (ob == draw_ctx->obact) ? ts.colorActive : ts.colorSelect;
}
DRWPass *pass = (all_wires) ? psl->face_wireframe_full_pass : psl->face_wireframe_pass;