[Bf-blender-cvs] [44173c60fcd] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve

Antonio Vazquez noreply at git.blender.org
Mon Jun 22 11:04:33 CEST 2020


Commit: 44173c60fcdce9dcca305972b5bc86b96ab175f5
Author: Antonio Vazquez
Date:   Mon Jun 22 10:57:20 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB44173c60fcdce9dcca305972b5bc86b96ab175f5

Merge branch 'master' into greasepencil-edit-curve

 Conflicts:
	source/blender/editors/gpencil/gpencil_select.c

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



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

diff --cc source/blender/editors/gpencil/gpencil_select.c
index dd04664f5b6,b3256628ab3..1eef4a5b00f
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@@ -1657,8 -1431,6 +1657,7 @@@ static int gpencil_select_exec(bContex
    bGPdata *gpd = ED_gpencil_data_get_active(C);
    ToolSettings *ts = CTX_data_tool_settings(C);
    const float scale = ts->gp_sculpt.isect_threshold;
-   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
 +  const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
  
    /* "radius" is simply a threshold (screen space) to make it easier to test with a tolerance */
    const float radius = 0.4f * U.widget_unit;
@@@ -1705,53 -1471,46 +1704,50 @@@
      whole = (bool)(ts->gpencil_selectmode_edit == GP_SELECTMODE_STROKE);
    }
  
 -  /* init space conversion stuff */
 -  gp_point_conversion_init(C, &gsc);
 +  if (is_curve_edit) {
 +    gpencil_select_curve_point(
 +        C, mval, radius_squared, &hit_curve, &hit_curve_point, &hit_curve_handle);
 +  }
  
 -  /* get mouse location */
 -  RNA_int_get_array(op->ptr, "location", mval);
 +  if (hit_curve_point == NULL) {
 +    /* init space conversion stuff */
 +    gp_point_conversion_init(C, &gsc);
  
 -  /* First Pass: Find stroke point which gets hit */
 -  GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
 -    bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps;
 -    bGPDspoint *pt;
 -    int i;
 +    /* First Pass: Find stroke point which gets hit */
 +    GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
 +      bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps;
 +      bGPDspoint *pt;
 +      int i;
  
 -    /* Check boundbox to speedup. */
 -    float fmval[2];
 -    copy_v2fl_v2i(fmval, mval);
 -    if (!ED_gpencil_stroke_check_collision(
 -            &gsc, gps_active, fmval, radius, gpstroke_iter.diff_mat)) {
 -      continue;
 -    }
 +      /* Check boundbox to speedup. */
 +      float fmval[2];
 +      copy_v2fl_v2i(fmval, mval);
 +      if (!ED_gpencil_stroke_check_collision(
 +              &gsc, gps_active, fmval, radius, gpstroke_iter.diff_mat)) {
 +        continue;
 +      }
  
-       /* firstly, check for hit-point */
-       for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
-         int xy[2];
-         if ((!is_multiedit) && (pt->runtime.pt_orig == NULL)) {
-           continue;
-         }
+     /* firstly, check for hit-point */
+     for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+       int xy[2];
  
 -      bGPDspoint pt2;
 -      gp_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2);
 -      gp_point_to_xy(&gsc, gps, &pt2, &xy[0], &xy[1]);
 -
 -      /* do boundbox check first */
 -      if (!ELEM(V2D_IS_CLIPPED, xy[0], xy[1])) {
 -        const int pt_distance = len_manhattan_v2v2_int(mval, xy);
 -
 -        /* check if point is inside */
 -        if (pt_distance <= radius_squared) {
 -          /* only use this point if it is a better match than the current hit - T44685 */
 -          if (pt_distance < hit_distance) {
 -            hit_layer = gpl;
 -            hit_stroke = gps_active;
 -            hit_point = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
 -            hit_distance = pt_distance;
 +        bGPDspoint pt2;
 +        gp_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2);
 +        gp_point_to_xy(&gsc, gps, &pt2, &xy[0], &xy[1]);
 +
 +        /* do boundbox check first */
 +        if (!ELEM(V2D_IS_CLIPPED, xy[0], xy[1])) {
 +          const int pt_distance = len_manhattan_v2v2_int(mval, xy);
 +
 +          /* check if point is inside */
 +          if (pt_distance <= radius_squared) {
 +            /* only use this point if it is a better match than the current hit - T44685 */
 +            if (pt_distance < hit_distance) {
 +              hit_layer = gpl;
 +              hit_stroke = gps_active;
 +              hit_point = (!is_multiedit) ? pt->runtime.pt_orig : pt;
 +              hit_distance = pt_distance;
 +            }
            }
          }
        }



More information about the Bf-blender-cvs mailing list