Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-21 20:45:59 +0300
committerAntonioya <blendergit@gmail.com>2018-08-21 20:46:29 +0300
commit7fda7fb750a9436f4c9a69375113b79502ea6dc1 (patch)
tree4f84c57a17feb9d1eec2d8413381c5454ba37845 /source/blender
parent596c3368f4b09bdeec46e7b44abfc8bcb7ba8fcf (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c13
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_types.h3
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h6
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c5
4 files changed, 24 insertions, 3 deletions
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);