Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-06-07 14:06:03 +0300
committerJeroen Bakker <jeroen@blender.org>2020-06-11 09:32:49 +0300
commit2c3ef36a0b7fe301e32137a17635ceefaa1de791 (patch)
tree96691d1325d09964d9955a47fb5b76f12f49cbc2 /source
parent0402cc7e9eb3916f7e212d546037b00abffeab4f (diff)
Fix T77520: GPencil viewlayer filter produce crash with masking layers
If a layer is used for masking, it cannot be filtered by viewlayer because the masked layer needs to have the mask layers in the draw pipeline. This check is only done in final render.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 99ee2a0fc9e..1f6c0e96519 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1832,6 +1832,25 @@ bool BKE_gpencil_from_image(SpaceImage *sima, bGPDframe *gpf, const float size,
return done;
}
+/**
+ * Helper to check if a layers is used as mask
+ * \param gpd Grease pencil datablock
+ * \param gpl_mask Actual Layer
+ * \return True if the layer is a mask
+ */
+static bool gpencil_is_layer_mask(bGPdata *gpd, bGPDlayer *gpl_mask)
+{
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ LISTBASE_FOREACH (bGPDlayer_Mask *, mask, &gpl->mask_layers) {
+ if (STREQ(gpl_mask->info, mask->name)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
/* -------------------------------------------------------------------- */
/** \name Iterators
*
@@ -1873,7 +1892,11 @@ void BKE_gpencil_visible_stroke_iter(ViewLayer *view_layer,
* This is used only in final render and never in Viewport. */
if ((view_layer != NULL) && (gpl->viewlayername[0] != '\0') &&
(!STREQ(view_layer->name, gpl->viewlayername))) {
- continue;
+ /* 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)) {
+ continue;
+ }
}
if (is_multiedit) {