diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-08-12 13:35:52 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-08-12 23:47:47 +0300 |
commit | 504c257daed50bfc28d565de5590ba0929700fc8 (patch) | |
tree | ff2c1ce84fde6636b12316b1a3fe08af434645d9 /source/blender/blenkernel/intern/gpencil_curve.c | |
parent | 9abdafe840e5eaa29153565bd7c121f02e1d1fb1 (diff) |
GPencil: Add Sample parameter to Convert curve
This allows to resample the stroke to avoid too dense geometry.
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil_curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_curve.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c index 3ee74ed11c9..5c7a12870a6 100644 --- a/source/blender/blenkernel/intern/gpencil_curve.c +++ b/source/blender/blenkernel/intern/gpencil_curve.c @@ -173,6 +173,7 @@ static void gpencil_convert_spline(Main *bmain, const bool gpencil_lines, const bool only_stroke, const float scale_thickness, + const float sample, bGPDframe *gpf, Nurb *nu) { @@ -392,6 +393,9 @@ static void gpencil_convert_spline(Main *bmain, if ((cyclic) && (!do_stroke)) { BKE_gpencil_stroke_close(gps); } + if (sample > 0.0f) { + BKE_gpencil_stroke_sample(gps, sample, false); + } /* Recalc fill geometry. */ BKE_gpencil_stroke_geometry_update(gps); @@ -408,6 +412,7 @@ static void gpencil_convert_spline(Main *bmain, * \param use_collections: Create layers using collection names. * \param only_stroke: The material must be only stroke without fill. * \param scale_thickness: Scale thickness factor. + * \param sample: Sample distance, zero to disable. */ void BKE_gpencil_convert_curve(Main *bmain, Scene *scene, @@ -416,7 +421,8 @@ void BKE_gpencil_convert_curve(Main *bmain, const bool gpencil_lines, const bool use_collections, const bool only_stroke, - const float scale_thickness) + const float scale_thickness, + const float sample) { if (ELEM(NULL, ob_gp, ob_cu) || (ob_gp->type != OB_GPENCIL) || (ob_gp->data == NULL)) { return; @@ -455,7 +461,7 @@ void BKE_gpencil_convert_curve(Main *bmain, /* Read all splines of the curve and create a stroke for each. */ LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) { gpencil_convert_spline( - bmain, ob_gp, ob_cu, gpencil_lines, only_stroke, scale_thickness, gpf, nu); + bmain, ob_gp, ob_cu, gpencil_lines, only_stroke, scale_thickness, sample, gpf, nu); } /* Tag for recalculation */ |