[Bf-blender-cvs] [8a6604f253e] temp-gpencil-masking: Merge branch 'master' into temp-gpencil-masking
Antonio Vazquez
noreply at git.blender.org
Wed May 26 12:43:25 CEST 2021
Commit: 8a6604f253e22bbade3dcf60b9a1c437ace44151
Author: Antonio Vazquez
Date: Wed May 26 12:43:03 2021 +0200
Branches: temp-gpencil-masking
https://developer.blender.org/rB8a6604f253e22bbade3dcf60b9a1c437ace44151
Merge branch 'master' into temp-gpencil-masking
Conflicts:
source/blender/blenloader/intern/versioning_300.c
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_300.c
index e52067a03b3,8c5e86eadd3..aa267a18163
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@@ -21,38 -21,31 +21,50 @@@
#define DNA_DEPRECATED_ALLOW
#include "BLI_listbase.h"
+ #include "BLI_math_vector.h"
#include "BLI_utildefines.h"
+ #include "DNA_brush_types.h"
#include "DNA_genfile.h"
++#include "DNA_gpencil_types.h"
#include "DNA_modifier_types.h"
+ #include "DNA_text_types.h"
- #include "DNA_gpencil_types.h"
+ #include "BKE_lib_id.h"
+
#include "BKE_main.h"
+ #include "BKE_node.h"
#include "BLO_readfile.h"
#include "readfile.h"
void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
{
- if (!MAIN_VERSION_ATLEAST(bmain, 300, 0)) {
+ if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) {
+ /* Set zero user text objects to have a fake user. */
+ LISTBASE_FOREACH (Text *, text, &bmain->texts) {
+ if (text->id.us == 0) {
+ id_fake_user_set(&text->id);
+ }
+ }
++
+ /* Grease Pencil Masking Intersect. */
+ Scene *scene = bmain->scenes.first;
+ if (scene != NULL) {
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ if (ob->type != OB_GPENCIL) {
+ continue;
+ }
+ bGPdata *gpd = ob->data;
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ LISTBASE_FOREACH (bGPDlayer_Mask *, mask, &gpl->mask_layers) {
+ mask->flag |= GP_MASK_INTERSECT;
+ }
+ }
+ }
+ }
}
+
/**
* Versioning code until next subversion bump goes here.
*
diff --cc source/blender/draw/engines/gpencil/gpencil_engine.c
index c14159b5432,32884eb9e3f..f0ede19f8ec
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@@ -835,23 -818,13 +835,26 @@@ static void gpencil_draw_mask(GPENCIL_D
GPU_framebuffer_clear_color_depth(fbl->mask_fb, clear_col, clear_depth);
}
+ if (!BLI_BITMAP_TEST_BOOL(layer->mask_union_bits, i)) {
+ /* mask_intersect_fb is the same as mask_fb it can even reuse the same color & depth
+ texture.
+ * But it needs a dedicated mask_tx (named mask_intersect_tx). */
+ GPU_framebuffer_bind(fbl->mask_intersect_fb);
+ GPU_framebuffer_clear_color(fbl->mask_intersect_fb, clear_col);
+ }
+
GPENCIL_tLayer *mask_layer = gpencil_layer_cache_get(ob, i);
- BLI_assert(mask_layer);
+ /* When filtering by viewlayer, the mask could be null and must be ignored. */
+ if (mask_layer == NULL) {
+ continue;
+ }
DRW_draw_pass(mask_layer->geom_ps);
+
+ if (!BLI_BITMAP_TEST_BOOL(layer->mask_union_bits, i)) {
+ /* Fullscreen quad outputing. 1.0 - mask_intersect_tx in multiply blend mode. */
+ DRW_draw_pass(psl->mask_intersect_ps);
+ }
}
if (!inverted) {
More information about the Bf-blender-cvs
mailing list