Commit: 3e4fb5b5f18c7cb6f8485011dab8936f76e294b2 Author: Falk David Date: Thu Aug 20 10:10:09 2020 +0200 Branches: soc-2020-greasepencil-curve https://developer.blender.org/rB3e4fb5b5f18c7cb6f8485011dab8936f76e294b2
GPencil: Add corner angle parameter =================================================================== M source/blender/blenkernel/BKE_gpencil_curve.h M source/blender/blenkernel/intern/gpencil_curve.c M source/blender/editors/gpencil/gpencil_edit.c M source/blender/editors/gpencil/gpencil_edit_curve.c M source/blender/editors/gpencil/gpencil_select.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/makesrna/intern/rna_gpencil.c =================================================================== diff --git a/source/blender/blenkernel/BKE_gpencil_curve.h b/source/blender/blenkernel/BKE_gpencil_curve.h index 7709b165c11..0f6d2f37d29 100644 --- a/source/blender/blenkernel/BKE_gpencil_curve.h +++ b/source/blender/blenkernel/BKE_gpencil_curve.h @@ -45,7 +45,9 @@ void BKE_gpencil_convert_curve(struct Main *bmain, struct bGPDcurve *BKE_gpencil_stroke_editcurve_generate(struct bGPDstroke *gps, float error_threshold, float corner_angle); -void BKE_gpencil_stroke_editcurve_update(struct bGPDstroke *gps, float error_threshold, float corner_angle); +void BKE_gpencil_stroke_editcurve_update(struct bGPDstroke *gps, + float error_threshold, + float corner_angle); void BKE_gpencil_editcurve_stroke_sync_selection(struct bGPDstroke *gps, struct bGPDcurve *gpc); void BKE_gpencil_stroke_editcurve_sync_selection(struct bGPDstroke *gps, struct bGPDcurve *gpc); void BKE_gpencil_strokes_selected_update_editcurve(struct bGPdata *gpd); diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c index 70a9700a1db..d8bfa6b1d95 100644 --- a/source/blender/blenkernel/intern/gpencil_curve.c +++ b/source/blender/blenkernel/intern/gpencil_curve.c @@ -566,7 +566,9 @@ void BKE_gpencil_convert_curve(Main *bmain, /** * Creates a bGPDcurve by doing a cubic curve fitting on the grease pencil stroke points. */ -bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, float error_threshold, float corner_angle) +bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, + float error_threshold, + float corner_angle) { if (gps->totpoints < 1) { return NULL; @@ -702,7 +704,9 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, float error_th /** * Updates the editcurve for a stroke. Frees the old curve if one exists and generates a new one. */ -void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps, float error_threshold, float corner_angle) +void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps, + float error_threshold, + float corner_angle) { if (gps == NULL || gps->totpoints < 0) { return; @@ -1303,14 +1307,16 @@ void BKE_gpencil_strokes_selected_update_editcurve(bGPdata *gpd) /* Generate the curve if there is none or the stroke was changed */ if (gps->editcurve == NULL) { - BKE_gpencil_stroke_editcurve_update(gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); + BKE_gpencil_stroke_editcurve_update( + gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); /* Continue if curve could not be generated. */ if (gps->editcurve == NULL) { continue; } } else if (gps->editcurve->flag & GP_CURVE_NEEDS_STROKE_UPDATE) { - BKE_gpencil_stroke_editcurve_update(gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); + BKE_gpencil_stroke_editcurve_update( + gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); } /* Update the selection from the stroke to the curve. */ BKE_gpencil_editcurve_stroke_sync_selection(gps, gps->editcurve); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index d4c77598ee8..6d2fa0dbd26 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -209,7 +209,8 @@ static int gpencil_editmode_toggle_exec(bContext *C, wmOperator *op) GP_EDITABLE_CURVES_BEGIN(gps_iter, C, gpl, gps, gpc) { if (gpc->flag & GP_CURVE_NEEDS_STROKE_UPDATE) { - BKE_gpencil_stroke_editcurve_update(gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); + BKE_gpencil_stroke_editcurve_update( + gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); /* Update the selection from the stroke to the curve. */ BKE_gpencil_editcurve_stroke_sync_selection(gps, gps->editcurve); diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c index 71d42946372..e93dbcab103 100644 --- a/source/blender/editors/gpencil/gpencil_edit_curve.c +++ b/source/blender/editors/gpencil/gpencil_edit_curve.c @@ -89,7 +89,8 @@ static int gpencil_stroke_enter_editcurve_mode_exec(bContext *C, wmOperator *op) /* only allow selected and non-converted strokes to be transformed */ if ((gps->flag & GP_STROKE_SELECT && gps->editcurve == NULL) || (gps->editcurve != NULL && gps->editcurve->flag & GP_CURVE_NEEDS_STROKE_UPDATE)) { - BKE_gpencil_stroke_editcurve_update(gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); + BKE_gpencil_stroke_editcurve_update( + gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); /* Update the selection from the stroke to the curve. */ BKE_gpencil_editcurve_stroke_sync_selection(gps, gps->editcurve); gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 1f502693563..6690695bad5 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -2237,7 +2237,8 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) if (whole) { /* Generate editcurve if it does not exist */ if (is_curve_edit && hit_curve == NULL) { - BKE_gpencil_stroke_editcurve_update(hit_stroke, gpd->curve_edit_threshold, gpd->curve_corner_angle); + BKE_gpencil_stroke_editcurve_update( + hit_stroke, gpd->curve_edit_threshold, gpd->curve_corner_angle); hit_stroke->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; BKE_gpencil_stroke_geometry_update(gpd, hit_stroke); hit_curve = hit_stroke->editcurve; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 8426584aa7b..c9440c06f1f 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2654,7 +2654,8 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action) /* Make sure stroke has an editcurve */ if (gps->editcurve == NULL) { - BKE_gpencil_stroke_editcurve_update(gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); + BKE_gpencil_stroke_editcurve_update( + gps, gpd->curve_edit_threshold, gpd->curve_corner_angle); gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; BKE_gpencil_stroke_geometry_update(gpd, gps); } diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 45e0286c215..5054da6bd4f 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -2397,8 +2397,8 @@ static void rna_def_gpencil_data(BlenderRNA *brna) /* Curve editing corner angle. */ prop = RNA_def_property(srna, "curve_corner_angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "curve_corner_angle"); - RNA_def_property_float_default(prop, M_PI_2); - RNA_def_property_range(prop, 0.0f, M_PI); + 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_clear_flag(prop, PROP_ANIMATABLE); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs