diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-03-09 21:09:26 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-03-09 21:09:26 +0300 |
commit | 1131e33026297597037e89803330f9417a535838 (patch) | |
tree | a88e365353860e171853405fa3c4da33d434b608 /source/blender/draw/engines | |
parent | a468368540491a9364eb845fa25f2f421488d278 (diff) |
Fix T74438: Vertex-only meshes disappear in wireframe mode
The problem happens because, in wireframe mode, `bool use_wire` is
always `true`, so the function that draws all edges is the called.
The solution is set `use_wire` as `false` when the mesh has no edges.
This matches the behavior of blender 2.79.
Reviewed By: fclem, brecht
Differential Revision: https://developer.blender.org/D7041
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_wireframe.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index 4df9faace18..ba3b380808e 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -129,8 +129,10 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES) != 0; const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0; const bool is_mesh = ob->type == OB_MESH; - const bool use_wire = (pd->overlay.flag & V3D_OVERLAY_WIREFRAMES) || (ob->dtx & OB_DRAWWIRE) || - (ob->dt == OB_WIRE); + const bool is_mesh_verts_only = is_mesh && (((Mesh *)ob->data)->totedge == 0 && + ((Mesh *)ob->data)->totvert > 0); + const bool use_wire = !is_mesh_verts_only && ((pd->overlay.flag & V3D_OVERLAY_WIREFRAMES) || + (ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE)); if (ELEM(ob->type, OB_CURVE, OB_SURF)) { OVERLAY_ExtraCallBuffers *cb = OVERLAY_extra_call_buffer_get(vedata, ob); @@ -225,7 +227,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color); /* Draw loose geometry. */ - if (me->totedge == 0 && me->totvert > 0) { + if (is_mesh_verts_only) { struct GPUBatch *geom = DRW_cache_mesh_all_verts_get(ob); if (geom) { OVERLAY_extra_loose_points(cb, geom, ob->obmat, color); |