From 1e8dfe79c6b2ec293146d93be44c8078762860f2 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Sat, 21 Mar 2020 13:22:27 +0100 Subject: GPencil: Fade to Viewport color Actually, the fade objects always fade to Black color, but this is not a good solution. This patch fade the object to the viewport color. Differential Revision: https://developer.blender.org/D7206 --- source/blender/draw/engines/gpencil/gpencil_engine.c | 6 ++++++ source/blender/draw/engines/gpencil/gpencil_engine.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'source/blender/draw') diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 0270b1a1d8c..1b511ea1f7f 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -91,6 +91,7 @@ void GPENCIL_engine_init(void *ved) stl->pd->gp_layer_pool = vldata->gp_layer_pool; stl->pd->gp_vfx_pool = vldata->gp_vfx_pool; stl->pd->scene = ctx->scene; + stl->pd->v3d = ctx->v3d; stl->pd->last_light_pool = NULL; stl->pd->last_material_pool = NULL; stl->pd->tobjects.first = NULL; @@ -905,6 +906,11 @@ void GPENCIL_draw_scene(void *ved) /* Fade 3D objects. */ if ((!pd->is_render) && (pd->fade_3d_object_opacity > -1.0f)) { + float background_color[3]; + ED_view3d_background_color_get(pd->scene, pd->v3d, background_color); + /* Blend color. */ + interp_v3_v3v3(clear_cols[0], background_color, clear_cols[0], pd->fade_3d_object_opacity); + mul_v4_fl(clear_cols[1], pd->fade_3d_object_opacity); } diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index e7914a1b86c..f765dcf73de 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -309,6 +309,8 @@ typedef struct GPENCIL_PrivateData { Object *camera; /* Copy of draw_ctx->scene for convenience. */ struct Scene *scene; + /* Copy of draw_ctx->vie3d for convenience. */ + struct View3D *v3d; /* Active object. */ Object *obact; -- cgit v1.2.3