[Bf-blender-cvs] [de52a9c9f4f] soc-2020-greasepencil-curve: GPencil: Use resolution parameter
Falk David
noreply at git.blender.org
Fri Jun 12 11:12:57 CEST 2020
Commit: de52a9c9f4ffaf61e38dad84045788b9c1df73eb
Author: Falk David
Date: Fri Jun 12 11:02:28 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBde52a9c9f4ffaf61e38dad84045788b9c1df73eb
GPencil: Use resolution parameter
Use the curve resolution parameter in the stroke option panel
to control how many segments are generated from the edit curve.
===================================================================
M source/blender/blenkernel/intern/gpencil_curve.c
M source/blender/editors/gpencil/gpencil_edit_curve.c
M source/blender/makesrna/intern/rna_gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 795b6de6de5..a3cf3d03959 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -568,6 +568,9 @@ void BKE_gpencil_selected_strokes_editcurve_update(bGPdata *gpd)
}
BKE_gpencil_stroke_editcurve_update(gps);
+ if (gps->editcurve != NULL) {
+ gps->editcurve->resolution = gpd->editcurve_resolution;
+ }
}
}
}
@@ -586,7 +589,7 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps)
bGPDcurve *editcurve = gps->editcurve;
BezTriple *bezt_array = editcurve->curve_points;
int bezt_array_len = editcurve->tot_curve_points;
- int resolu = 10; // editcurve->resolution;
+ int resolu = editcurve->resolution;
bool is_cyclic = gps->flag & GP_STROKE_CYCLIC;
const uint bezt_array_last = bezt_array_len - 1;
@@ -645,6 +648,7 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps)
copy_v3_v3(&pt->x, points[i]);
pt->pressure = 1.0f;
+ pt->strength = 1.0f;
/* TODO: fill rest of data for point using interpolation */
}
diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
index a697c8b40ce..56a2ea4297d 100644
--- a/source/blender/editors/gpencil/gpencil_edit_curve.c
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -79,6 +79,9 @@ static int gp_write_stroke_curve_data_exec(bContext *C, wmOperator *op)
BKE_gpencil_free_stroke_editcurve(gps);
}
BKE_gpencil_stroke_editcurve_update(gps);
+ if (gps->editcurve != NULL) {
+ gps->editcurve->resolution = gpd->editcurve_resolution;
+ }
}
}
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index bc51ac4e8f1..f3e2d78f841 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -178,10 +178,11 @@ static void rna_GPencil_stroke_curve_update(Main *bmain, Scene *scene, PointerRN
if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) {
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
if (gpl->actframe != NULL) {
+ bGPDframe *gpf = gpl->actframe;
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
if (gps->editcurve != NULL) {
gps->editcurve->flag |= GP_CURVE_RECALC_GEOMETRY;
- BKE_gpencil_stroke_geometry_update(gps);
+ BKE_gpencil_stroke_geometry_update(gpd, gps);
}
}
}
@@ -196,8 +197,18 @@ static void rna_GPencil_curve_resolution_update(Main *bmain, Scene *scene, Point
bGPdata *gpd = (bGPdata *)ptr->owner_id;
if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) {
- /* TODO GPXX */
- /* Update any stroke selected with different resolution */
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ if (gpl->actframe != NULL) {
+ bGPDframe *gpf = gpl->actframe;
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ if (gps->editcurve != NULL) {
+ gps->editcurve->resolution = gpd->editcurve_resolution;
+ gps->editcurve->flag |= GP_CURVE_RECALC_GEOMETRY;
+ BKE_gpencil_stroke_geometry_update(gpd, gps);
+ }
+ }
+ }
+ }
}
rna_GPencil_update(bmain, scene, ptr);
}
More information about the Bf-blender-cvs
mailing list