[Bf-blender-cvs] [e61e177e4c9] temp-gpencil-eval: Remove gp_style parameter
Antonio Vazquez
noreply at git.blender.org
Thu Jan 16 22:56:56 CET 2020
Commit: e61e177e4c9d28a3d4dbd3e6e23e70a182e95705
Author: Antonio Vazquez
Date: Thu Jan 16 18:40:59 2020 +0100
Branches: temp-gpencil-eval
https://developer.blender.org/rBe61e177e4c9d28a3d4dbd3e6e23e70a182e95705
Remove gp_style parameter
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/gpencil_modifier.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 5efdc2ccace..2c49878005f 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -262,7 +262,6 @@ void BKE_gpencil_stroke_2d_flat_ref(const struct bGPDspoint *ref_points,
void BKE_gpencil_triangulate_stroke_fill(struct bGPdata *gpd, struct bGPDstroke *gps);
void BKE_gpencil_recalc_geometry_caches(struct Object *ob,
struct bGPDlayer *gpl,
- struct MaterialGPencilStyle *gp_style,
struct bGPDstroke *gps);
void BKE_gpencil_calc_stroke_uv(struct bGPDstroke *gps);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 2d40ef1ecb3..9241829075f 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2771,13 +2771,9 @@ void BKE_gpencil_triangulate_stroke_fill(bGPdata *gpd, bGPDstroke *gps)
gps->tot_triangles = gps->totpoints - 2;
/* save triangulation data in stroke cache */
if (gps->tot_triangles > 0) {
- if (gps->triangles == NULL) {
- gps->triangles = MEM_callocN(sizeof(*gps->triangles) * gps->tot_triangles,
- "GP Stroke triangulation");
- }
- else {
- gps->triangles = MEM_recallocN(gps->triangles, sizeof(*gps->triangles) * gps->tot_triangles);
- }
+ MEM_SAFE_FREE(gps->triangles);
+ gps->triangles = MEM_callocN(sizeof(*gps->triangles) * gps->tot_triangles,
+ "GP Stroke triangulation");
for (int i = 0; i < gps->tot_triangles; i++) {
memcpy(gps->triangles[i].verts, tmp_triangles[i], sizeof(uint[3]));
@@ -2825,19 +2821,11 @@ void BKE_gpencil_calc_stroke_uv(bGPDstroke *gps)
}
/* Recalc the internal geometry caches for fill and uvs. */
-void BKE_gpencil_recalc_geometry_caches(Object *ob,
- bGPDlayer *gpl,
- MaterialGPencilStyle *gp_style,
- bGPDstroke *gps)
+void BKE_gpencil_recalc_geometry_caches(Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
{
if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
- /* Calculate triangles cache for filling area (must be done only after changes) */
- if ((gps->tot_triangles == 0) || (gps->triangles == NULL)) {
- if ((gps->totpoints > 2) && (gp_style->flag & GP_MATERIAL_FILL_SHOW) &&
- ((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0) ||
- (gpl->blend_mode != eGplBlendMode_Regular))) {
- BKE_gpencil_triangulate_stroke_fill((bGPdata *)ob->data, gps);
- }
+ if (gps->totpoints > 2) {
+ BKE_gpencil_triangulate_stroke_fill((bGPdata *)ob->data, gps);
}
/* calc uv data along the stroke */
@@ -3845,11 +3833,7 @@ static void gpencil_prepare_filling(const Object *ob)
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
- MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get((Object *)ob,
- gps->mat_nr + 1);
- if (gp_style) {
- BKE_gpencil_recalc_geometry_caches((Object *)ob, gpl, gp_style, gps);
- }
+ BKE_gpencil_recalc_geometry_caches((Object *)ob, gpl, gps);
}
}
}
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 63f2efb919a..f5df4fa3a3f 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -965,10 +965,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
* required.
* This is needed if some modifiers tagged the stroke triangulation to be recalc. */
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
- MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
- if (gp_style) {
- BKE_gpencil_recalc_geometry_caches(ob, gpl, gp_style, gps);
- }
+ BKE_gpencil_recalc_geometry_caches(ob, gpl, gps);
}
}
More information about the Bf-blender-cvs
mailing list