Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_vertex_paint.c
| Show First 20 Lines • Show All 902 Lines • ▼ Show 20 Lines | for (i = 0; (i + 1) < gps->totpoints; i++) { | ||||
| /* 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 linewidth is irrelevant | * - this assumes that linewidth is irrelevant | ||||
| */ | */ | ||||
| if (gpencil_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { | if (gpencil_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { | ||||
| /* To each point individually... */ | /* To each point individually... */ | ||||
| pt = &gps->points[i]; | pt = &gps->points[i]; | ||||
| pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | pt_active = pt->runtime.pt_orig; | ||||
| index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; | |||||
| if (pt_active != NULL) { | if (pt_active != NULL) { | ||||
| /* If masked and the point is not selected, skip it. */ | /* If masked and the point is not selected, skip it. */ | ||||
| if ((GPENCIL_ANY_VERTEX_MASK(gso->mask)) && | if ((GPENCIL_ANY_VERTEX_MASK(gso->mask)) && | ||||
| ((pt_active->flag & GP_SPOINT_SELECT) == 0)) { | ((pt_active->flag & GP_SPOINT_SELECT) == 0)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; | |||||
| hit = true; | hit = true; | ||||
| gpencil_save_selected_point(gso, gps_active, index, pc1); | gpencil_save_selected_point(gso, gps_active, index, pc1); | ||||
| saved = true; | saved = true; | ||||
| } | } | ||||
| /* Only do the second point if this is the last segment, | /* Only do the second point if this is the last segment, | ||||
| * and it is unlikely that the point will get handled | * and it is unlikely that the point will get handled | ||||
| * otherwise. | * otherwise. | ||||
| * | * | ||||
| * NOTE: There is a small risk here that the second point wasn't really | * NOTE: There is a small risk here that the second point wasn't really | ||||
| * actually in-range. In that case, it only got in because | * actually in-range. In that case, it only got in because | ||||
| * the line linking the points was! | * the line linking the points was! | ||||
| */ | */ | ||||
| if (i + 1 == gps->totpoints - 1) { | if (i + 1 == gps->totpoints - 1) { | ||||
| pt = &gps->points[i + 1]; | pt = &gps->points[i + 1]; | ||||
| pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | pt_active = pt->runtime.pt_orig; | ||||
| index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1; | |||||
| if (pt_active != NULL) { | if (pt_active != NULL) { | ||||
| index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1; | |||||
| hit = true; | hit = true; | ||||
| gpencil_save_selected_point(gso, gps_active, index, pc2); | gpencil_save_selected_point(gso, gps_active, index, pc2); | ||||
| include_last = false; | include_last = false; | ||||
| saved = true; | saved = true; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| include_last = true; | include_last = true; | ||||
| } | } | ||||
| } | } | ||||
| else if (include_last) { | else if (include_last) { | ||||
| /* This case is for cases where for whatever reason the second vert (1st here) | /* This case is for cases where for whatever reason the second vert (1st here) | ||||
| * doesn't get included because the whole edge isn't in bounds, | * doesn't get included because the whole edge isn't in bounds, | ||||
| * but it would've qualified since it did with the previous step | * but it would've qualified since it did with the previous step | ||||
| * (but wasn't added then, to avoid double-ups). | * (but wasn't added then, to avoid double-ups). | ||||
| */ | */ | ||||
| pt = &gps->points[i]; | pt = &gps->points[i]; | ||||
| pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; | pt_active = pt->runtime.pt_orig; | ||||
| index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; | |||||
| if (pt_active != NULL) { | if (pt_active != NULL) { | ||||
| index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; | |||||
| hit = true; | hit = true; | ||||
| gpencil_save_selected_point(gso, gps_active, index, pc1); | gpencil_save_selected_point(gso, gps_active, index, pc1); | ||||
| include_last = false; | include_last = false; | ||||
| saved = true; | saved = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 492 Lines • Show Last 20 Lines | |||||