[Bf-blender-cvs] [1e8dfe79c6b] master: GPencil: Fade to Viewport color

Antonio Vazquez noreply at git.blender.org
Sat Mar 21 20:29:29 CET 2020


Commit: 1e8dfe79c6b2ec293146d93be44c8078762860f2
Author: Antonio Vazquez
Date:   Sat Mar 21 13:22:27 2020 +0100
Branches: master
https://developer.blender.org/rB1e8dfe79c6b2ec293146d93be44c8078762860f2

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

===================================================================

M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h

===================================================================

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;



More information about the Bf-blender-cvs mailing list