diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-09-14 19:30:26 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-09-14 19:32:04 +0300 |
commit | b62d140be9319ecb1e8f38228f0f22926d7a8880 (patch) | |
tree | 92fec4b6d3307b82cc6925dcbd616452385ef3c2 /source/blender/draw/modes/object_mode.c | |
parent | 5feb03c3ae3353f1a616412f7384511f693ebc33 (diff) |
Object Mode: Make Flat object outline visible in orthographic view
Diffstat (limited to 'source/blender/draw/modes/object_mode.c')
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 1ea34949a1e..f2d316bbed1 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -2615,6 +2615,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) ViewLayer *view_layer = draw_ctx->view_layer; Scene *scene = draw_ctx->scene; View3D *v3d = draw_ctx->v3d; + RegionView3D *rv3d = draw_ctx->rv3d; ModifierData *md = NULL; int theme_id = TH_UNDEFINED; @@ -2637,12 +2638,20 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) struct GPUBatch *geom; const bool xray_enabled = ((v3d->shading.flag & V3D_SHADING_XRAY) != 0) && (v3d->shading.type < OB_MATERIAL); - if (xray_enabled) { + + /* This fixes only the biggest case which is a plane in ortho view. */ + int flat_axis = 0; + bool is_flat_object_viewed_from_side = (rv3d->persp == RV3D_ORTHO) && + DRW_object_is_flat(ob, &flat_axis) && + DRW_object_axis_orthogonal_to_view(ob, flat_axis); + + if (xray_enabled || is_flat_object_viewed_from_side) { geom = DRW_cache_object_edge_detection_get(ob, NULL); } else { geom = DRW_cache_object_surface_get(ob); } + if (geom) { theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL); DRWShadingGroup *shgroup = shgroup_theme_id_to_outline_or(stl, theme_id, NULL); |