[Bf-blender-cvs] [85b78a14d29] temp-gpencil-bezier-stroke-type: GPencil: Add IS_BEZT_CONTROL flag for poly points

Falk David noreply at git.blender.org
Mon Apr 26 16:57:33 CEST 2021


Commit: 85b78a14d29b14fccd1608186f9f148c44f21db3
Author: Falk David
Date:   Mon Apr 26 16:57:18 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB85b78a14d29b14fccd1608186f9f148c44f21db3

GPencil: Add IS_BEZT_CONTROL flag for poly points

This flags indicates that the poly point is "linked" to a bezier
control point.

===================================================================

M	source/blender/blenkernel/intern/gpencil_curve.c
M	source/blender/makesdna/DNA_gpencil_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 82aad79c874..75914136c07 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -1626,6 +1626,7 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps,
   gps->totpoints = points_len;
   gps->points = MEM_recallocN(gps->points, sizeof(bGPDspoint) * gps->totpoints);
 
+  bGPDcurve_point *gpc_pt = &curve_point_array[0];
   /* write new data to stroke point array */
   for (int i = 0; i < points_len; i++) {
     bGPDspoint *pt = &gps->points[i];
@@ -1644,6 +1645,11 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps,
 
     /* deselect points */
     pt->flag &= ~GP_SPOINT_SELECT;
+
+    if (gpc_pt->point_index == i) {
+      pt->flag |= GP_SPOINT_IS_BEZT_CONTROL;
+      gpc_pt++;
+    }
   }
   gps->flag &= ~GP_STROKE_SELECT;
   BKE_gpencil_stroke_select_index_reset(gps);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index d650bed67c6..b6308283def 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -112,6 +112,8 @@ typedef enum eGPDspoint_Flag {
   GP_SPOINT_TAG = (1 << 1),
   /* stroke point is temp tagged (for some editing operation) */
   GP_SPOINT_TEMP_TAG = (1 << 2),
+  /* Stroke point is "linked" to control point of bezier handle. */
+  GP_SPOINT_IS_BEZT_CONTROL = (1 << 3),
 } eGPSPoint_Flag;
 
 /* ***************************************** */



More information about the Bf-blender-cvs mailing list