GPencil: Remove Fill selection with Tweak tool and fix bug

* Fixed selection of point in multiframe mode. The point was not selected.

* Removed the fill area selection because makes the tool imprecise, and for this tool need to be precise or the selection is impossible. Now only select if it's over the point, not over the filled area.
This commit is contained in:
Antonio Vazquez 2020-06-22 10:40:50 +02:00
parent 566b4f126d
commit 3752c44b44
1 changed files with 1 additions and 20 deletions

View File

@ -1431,7 +1431,6 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
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);
/* "radius" is simply a threshold (screen space) to make it easier to test with a tolerance */
const float radius = 0.4f * U.widget_unit;
@ -1495,9 +1494,6 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
/* 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;
}
bGPDspoint pt2;
gp_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2);
@ -1513,27 +1509,12 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
if (pt_distance < hit_distance) {
hit_layer = gpl;
hit_stroke = gps_active;
hit_point = (!is_multiedit) ? pt->runtime.pt_orig : pt;
hit_point = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
hit_distance = pt_distance;
}
}
}
}
if (ELEM(NULL, hit_stroke, hit_point)) {
/* If nothing hit, check if the mouse is inside any filled stroke.
* Only check filling materials. */
MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, gps->mat_nr + 1);
if ((gp_style->flag & GP_MATERIAL_FILL_SHOW) == 0) {
continue;
}
bool hit_fill = ED_gpencil_stroke_point_is_inside(gps, &gsc, mval, gpstroke_iter.diff_mat);
if (hit_fill) {
hit_stroke = gps_active;
hit_point = &gps_active->points[0];
/* Extend selection to all stroke. */
whole = true;
}
}
}
GP_EVALUATED_STROKES_END(gpstroke_iter);