diff options
author | Hans Goudey <h.goudey@me.com> | 2021-12-02 05:47:57 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-01-11 10:42:11 +0300 |
commit | a8a9a08bf7865dc6d2495e12b456751b458cae40 (patch) | |
tree | 14983ed5ba027deb3128a015bf757e5f2766a685 | |
parent | 88f8b01e669db8877bed87e1d2fc9ad5e4d885a0 (diff) |
Fix T84710: Instances with only mesh edges or vertices are invisible
Wire-only meshes have a special case in the overlay drawing to give
the wire shader a special color (which avoids the lines being dashed,
somehow). The fast path for duplis didn't have that special case.
Differential Revision: https://developer.blender.org/D13196
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_wireframe.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index fde376beeb2..449130c4c5b 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -237,7 +237,21 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, if (dupli && !init_dupli) { if (dupli->wire_shgrp && dupli->wire_geom) { if (dupli->base_flag == ob->base_flag) { - DRW_shgroup_call(dupli->wire_shgrp, dupli->wire_geom, ob); + /* Check for the special cases used below, assign specific theme colors to the shaders. */ + OVERLAY_ExtraCallBuffers *cb = OVERLAY_extra_call_buffer_get(vedata, ob); + if (dupli->wire_shgrp == cb->extra_loose_points) { + float *color; + DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color); + OVERLAY_extra_loose_points(cb, dupli->wire_geom, ob->obmat, color); + } + else if (dupli->wire_shgrp == cb->extra_wire) { + float *color; + DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color); + OVERLAY_extra_wire(cb, dupli->wire_geom, ob->obmat, color); + } + else { + DRW_shgroup_call(dupli->wire_shgrp, dupli->wire_geom, ob); + } return; } } @@ -268,6 +282,9 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, } } + DRWShadingGroup *shgrp = NULL; + struct GPUBatch *geom = NULL; + /* Don't do that in edit Mesh mode, unless there is a modifier preview. */ if (use_wire && (!is_mesh || (!is_edit_mode || has_edit_mesh_cage))) { const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) && (ob->sculpt != NULL); @@ -275,8 +292,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, !DRW_state_is_image_render(); const bool use_coloring = (use_wire && !is_edit_mode && !is_sculpt_mode && !has_edit_mesh_cage); - DRWShadingGroup *shgrp = NULL; - struct GPUBatch *geom = DRW_cache_object_face_wireframe_get(ob); + geom = DRW_cache_object_face_wireframe_get(ob); if (geom || use_sculpt_pbvh) { if (use_sculpt_pbvh) { @@ -300,11 +316,6 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, DRW_shgroup_call(shgrp, geom, ob); } } - - if (dupli) { - dupli->wire_shgrp = shgrp; - dupli->wire_geom = geom; - } } else if (is_mesh && (!is_edit_mode || has_edit_mesh_cage)) { OVERLAY_ExtraCallBuffers *cb = OVERLAY_extra_call_buffer_get(vedata, ob); @@ -313,18 +324,25 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, /* Draw loose geometry. */ if (is_mesh_verts_only) { - struct GPUBatch *geom = DRW_cache_mesh_all_verts_get(ob); + geom = DRW_cache_mesh_all_verts_get(ob); if (geom) { OVERLAY_extra_loose_points(cb, geom, ob->obmat, color); + shgrp = cb->extra_loose_points; } } else { - struct GPUBatch *geom = DRW_cache_mesh_loose_edges_get(ob); + geom = DRW_cache_mesh_loose_edges_get(ob); if (geom) { OVERLAY_extra_wire(cb, geom, ob->obmat, color); + shgrp = cb->extra_wire; } } } + + if (dupli) { + dupli->wire_shgrp = shgrp; + dupli->wire_geom = geom; + } } void OVERLAY_wireframe_draw(OVERLAY_Data *data) |