[Bf-blender-cvs] [39344493e36] greasepencil-object: Add Force Fill Data parameter

Antonioya noreply at git.blender.org
Thu Aug 23 10:34:34 CEST 2018


Commit: 39344493e36548d3ffb58033117ad0e9332856ff
Author: Antonioya
Date:   Tue Aug 21 19:33:39 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB39344493e36548d3ffb58033117ad0e9332856ff

Add Force Fill Data parameter

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	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.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
M	source/blender/makesrna/intern/rna_gpencil_modifier.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/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index db03d7ce3ba..37552f00116 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -2040,7 +2040,6 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         col = layout.column()
         col.label(text="Object:")
         col.prop(md, "object", text="")
-        col.prop(md, "force_recalc", text="Force Fill Update")
 
 
 classes = (
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 74d0852fbbc..974a77fdc45 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -394,6 +394,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g
 	GpencilModifierData *md;
 	bGPdata *gpd = ob->data;
 	const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd);
+	bool recalc_fill = false;
 
 	for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
 		if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
@@ -405,6 +406,20 @@ 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_Armature,
+							eGpencilModifierType_Hook,
+							eGpencilModifierType_Lattice,
+							eGpencilModifierType_Noise,
+							eGpencilModifierType_Offset,
+							eGpencilModifierType_Smooth)) {
+
+						gps->flag |= GP_STROKE_RECALC_CACHES;
+					}
+				}
 			}
 		}
 	}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index af75cdb2afe..f7c80afad67 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -355,11 +355,6 @@ static void gpencil_armature_deform_verts(ArmatureGpencilModifierData *mmd, Obje
 	}
 
 	MEM_freeN(pdef_info_array);
-
-	/* set recalc */
-	if (mmd->flag & GP_ARMATURE_RECALC_FILL) {
-		gps->flag |= GP_STROKE_RECALC_CACHES;
-	}
 }
 
 /* deform stroke */
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index b7ef2dcd89d..6048350c6a5 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -417,11 +417,4 @@ typedef struct ArmatureGpencilModifierData {
 	char pad[4];
 } ArmatureGpencilModifierData;
 
-typedef enum eArmatureGpencil_Flag {
-	GP_ARMATURE_RECALC_FILL = (1 << 0),
-} eArmatureGpencil_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);
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 383eb06c72e..b95493e0c45 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -1281,12 +1281,6 @@ static void rna_def_modifier_gpencilarmature(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
-	prop = RNA_def_property(srna, "force_recalc", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARMATURE_RECALC_FILL);
-	RNA_def_property_ui_text(prop, "Force Recalc",
-		"Force to recalc fill geometry for extreme deformations (slower FPS)");
-	RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 }
 
 void RNA_def_greasepencil_modifier(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list