[Bf-blender-cvs] [486a06d71be] soc-2020-greasepencil-curve: GPencil: Set handle type for individual handle
Falk David
noreply at git.blender.org
Mon Jul 6 17:23:11 CEST 2020
Commit: 486a06d71be1a27ba2f90c51140a0d5e39471de1
Author: Falk David
Date: Mon Jul 6 17:06:54 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB486a06d71be1a27ba2f90c51140a0d5e39471de1
GPencil: Set handle type for individual handle
Before it was only possible to set the handle type for both handles
of a bezier tripple. Now the user can set the type individually.
===================================================================
M source/blender/editors/gpencil/gpencil_edit_curve.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
index b919f73d024..fb8e608551d 100644
--- a/source/blender/editors/gpencil/gpencil_edit_curve.c
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -87,7 +87,7 @@ static int gpencil_stroke_enter_editcurve_mode(bContext *C, wmOperator *op)
if (gpf == gpl->actframe) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
/* only allow selected and non-converted strokes to be transformed */
- if ((gps->flag & GP_STROKE_SELECT) && gps->editcurve == NULL ||
+ 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);
if (gps->editcurve != NULL) {
@@ -153,18 +153,28 @@ static int gpencil_editcurve_set_handle_type_exec(bContext *C, wmOperator *op)
bGPDcurve_point *gpc_pt = &gpc->curve_points[i];
if (gpc_pt->flag & GP_CURVE_POINT_SELECT) {
+ BezTriple *bezt = &gpc_pt->bezt;
bGPDcurve_point *gpc_pt_prev = (i > 0) ? &gpc->curve_points[i - 1] : NULL;
bGPDcurve_point *gpc_pt_next = (i < gpc->tot_curve_points - 1) ?
&gpc->curve_points[i + 1] :
NULL;
BezTriple *bezt_prev = gpc_pt_prev != NULL ? &gpc_pt_prev->bezt : NULL;
- BezTriple *bezt = &gpc_pt->bezt;
BezTriple *bezt_next = gpc_pt_next != NULL ? &gpc_pt_next->bezt : NULL;
- bezt->h1 = handle_type;
- bezt->h2 = handle_type;
-
- BKE_nurb_handle_calc(bezt, bezt_prev, bezt_next, false, 0);
+ if (bezt->f2 & SELECT) {
+ bezt->h1 = handle_type;
+ bezt->h2 = handle_type;
+ BKE_nurb_handle_calc(bezt, bezt_prev, bezt_next, false, 0);
+ }
+ else {
+ if (bezt->f1 & SELECT) {
+ bezt->h1 = handle_type;
+ }
+ if (bezt->f3 & SELECT) {
+ bezt->h2 = handle_type;
+ }
+ BKE_nurb_handle_calc(bezt, bezt_prev, bezt_next, false, 0);
+ }
gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
BKE_gpencil_stroke_geometry_update(gpd, gps);
More information about the Bf-blender-cvs
mailing list