[Bf-blender-cvs] [630472a615e] temp-gpencil-eval: GPencil: Move triangulation to modifiers and remove force fill recalc
Antonio Vazquez
noreply at git.blender.org
Fri Jan 17 08:55:42 CET 2020
Commit: 630472a615e0869e8af4a4f3eaa21c03cc615b0d
Author: Antonio Vazquez
Date: Fri Jan 17 08:55:33 2020 +0100
Branches: temp-gpencil-eval
https://developer.blender.org/rB630472a615e0869e8af4a4f3eaa21c03cc615b0d
GPencil: Move triangulation to modifiers and remove force fill recalc
===================================================================
M release/scripts/startup/bl_ui/properties_data_gpencil.py
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/gpencil_modifier.c
M source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
M source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
M source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
M source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.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 3ba0d5582d7..192b68e6c10 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -367,8 +367,6 @@ class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel):
sub.active = gpd.stroke_thickness_space == 'WORLDSPACE'
sub.prop(gpd, "pixel_factor", text="Thickness Scale")
- layout.prop(gpd, "use_force_fill_recalc", text="Force Fill Update")
-
class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
bl_label = "Viewport Display"
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 153b2d06d5f..f577563641a 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -437,7 +437,6 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
/* general flags */
gpd->flag |= GP_DATA_VIEWALIGN;
- gpd->flag |= GP_DATA_STROKE_FORCE_RECALC;
/* always enable object onion skin switch */
gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
/* GP object specific settings */
@@ -1795,6 +1794,7 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, const float dist, const bool sel
gps->totpoints = i;
+ /* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gps);
return true;
@@ -3177,6 +3177,9 @@ void BKE_gpencil_merge_distance_stroke(bGPDframe *gpf,
if (tagged) {
BKE_gpencil_dissolve_points(gpf, gps, GP_SPOINT_TAG);
}
+
+ /* Calc geometry data. */
+ BKE_gpencil_stroke_geometry_update(gps);
}
/* Helper: Check materials with same color. */
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 4cc224438f4..e145df56e5c 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -192,6 +192,7 @@ void BKE_gpencil_simplify_stroke(bGPDstroke *gps, float epsilon)
gps->totpoints = j;
+ /* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gps);
MEM_SAFE_FREE(old_points);
@@ -253,6 +254,7 @@ void BKE_gpencil_simplify_fixed(bGPDstroke *gps)
}
gps->totpoints = j;
+ /* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gps);
MEM_SAFE_FREE(old_points);
@@ -377,20 +379,6 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
if (mti && mti->deformStroke) {
mti->deformStroke(md, depsgraph, ob, gpl, gpf, gps);
- /* Subdivide always requires geometry update. */
- if (md->type == eGpencilModifierType_Subdiv) {
- BKE_gpencil_stroke_geometry_update(gps);
- }
- /* Some modifiers could require a recalc of fill triangulation data. */
- else if (gpd->flag & GP_DATA_STROKE_FORCE_RECALC) {
- if (ELEM(md->type,
- eGpencilModifierType_Armature,
- eGpencilModifierType_Hook,
- eGpencilModifierType_Lattice,
- eGpencilModifierType_Offset)) {
- BKE_gpencil_stroke_geometry_update(gps);
- }
- }
}
}
}
@@ -790,6 +778,8 @@ void BKE_gpencil_subdivide(bGPDstroke *gps, int level, int flag)
MEM_SAFE_FREE(temp_points);
}
}
+
+ /* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gps);
}
@@ -956,13 +946,6 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
/* Apply modifiers that only deform geometry */
BKE_gpencil_stroke_modifiers(depsgraph, ob, gpl, gpf, gps, is_render);
}
-
- /* Review triangulation for filling after applying modifiers and verify if any updated is
- * required.
- * This is needed if some modifiers tagged the stroke triangulation to be recalc. */
- LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
- BKE_gpencil_stroke_geometry_update(gps);
- }
}
/* Clear any lattice data. */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 27c8175af3f..ea3f24ea2e3 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -116,6 +116,8 @@ static void deformStroke(GpencilModifierData *md,
}
gpencil_deform_verts(mmd, ob, gps);
+ /* Calc geometry data. */
+ BKE_gpencil_stroke_geometry_update(gps);
}
static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData *md, Object *ob)
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index bc62d0d69bb..d41827c77ec 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -263,6 +263,8 @@ static void deformStroke(GpencilModifierData *md,
}
gp_hook_co_apply(&tData, weight, pt);
}
+ /* Calc geometry data. */
+ BKE_gpencil_stroke_geometry_update(gps);
}
/* FIXME: Ideally we be doing this on a copy of the main depsgraph
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 9dbf7b35bc5..7a6295fa0a8 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -108,6 +108,8 @@ static void deformStroke(GpencilModifierData *md,
}
calc_latt_deform((struct LatticeDeformData *)mmd->cache_data, &pt->x, mmd->strength * weight);
}
+ /* Calc geometry data. */
+ BKE_gpencil_stroke_geometry_update(gps);
}
/* FIXME: Ideally we be doing this on a copy of the main depsgraph
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
index 70d463fff76..f906ef67606 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -108,6 +108,8 @@ static void deformStroke(GpencilModifierData *md,
mul_m4_v3(mat, &pt->x);
}
+ /* Calc geometry data. */
+ BKE_gpencil_stroke_geometry_update(gps);
}
static void bakeModifier(struct Main *UNUSED(bmain),
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 90fa02f4556..0fd7ebf5081 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -634,12 +634,6 @@ 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),
-
/* Vertex Paint Mode - Toggle paint mode */
GP_DATA_STROKE_VERTEXMODE = (1 << 18),
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 21d84d5c2f2..706f8ac505f 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1839,14 +1839,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
"(keyframes must be selected to be included)");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "use_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, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS);
RNA_def_property_ui_text(
More information about the Bf-blender-cvs
mailing list