diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2021-05-18 02:03:01 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2021-06-03 21:17:17 +0300 |
commit | dba3fb9e091acfa7d2144468a220b2b0d577c15d (patch) | |
tree | 817e5c84a1f7319b7ef7811226dabcae615b63ea /source/blender/draw/engines/overlay/overlay_engine.c | |
parent | 3e695a27cdfad560d0b28e742cfa069d098200d6 (diff) |
Overlay: Flash on Mode Transfer overlay
This implements T87633
This overlay renders a flash animation on the target object when
transfering the mode to it using the mode transfer operator.
This provides visual feedback when switching between objects without
extra overlays that affect the general color and lighting in the scene.
Differences with the design task:
- This uses just a fade out animation instead of a fade in/out animation.
The code is ready for fade in/out, but as the rest of the overlays
(face sets, masks...) change instantly without animation, having a fade
in/out effect gives the impression that the object flashes twice (once
for the face sets, twice for the peak alpha of the flash animation).
- The rendering uses a flat color without fresnel for now, but this can
be improved in the future to make it look more like the shader in the
prototype.
- Not enabled by default (can be enabled in the overlays panel), maybe
the defaults can change for 3.0 to disable fade inactive and enable this
instead.
Reviewed By: jbakker, JulienKaspar
Differential Revision: https://developer.blender.org/D11055
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_engine.c')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_engine.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c index b8f721946f2..19f822e3f68 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.c +++ b/source/blender/draw/engines/overlay/overlay_engine.c @@ -207,6 +207,7 @@ static void OVERLAY_cache_init(void *vedata) OVERLAY_armature_cache_init(vedata); OVERLAY_background_cache_init(vedata); OVERLAY_fade_cache_init(vedata); + OVERLAY_mode_transfer_cache_init(vedata); OVERLAY_extra_cache_init(vedata); OVERLAY_facing_cache_init(vedata); OVERLAY_gpencil_cache_init(vedata); @@ -323,6 +324,7 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) !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_mode_transfer = draw_surface && (pd->overlay.flag & V3D_OVERLAY_MODE_TRANSFER); 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); @@ -349,6 +351,9 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) if (draw_facing) { OVERLAY_facing_cache_populate(vedata, ob); } + if (draw_mode_transfer) { + OVERLAY_mode_transfer_cache_populate(vedata, ob); + } if (draw_wires) { OVERLAY_wireframe_cache_populate(vedata, ob, dupli, do_init); } @@ -504,6 +509,7 @@ static void OVERLAY_cache_finish(void *vedata) {GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front), GPU_ATTACHMENT_TEXTURE(dtxl->color)}); } + OVERLAY_mode_transfer_cache_finish(vedata); OVERLAY_antialiasing_cache_finish(vedata); OVERLAY_armature_cache_finish(vedata); OVERLAY_image_cache_finish(vedata); @@ -566,6 +572,7 @@ static void OVERLAY_draw_scene(void *vedata) OVERLAY_image_draw(vedata); OVERLAY_fade_draw(vedata); OVERLAY_facing_draw(vedata); + OVERLAY_mode_transfer_draw(vedata); OVERLAY_extra_blend_draw(vedata); OVERLAY_volume_draw(vedata); @@ -605,6 +612,7 @@ static void OVERLAY_draw_scene(void *vedata) OVERLAY_fade_infront_draw(vedata); OVERLAY_facing_infront_draw(vedata); + OVERLAY_mode_transfer_infront_draw(vedata); if (DRW_state_is_fbo()) { GPU_framebuffer_bind(fbl->overlay_line_in_front_fb); |