diff options
author | Pablo Dobarro <pablodp606> | 2020-09-18 20:20:22 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-09-18 20:24:58 +0300 |
commit | ea6cd1c8f05b27a81e835251e779f047a3488203 (patch) | |
tree | f474690da2ddba60ca0feb2664141f65cde38a5d /source/blender/draw/engines/overlay/overlay_engine.c | |
parent | 5855f317a7070d69dbb94761c5a2c2f53b058a6e (diff) |
Overlay: Fade Inactive Geometry
This implements a new overlay that blends the bakground color over the
objects that are not in the same mode as the active object, making
them fade with the background.
This is especially needed for sculpt mode as there is no other overlay
or indication in the viewport to display which object is active.
This is intended to be used with D7510 in order to have a faster
workflow when sculpting models with multiple objects.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D8679
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_engine.c')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_engine.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c index 9cdd371ec4e..e93b505e8b7 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.c +++ b/source/blender/draw/engines/overlay/overlay_engine.c @@ -196,6 +196,7 @@ static void OVERLAY_cache_init(void *vedata) OVERLAY_antialiasing_cache_init(vedata); OVERLAY_armature_cache_init(vedata); OVERLAY_background_cache_init(vedata); + OVERLAY_fade_cache_init(vedata); OVERLAY_extra_cache_init(vedata); OVERLAY_facing_cache_init(vedata); OVERLAY_gpencil_cache_init(vedata); @@ -259,6 +260,27 @@ static bool overlay_object_is_edit_mode(const OVERLAY_PrivateData *pd, const Obj return false; } +static bool overlay_should_fade_object(Object *ob, Object *active_object) +{ + if (!active_object || !ob) { + return false; + } + + if (ELEM(active_object->mode, OB_MODE_OBJECT, OB_MODE_POSE)) { + return false; + } + + if ((active_object->mode & ob->mode) != 0) { + return false; + } + + if (ob->base_flag & BASE_FROM_DUPLI) { + return false; + } + + return true; +} + static void OVERLAY_cache_populate(void *vedata, Object *ob) { OVERLAY_Data *data = vedata; @@ -295,6 +317,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) const bool draw_surface = (ob->dt >= OB_WIRE) && (renderable || (ob->dt == OB_WIRE)); const bool draw_facing = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) && !is_select; + const bool draw_fade = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FADE_INACTIVE) && + overlay_should_fade_object(ob, draw_ctx->obact); const bool draw_bones = (pd->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0; const bool draw_wires = draw_surface && has_surface && (pd->wireframe_mode || !pd->hide_overlays); @@ -315,6 +339,9 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) bool do_init; OVERLAY_DupliData *dupli = OVERLAY_duplidata_get(ob, vedata, &do_init); + if (draw_fade) { + OVERLAY_fade_cache_populate(vedata, ob); + } if (draw_facing) { OVERLAY_facing_cache_populate(vedata, ob); } @@ -511,6 +538,7 @@ static void OVERLAY_draw_scene(void *vedata) } OVERLAY_image_draw(vedata); + OVERLAY_fade_draw(vedata); OVERLAY_facing_draw(vedata); OVERLAY_extra_blend_draw(vedata); @@ -538,6 +566,7 @@ static void OVERLAY_draw_scene(void *vedata) GPU_framebuffer_bind(fbl->overlay_in_front_fb); } + OVERLAY_fade_infront_draw(vedata); OVERLAY_facing_infront_draw(vedata); if (DRW_state_is_fbo()) { |