Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_edit.c
| Show First 20 Lines • Show All 2,908 Lines • ▼ Show 20 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| mul_v3_m4v3(fpt, diff_mat, &pt->x); | mul_v3_m4v3(fpt, diff_mat, &pt->x); | ||||
| fpt[0] = gridf * floorf(0.5f + fpt[0] / gridf); | fpt[0] = gridf * floorf(0.5f + fpt[0] / gridf); | ||||
| fpt[1] = gridf * floorf(0.5f + fpt[1] / gridf); | fpt[1] = gridf * floorf(0.5f + fpt[1] / gridf); | ||||
| fpt[2] = gridf * floorf(0.5f + fpt[2] / gridf); | fpt[2] = gridf * floorf(0.5f + fpt[2] / gridf); | ||||
| /* return data */ | /* return data */ | ||||
| copy_v3_v3(&pt->x, fpt); | copy_v3_v3(&pt->x, fpt); | ||||
| gpencil_apply_parent_point(depsgraph, obact, gpl, pt); | gpencil_world_to_object_space_point(depsgraph, obact, gpl, pt); | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| else { | else { | ||||
| /* affect each selected point */ | /* affect each selected point */ | ||||
| for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { | for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { | ||||
| if (pt->flag & GP_SPOINT_SELECT) { | if (pt->flag & GP_SPOINT_SELECT) { | ||||
| copy_v3_v3(&pt->x, cursor_global); | copy_v3_v3(&pt->x, cursor_global); | ||||
| gpencil_apply_parent_point(depsgraph, obact, gpl, pt); | gpencil_world_to_object_space_point(depsgraph, obact, gpl, pt); | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,428 Lines • ▼ Show 20 Lines | static bool gpencil_test_lasso(bGPDstroke *gps, | ||||
| bGPDspoint *pt, | bGPDspoint *pt, | ||||
| const GP_SpaceConversion *gsc, | const GP_SpaceConversion *gsc, | ||||
| const float diff_mat[4][4], | const float diff_mat[4][4], | ||||
| void *user_data) | void *user_data) | ||||
| { | { | ||||
| const struct GP_SelectLassoUserData *data = user_data; | const struct GP_SelectLassoUserData *data = user_data; | ||||
| bGPDspoint pt2; | bGPDspoint pt2; | ||||
| int x0, y0; | int x0, y0; | ||||
| gpencil_point_to_parent_space(pt, diff_mat, &pt2); | gpencil_point_to_world_space(pt, diff_mat, &pt2); | ||||
| gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0); | gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0); | ||||
| /* test if in lasso */ | /* test if in lasso */ | ||||
| return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) && | return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) && | ||||
| BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX)); | BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX)); | ||||
| } | } | ||||
| typedef bool (*GPencilTestFn)(bGPDstroke *gps, | typedef bool (*GPencilTestFn)(bGPDstroke *gps, | ||||
| bGPDspoint *pt, | bGPDspoint *pt, | ||||
| ▲ Show 20 Lines • Show All 556 Lines • Show Last 20 Lines | |||||