[Bf-blender-cvs] [381fbd9762c] soc-2020-greasepencil-curve: GPencil: Refactor and small fixes
Falk David
noreply at git.blender.org
Sun Aug 30 22:59:42 CEST 2020
Commit: 381fbd9762c17700d63e0d4013245fbc8db7c185
Author: Falk David
Date: Wed Aug 26 11:52:08 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB381fbd9762c17700d63e0d4013245fbc8db7c185
GPencil: Refactor and small fixes
- Removed dot at the end of prop description
- Replaced return NULL with asserts
- Changed default handle type for small curves
- Added comment
===================================================================
M source/blender/blenkernel/intern/gpencil_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 76901f91e34..f62bf72c490 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -563,6 +563,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
/** \name Editcurve kernel functions
* \{ */
+/* Helper: generate curves with one or two curve points */
static bGPDcurve *gpencil_stroke_editcurve_generate_edgecases(bGPDstroke *gps,
const float stroke_radius)
{
@@ -590,8 +591,8 @@ static bGPDcurve *gpencil_stroke_editcurve_generate_edgecases(bGPDstroke *gps,
copy_v4_v4(cpt->vert_color, pt->vert_color);
/* default handle type */
- bezt->h1 = HD_FREE;
- bezt->h2 = HD_FREE;
+ bezt->h1 = HD_ALIGN;
+ bezt->h2 = HD_ALIGN;
cpt->point_index = 0;
@@ -624,10 +625,10 @@ static bGPDcurve *gpencil_stroke_editcurve_generate_edgecases(bGPDstroke *gps,
copy_v4_v4(cpt->vert_color, pt->vert_color);
/* default handle type */
- bezt->h1 = HD_VECT;
- bezt->h2 = HD_VECT;
+ bezt->h1 = HD_ALIGN;
+ bezt->h2 = HD_ALIGN;
- cpt->point_index = 0;
+ cpt->point_index = i;
}
return editcurve;
@@ -755,7 +756,7 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps,
*/
void BKE_gpencil_stroke_editcurve_update(bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps)
{
- if (gps == NULL || gps->totpoints < 0) {
+ if (gps == NULL || gps->totpoints <= 0) {
return;
}
@@ -768,9 +769,8 @@ void BKE_gpencil_stroke_editcurve_update(bGPdata *gpd, bGPDlayer *gpl, bGPDstrok
bGPDcurve *editcurve = BKE_gpencil_stroke_editcurve_generate(
gps, gpd->curve_edit_threshold, gpd->curve_edit_corner_angle, stroke_radius);
- if (editcurve == NULL) {
- return;
- }
+
+ BLI_assert(editcurve != NULL);
gps->editcurve = editcurve;
}
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 480e01f8eb6..ca8631a61f5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -2399,7 +2399,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "curve_edit_corner_angle");
RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
RNA_def_property_float_default(prop, DEG2RADF(90.0f));
- RNA_def_property_ui_text(prop, "Corner Angle", "Angle threshold to be treated as corners.");
+ RNA_def_property_ui_text(prop, "Corner Angle", "Angle threshold to be treated as corners");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE);
More information about the Bf-blender-cvs
mailing list