[Bf-blender-cvs] [1f9965f8524] soc-2020-greasepencil-curve: GPencil: WIP: sync selection
Falk David
noreply at git.blender.org
Sat Jun 27 21:32:27 CEST 2020
Commit: 1f9965f8524b677d4f2c837acb0e5a28688381d3
Author: Falk David
Date: Mon Jun 22 16:10:36 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB1f9965f8524b677d4f2c837acb0e5a28688381d3
GPencil: WIP: sync selection
===================================================================
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 14e2a9836c4..9eabfae2e50 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -539,9 +539,34 @@ void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps, float error_threshold)
if (editcurve == NULL) {
return;
}
+ /* update the selection based on the selected points in the stroke */
+ BKE_gpencil_editcurve_sync_selection(gps, editcurve);
gps->editcurve = editcurve;
}
+void BKE_gpencil_editcurve_sync_selection(bGPDstroke *gps, bGPDcurve *gpc)
+{
+ if (gps->flag & GP_STROKE_SELECT) {
+ gpc->flag |= GP_CURVE_SELECT;
+ }
+ else {
+ gpc->flag &= ~GP_CURVE_SELECT;
+ }
+
+ for (int i = 0; i < gpc->tot_curve_points; i++) {
+ bGPDcurve_point *gpc_pt = &gpc->curve_points[i];
+ bGPDspoint *pt = &gps->points[gpc_pt->point_index];
+ if (pt->flag & GP_SPOINT_SELECT) {
+ gpc_pt->flag |= GP_CURVE_POINT_SELECT;
+ BEZT_SEL_ALL(&gpc_pt->bezt);
+ }
+ else {
+ gpc_pt->flag &= ~GP_CURVE_POINT_SELECT;
+ BEZT_DESEL_ALL(&gpc_pt->bezt);
+ }
+ }
+}
+
/**
* Update editcurve for all selected strokes.
*/
More information about the Bf-blender-cvs
mailing list