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
This commit is contained in:
Antonio Vazquez 2020-03-21 13:22:27 +01:00
parent c589fdc8db
commit 1e8dfe79c6
2 changed files with 8 additions and 0 deletions

View File

@ -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);
}

View File

@ -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;