[Bf-blender-cvs] [7fda7fb750a] blender2.8: GP: Force Fill triangulation data recalc

Antonioya noreply at git.blender.org
Tue Aug 21 19:55:36 CEST 2018


Commit: 7fda7fb750a9436f4c9a69375113b79502ea6dc1
Author: Antonioya
Date:   Tue Aug 21 19:45:59 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB7fda7fb750a9436f4c9a69375113b79502ea6dc1

GP: Force Fill triangulation data recalc

Add a general parameter to force the recalc of the triangulation data because some modifiers could change the geometry and the filling triangles would not be right.

Now, the parameter is visible in UI panel because this option reduces FPS, but maybe in the future we can keep always ON and remove the parameter.

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
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 effa527e6db..169b521a2eb 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -367,6 +367,8 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         layout.prop(gpd, "edit_line_color", text="Edit Line Color")
         layout.prop(ob, "empty_draw_size", text="Marker Size")
 
+        layout.prop(gpd, "force_fill_recalc", text="Force Fill Update")
+
         col = layout.column(align=True)
         col.prop(gpd, "show_constant_thickness")
         sub = col.column()
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index d1c455f64e1..512f6f73927 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -403,6 +403,19 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g
 
 			if (mti && mti->deformStroke) {
 				mti->deformStroke(md, depsgraph, ob, gpl, gps);
+
+				/* some modifiers could require a recalc of fill triangulation data */
+				if (gpd->flag & GP_DATA_STROKE_FORCE_RECALC) {
+					if (ELEM(md->type,
+							eGpencilModifierType_Hook,
+							eGpencilModifierType_Lattice,
+							eGpencilModifierType_Noise,
+							eGpencilModifierType_Offset,
+							eGpencilModifierType_Smooth)) {
+
+						gps->flag |= GP_STROKE_RECALC_CACHES;
+					}
+				}
 			}
 		}
 	}
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 0cc7e9e40da..3727ca9a3f3 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -408,7 +408,4 @@ typedef enum eSmoothGpencil_Flag {
 	GP_SMOOTH_MOD_UV         = (1 << 6),
 } eSmoothGpencil_Flag;
 
-#define MOD_MESHSEQ_READ_ALL \
-	(MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)
-
 #endif  /* __DNA_GPENCIL_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index b1c3239c55c..f4a13801949 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -421,6 +421,12 @@ typedef enum eGPdata_Flag {
 
 	/* Allow edit several frames at the same time */
 	GP_DATA_STROKE_MULTIEDIT = (1 << 16),
+
+	/* Force fill recalc if use deformation modifiers.
+	 * this is required if the stroke is deformed and the triangulation data is
+	 * not valid.
+	 */
+	GP_DATA_STROKE_FORCE_RECALC = (1 << 17),
 } eGPdata_Flag;
 
 /* gpd->onion_flag */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index c4aa90fb61b..8bb7b7ebcc2 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1318,6 +1318,11 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "MultiFrame", "Edit strokes from multiple grease pencil keyframes at the same time (keyframes must be selected to be included)");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+	prop = RNA_def_property(srna, "force_fill_recalc", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_FORCE_RECALC);
+	RNA_def_property_ui_text(prop, "Force Fill Update", "Force recalc of fill data after use deformation modifiers (reduce FPS)");
+	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
 	prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "line_color");
 	RNA_def_property_array(prop, 4);



More information about the Bf-blender-cvs mailing list