Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_select.c
| Show First 20 Lines • Show All 1,841 Lines • ▼ Show 20 Lines | static bool gpencil_generic_stroke_select(bContext *C, | ||||
| /* select/deselect points */ | /* select/deselect points */ | ||||
| GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) { | GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) { | ||||
| bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps; | bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps; | ||||
| bool whole = false; | bool whole = false; | ||||
| bGPDspoint *pt; | bGPDspoint *pt; | ||||
| int i; | int i; | ||||
| bool hit = false; | bool hit = false; | ||||
| for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { | for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) { | ||||
| bGPDspoint *pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | bGPDspoint *pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | ||||
| /* convert point coords to screenspace */ | /* convert point coords to screenspace */ | ||||
| const bool is_inside = is_inside_fn(gsc.region, gpstroke_iter.diff_mat, &pt->x, user_data); | const bool is_inside = is_inside_fn(gsc.region, gpstroke_iter.diff_mat, &pt->x, user_data); | ||||
| if (strokemode == false) { | if (strokemode == false) { | ||||
| const bool is_select = (pt_active->flag & GP_SPOINT_SELECT) != 0; | const bool is_select = (pt_active->flag & GP_SPOINT_SELECT) != 0; | ||||
| const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); | const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); | ||||
| if (sel_op_result != -1) { | if (sel_op_result != -1) { | ||||
| ▲ Show 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | if (hit_curve == NULL) { | ||||
| /* First Pass: Find stroke point which gets hit */ | /* First Pass: Find stroke point which gets hit */ | ||||
| GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) { | GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) { | ||||
| bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps; | bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps; | ||||
| bGPDspoint *pt; | bGPDspoint *pt; | ||||
| int i; | int i; | ||||
| /* firstly, check for hit-point */ | /* firstly, check for hit-point */ | ||||
| for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { | for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) { | ||||
| int xy[2]; | int xy[2]; | ||||
| bGPDspoint pt2; | bGPDspoint pt2; | ||||
| gpencil_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2); | gpencil_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2); | ||||
| gpencil_point_to_xy(&gsc, gps, &pt2, &xy[0], &xy[1]); | gpencil_point_to_xy(&gsc, gps_active, &pt2, &xy[0], &xy[1]); | ||||
| /* do boundbox check first */ | /* do boundbox check first */ | ||||
| if (!ELEM(V2D_IS_CLIPPED, xy[0], xy[1])) { | if (!ELEM(V2D_IS_CLIPPED, xy[0], xy[1])) { | ||||
| const int pt_distance = len_manhattan_v2v2_int(mval, xy); | const int pt_distance = len_manhattan_v2v2_int(mval, xy); | ||||
| /* check if point is inside */ | /* check if point is inside */ | ||||
| if (pt_distance <= radius_squared) { | if (pt_distance <= radius_squared) { | ||||
| /* only use this point if it is a better match than the current hit - T44685 */ | /* only use this point if it is a better match than the current hit - T44685 */ | ||||
| ▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines | |||||