[Bf-blender-cvs] [742c5a0018b] greasepencil-refactor: GPencil: Initial implementation of the layer mask relationship

Antonio Vazquez noreply at git.blender.org
Wed Feb 5 19:46:29 CET 2020


Commit: 742c5a0018bd7d2df53d12ceeeba038450eaabae
Author: Antonio Vazquez
Date:   Wed Feb 5 19:46:21 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB742c5a0018bd7d2df53d12ceeeba038450eaabae

GPencil: Initial implementation of the layer mask relationship

Now, there is a new parameter to define the mask used by layer.

Still pending to remove old `use_mask` property in C and python (not removed yet to keep running the masking UI).

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 192b68e6c10..02745874283 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -174,6 +174,8 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
             if not gpl.mask_layer:
                 col = layout.row(align=True)
                 col.prop(gpl, "blend_mode", text="Blend")
+                col = layout.row(align=True)
+                col.prop_search(gpl, "mask_layer_name", gpd, "layers", icon='GREASEPENCIL')
 
             col = layout.row(align=True)
             col.prop(gpl, "opacity", text="Opacity", slider=True)
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index ee674001caf..5ec6c81080b 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -397,7 +397,7 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti
 
   /* Enable always affected by scene lights. */
   gpl->flag |= GP_LAYER_USE_LIGHTS;
-
+  gpl->mask_layer[0] = '\0';
   /* make this one the active one */
   if (setactive) {
     BKE_gpencil_layer_active_set(gpd, gpl);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 3a012ce0949..409b758d570 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -403,6 +403,9 @@ typedef struct bGPDlayer {
   float gcolor_next[3];
   char _pad1[4];
 
+  /** Mask Layer name. */
+  char mask_layer[64];
+
   bGPDlayer_Runtime runtime;
 } bGPDlayer;
 
@@ -431,7 +434,7 @@ typedef enum eGPDlayer_Flag {
   /* Unlock color */
   GP_LAYER_UNLOCK_COLOR = (1 << 12),
   /* Mask Layer */
-  GP_LAYER_USE_MASK = (1 << 13),
+  GP_LAYER_USE_MASK = (1 << 13), /*TODO: DEPRECATED */
   /* Ruler Layer */
   GP_LAYER_IS_RULER = (1 << 14),
   /* Invert masking behavior */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index ec344d99414..ffe8845b6d5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1477,6 +1477,11 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+  prop = RNA_def_property(srna, "mask_layer_name", PROP_STRING, PROP_NONE);
+  RNA_def_property_string_sdna(prop, NULL, "mask_layer");
+  RNA_def_property_ui_text(prop, "Mask", "Name of the masking layer");
+  RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
   /* Flags */
   prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
@@ -1512,13 +1517,14 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
       prop, "Disallow Locked Materials Editing", "Avoids editing locked materials in the layer");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
+#  /* TODO: Deprecated */
   prop = RNA_def_property(srna, "mask_layer", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_MASK);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_layer_mask_set");
   RNA_def_property_ui_text(prop, "Mask Layer", "Mask pixels from underlying layers drawing");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
+#
   prop = RNA_def_property(srna, "invert_mask", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_MASK_INVERT);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);



More information about the Bf-blender-cvs mailing list