[Bf-blender-cvs] [f86f826f192] greasepencil-object: GP Build Modifier - Layer Masking support

Joshua Leung noreply at git.blender.org
Thu Nov 30 05:17:53 CET 2017


Commit: f86f826f192c768ac4bd7002089a19061e6b86fb
Author: Joshua Leung
Date:   Thu Nov 30 17:17:16 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rBf86f826f192c768ac4bd7002089a19061e6b86fb

GP Build Modifier - Layer Masking support

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_gpencilbuild.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 4b37991d077..ba5b2ea95bc 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1791,6 +1791,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.prop(md, "mode")
         if md.mode == 'CONCURRENT':
             col.prop(md, "concurrent_time_alignment")
+        else:
+            col.separator() # For spacing
+            col.separator()
         col.separator()
 
         col.prop(md, "transition")
@@ -1804,6 +1807,16 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         sub.active = md.use_restrict_frame_range
         sub.prop(md, "frame_start", text="Start")
         sub.prop(md, "frame_end", text="End")
+        col.separator()
+        
+        col.label("Layer:")
+        row = col.row(align=True)
+        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
+        row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
+
+#        row = col.row(align=True)
+#        row.prop(md, "pass_index", text="Pass")
+#        row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
 
     def GP_LATTICE(self, layout, ob, md):
         gpd = ob.data
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 50276ea685d..3c4fba67390 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1774,12 +1774,13 @@ typedef struct GpencilBuildModifierData {
 	ModifierData modifier;
 	
 	char layername[64];   /* if set, restrict modifier to operating on this layer */
+	int pass_index;
+	
+	int pad;
 	
 	float start_frame;    /* If GP_BUILD_RESTRICT_TIME is set, the defines the frame range where GP frames are considered */
 	float end_frame;
 	
-	/* TODO: color (paletteslot + colorname) used for appearance of stroke tips being drawn */
-	
 	float start_delay;    /* For each pair of gp keys, number of frames before strokes start appearing */
 	float length;         /* For each pair of gp keys, number of frames that build effect must be completed within */
 	
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 2ef50bf5cb0..4ec5baa8b8e 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5540,29 +5540,6 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Build Modifier", "Animate strokes appearing and disappearing");
 	RNA_def_struct_sdna(srna, "GpencilBuildModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
-
-#if 0
-	prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_sdna(prop, NULL, "layername");
-	RNA_def_property_ui_text(prop, "Layer", "Layer name");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-	prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "pass_index");
-	RNA_def_property_range(prop, 0, 100);
-	RNA_def_property_ui_text(prop, "Pass", "Pass index");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-	
-	prop = RNA_def_property(srna, "inverse_layers", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERSE_LAYER);
-	RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-	prop = RNA_def_property(srna, "inverse_pass", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERSE_PASS);
-	RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-#endif
 	
 	/* Mode */
 	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
@@ -5622,6 +5599,31 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
+	
+	/* Filters - Layer */
+	prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "layername");
+	RNA_def_property_ui_text(prop, "Layer", "Layer name");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "inverse_layers", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERSE_LAYER);
+	RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	/* Filters - Pass Index */
+#if 0
+	prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "pass_index");
+	RNA_def_property_range(prop, 0, 100);
+	RNA_def_property_ui_text(prop, "Pass", "Pass index");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "inverse_pass", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERSE_PASS);
+	RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+#endif
 }
 
 static void rna_def_modifier_gpencillattice(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_gpencilbuild.c b/source/blender/modifiers/intern/MOD_gpencilbuild.c
index 40a8d7983d0..ec7fd9ed542 100644
--- a/source/blender/modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/modifiers/intern/MOD_gpencilbuild.c
@@ -415,7 +415,19 @@ static void generateStrokes(ModifierData *md, const EvaluationContext *eval_ctx,
 		return;
 	}
 	
-	/* TODO: Layer masking */
+	/* Omit layer if filter by layer */
+	if (mmd->layername[0] != '\0') {
+		if ((mmd->flag & GP_BUILD_INVERSE_LAYER) == 0) {
+			if (!STREQ(mmd->layername, gpl->info)) {
+				return;
+			}
+		}
+		else {
+			if (STREQ(mmd->layername, gpl->info)) {
+				return;
+			}
+		}
+	}
 	
 	/* Early exit if outside of the frame range for this modifier
 	 * (e.g. to have one forward, and one backwards modifier)



More information about the Bf-blender-cvs mailing list