Commit: 1131e33026297597037e89803330f9417a535838
Author: Germano Cavalcante
Date:   Mon Mar 9 15:09:26 2020 -0300
Branches: master
https://developer.blender.org/rB1131e33026297597037e89803330f9417a535838

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

===================================================================

M       source/blender/draw/engines/overlay/overlay_wireframe.c

===================================================================

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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to