Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_select.c
| Show First 20 Lines • Show All 1,491 Lines • ▼ Show 20 Lines | static bool gpencil_stroke_do_circle_sel(bGPdata *gpd, | ||||
| 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_active = NULL; | bGPDspoint *pt_active = NULL; | ||||
| bool hit = false; | bool hit = false; | ||||
| for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { | for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { | ||||
| pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | ||||
| bGPDspoint pt_temp; | bGPDspoint pt_temp; | ||||
| gpencil_point_to_parent_space(pt, diff_mat, &pt_temp); | gpencil_point_to_world_space(pt, diff_mat, &pt_temp); | ||||
| gpencil_point_to_xy(gsc, gps, &pt_temp, &x0, &y0); | gpencil_point_to_xy(gsc, gps, &pt_temp, &x0, &y0); | ||||
| /* do boundbox check first */ | /* do boundbox check first */ | ||||
| if ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(rect, x0, y0)) { | if ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(rect, x0, y0)) { | ||||
| /* only check if point is inside */ | /* only check if point is inside */ | ||||
| if (((x0 - mx) * (x0 - mx) + (y0 - my) * (y0 - my)) <= radius * radius) { | if (((x0 - mx) * (x0 - mx) + (y0 - my) * (y0 - my)) <= radius * radius) { | ||||
| hit = true; | hit = true; | ||||
| ▲ Show 20 Lines • Show All 963 Lines • ▼ Show 20 Lines | GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, 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->points; i < gps->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_world_space(pt, gpstroke_iter.diff_mat, &pt2); | ||||
| gpencil_point_to_xy(&gsc, gps_active, &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) { | ||||
| ▲ Show 20 Lines • Show All 405 Lines • Show Last 20 Lines | |||||