Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_vertex_paint.c
| Show First 20 Lines • Show All 840 Lines • ▼ Show 20 Lines | static bool gpencil_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, | ||||
| /* Check if the stroke collide with brush. */ | /* Check if the stroke collide with brush. */ | ||||
| if (!ED_gpencil_stroke_check_collision(gsc, gps, gso->mval, radius, bound_mat)) { | if (!ED_gpencil_stroke_check_collision(gsc, gps, gso->mval, radius, bound_mat)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (gps->totpoints == 1) { | if (gps->totpoints == 1) { | ||||
| bGPDspoint pt_temp; | bGPDspoint pt_temp; | ||||
| pt = &gps->points[0]; | pt = &gps->points[0]; | ||||
| gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp); | gpencil_point_to_world_space(gps->points, diff_mat, &pt_temp); | ||||
| gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); | gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); | ||||
| pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | ||||
| /* Do bound-box check first. */ | /* Do bound-box check first. */ | ||||
| if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { | if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { | ||||
| /* only check if point is inside */ | /* only check if point is inside */ | ||||
| int mval_i[2]; | int mval_i[2]; | ||||
| round_v2i_v2fl(mval_i, gso->mval); | round_v2i_v2fl(mval_i, gso->mval); | ||||
| Show All 21 Lines | for (i = 0; (i + 1) < gps->totpoints; i++) { | ||||
| if (GPENCIL_ANY_VERTEX_MASK(gso->mask)) { | if (GPENCIL_ANY_VERTEX_MASK(gso->mask)) { | ||||
| if (!(pt1->flag & GP_SPOINT_SELECT) && !(pt2->flag & GP_SPOINT_SELECT)) { | if (!(pt1->flag & GP_SPOINT_SELECT) && !(pt2->flag & GP_SPOINT_SELECT)) { | ||||
| include_last = false; | include_last = false; | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| bGPDspoint npt; | bGPDspoint npt; | ||||
| gpencil_point_to_parent_space(pt1, diff_mat, &npt); | gpencil_point_to_world_space(pt1, diff_mat, &npt); | ||||
| gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); | gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); | ||||
| gpencil_point_to_parent_space(pt2, diff_mat, &npt); | gpencil_point_to_world_space(pt2, diff_mat, &npt); | ||||
| gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); | gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); | ||||
| /* Check that point segment of the bound-box of the selection stroke. */ | /* Check that point segment of the bound-box of the selection stroke. */ | ||||
| if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || | if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || | ||||
| ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { | ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { | ||||
| /* Check if point segment of stroke had anything to do with | /* Check if point segment of stroke had anything to do with | ||||
| * brush region (either within stroke painted, or on its lines) | * brush region (either within stroke painted, or on its lines) | ||||
| * - this assumes that line-width is irrelevant. | * - this assumes that line-width is irrelevant. | ||||
| ▲ Show 20 Lines • Show All 555 Lines • Show Last 20 Lines | |||||