diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-03-21 15:22:27 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-03-21 22:29:17 +0300 |
commit | 1e8dfe79c6b2ec293146d93be44c8078762860f2 (patch) | |
tree | b299c3e488a6d3b178f96f3f13b2e5e6ed3afc1c /source/blender/draw/engines/gpencil | |
parent | c589fdc8dba15b39d2423904388aa73ff57a04ab (diff) |
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
Diffstat (limited to 'source/blender/draw/engines/gpencil')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.h | 2 |
2 files changed, 8 insertions, 0 deletions
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; |