diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-09 12:13:07 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-09 12:13:23 +0300 |
commit | 874a078d86519cfab4be86b962b51193a6d5423f (patch) | |
tree | fedd9e980ae7e069b6d5254e31ab3e08cf35b59f | |
parent | d68e29b62ce299085f4f27e3d6a66dbfc1c89610 (diff) |
GPencil: Improve viewlayer masking check
Check if the mask layer is used in a layer that is going to be used in the current viewlayer.
Related to T77667
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 284aa57f43a..27d089b6a67 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1852,9 +1852,13 @@ bool BKE_gpencil_from_image(SpaceImage *sima, bGPDframe *gpf, const float size, * \param gpl_mask Actual Layer * \return True if the layer is a mask */ -static bool gpencil_is_layer_mask(bGPdata *gpd, bGPDlayer *gpl_mask) +static bool gpencil_is_layer_mask(ViewLayer *view_layer, bGPdata *gpd, bGPDlayer *gpl_mask) { LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + if ((gpl->viewlayername[0] != '\0') && (!STREQ(view_layer->name, gpl->viewlayername))) { + continue; + } + LISTBASE_FOREACH (bGPDlayer_Mask *, mask, &gpl->mask_layers) { if (STREQ(gpl_mask->info, mask->name)) { return true; @@ -1911,7 +1915,7 @@ void BKE_gpencil_visible_stroke_iter(ViewLayer *view_layer, (!STREQ(view_layer->name, gpl->viewlayername))) { /* If the layer is used as mask, cannot be filtered or the masking system * will crash because needs the mask layer in the draw pipeline. */ - if (!gpencil_is_layer_mask(gpd, gpl)) { + if (!gpencil_is_layer_mask(view_layer, gpd, gpl)) { continue; } } |