[Bf-blender-cvs] [493158b5aa7] greasepencil-edit-curve: GPencil: Fix bug where curve points woud dissapear
Falk David
noreply at git.blender.org
Mon Sep 28 18:52:18 CEST 2020
Commit: 493158b5aa75667541da7ef2ce6e69c5104d11a8
Author: Falk David
Date: Mon Sep 28 18:52:06 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB493158b5aa75667541da7ef2ce6e69c5104d11a8
GPencil: Fix bug where curve points woud dissapear
When adaptive resolution was active, the calculated resolution for a
segment was not being claped to a minimum of 1, leading to segments
with zero points.
===================================================================
M source/blender/blenkernel/intern/gpencil_curve.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 76901f91e34..59c251197eb 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -960,6 +960,7 @@ static float *gpencil_stroke_points_from_editcurve_adaptive_resolu(
bGPDcurve_point *cpt_next = &curve_point_array[i + 1];
float arclen = gpencil_approximate_curve_segment_arclength(cpt, cpt_next);
int segment_resolu = (int)floorf(arclen * resolution);
+ CLAMP_MIN(segment_resolu, 1);
segment_point_lengths[i] = segment_resolu;
points_len += segment_resolu;
@@ -970,6 +971,7 @@ static float *gpencil_stroke_points_from_editcurve_adaptive_resolu(
bGPDcurve_point *cpt_next = &curve_point_array[0];
float arclen = gpencil_approximate_curve_segment_arclength(cpt, cpt_next);
int segment_resolu = (int)floorf(arclen * resolution);
+ CLAMP_MIN(segment_resolu, 1);
segment_point_lengths[cpt_last] = segment_resolu;
points_len += segment_resolu;
More information about the Bf-blender-cvs
mailing list