[Bf-blender-cvs] [5bac474903e] soc-2020-greasepencil-curve: GPencil: Convert to curve with click select

Falk David noreply at git.blender.org
Fri Jul 17 14:18:09 CEST 2020


Commit: 5bac474903e99adbed89e9b610f6905076c7ede8
Author: Falk David
Date:   Fri Jul 17 14:16:28 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB5bac474903e99adbed89e9b610f6905076c7ede8

GPencil: Convert to curve with click select

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

M	source/blender/editors/gpencil/gpencil_select.c

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

diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index 70e8649dd94..82d456892ae 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -43,6 +43,8 @@
 
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
+#include "BKE_gpencil_curve.h"
+#include "BKE_gpencil_geom.h"
 #include "BKE_material.h"
 #include "BKE_report.h"
 
@@ -2200,6 +2202,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
   /* select all handles if the click was on the curve but not on a handle */
   if (is_curve_edit && hit_point != NULL) {
     whole = true;
+    hit_curve = hit_stroke->editcurve;
   }
 
   /* adjust selection behavior - for toggle option */
@@ -2225,6 +2228,14 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
 
   /* Perform selection operations... */
   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);
+      hit_stroke->editcurve->resolution = gpd->editcurve_resolution;
+      hit_stroke->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
+      BKE_gpencil_stroke_geometry_update(gpd, hit_stroke);
+      hit_curve = hit_stroke->editcurve;
+    }
     /* select all curve points */
     if (hit_curve != NULL) {
       for (int i = 0; i < hit_curve->tot_curve_points; i++) {
@@ -2464,7 +2475,6 @@ static int gpencil_select_vertex_color_exec(bContext *C, wmOperator *op)
   ToolSettings *ts = CTX_data_tool_settings(C);
   Object *ob = CTX_data_active_object(C);
   bGPdata *gpd = ED_gpencil_data_get_active(C);
-  const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
 
   const float threshold = RNA_int_get(op->ptr, "threshold");
   const int selectmode = gpencil_select_mode_from_vertex(ts->gpencil_selectmode_vertex);



More information about the Bf-blender-cvs mailing list