diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-09-18 19:23:25 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-09-18 19:28:17 +0300 |
commit | 0335c1fd21dd49906968a2aa85b0016c8047f695 (patch) | |
tree | c424f99fbb8ee688156de6c51f4e9f65f3e9aa66 /source/blender/draw/engines/gpencil/gpencil_cache_utils.c | |
parent | 7b988188dc3f5ea05d90b8e16337147778f9f580 (diff) |
GPencil: Implement Holdout materials
This new feature allows to use the strokes as an eraser of any stroke below. This is very handy to open holes in filled areas.
After running some tests, we have decided to keep the additive effect of the holdout color. To get clean holdout areas, just move the color to black to remove any additive effect. To have additive effect can be used in situations like tint slightly a transparent window with blue to simulate the glass.
See T79878 for more details
Differential Revision: https://developer.blender.org/D8932
Diffstat (limited to 'source/blender/draw/engines/gpencil/gpencil_cache_utils.c')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_cache_utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c index 363794e1be3..c4997dace7e 100644 --- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c @@ -58,6 +58,17 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob) tgp_ob->is_drawmode3d = (gpd->draw_mode == GP_DRAWMODE_3D) || pd->draw_depth_only; tgp_ob->object_scale = mat4_to_scale(ob->obmat); + /* Check if any material with holdout flag enabled. */ + tgp_ob->do_mat_holdout = false; + for (int i = 0; i < ob->totcol; i++) { + MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, i + 1); + if ((gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT) || + ((gp_style->flag & GP_MATERIAL_IS_FILL_HOLDOUT))) { + tgp_ob->do_mat_holdout = true; + break; + } + } + /* Find the normal most likely to represent the gpObject. */ /* TODO: This does not work quite well if you use * strokes not aligned with the object axes. Maybe we could try to |