Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve_select.c
| Context not available. | |||||
| return false; | return false; | ||||
| } | } | ||||
| /* Helper to select all points in a UV row or column according to dir */ | |||||
| bool nurbs_select_bpoint(Nurb *nu, BPoint *bp, int dir, bool selstatus, short flag, bool hidden) { | |||||
| int pntsu = (nu->pntsu<=1)? 1 : nu->pntsu; | |||||
| int pntsv = (nu->pntsv<=1)? 1 : nu->pntsv; | |||||
| int idx = bp - nu->bp; | |||||
| int u,v; | |||||
| int uidx = idx%pntsu; | |||||
| int vidx = idx/pntsu; | |||||
| BLI_assert(0<=idx && idx<pntsu*pntsv); | |||||
| /* dir is 0:-v 1:+v 2:-u 3:+u */ | |||||
| if (dir==2 || dir==3) { | |||||
| for (u=0; u<pntsu; u++) { | |||||
| select_bpoint(&nu->bp[pntsu*vidx+u], selstatus, flag, hidden); | |||||
| } | |||||
| } | |||||
| if (dir==0 || dir==1) { | |||||
| for (v=0; v<pntsv; v++) { | |||||
| select_bpoint(&nu->bp[pntsu*v+uidx], selstatus, flag, hidden); | |||||
| } | |||||
| } | |||||
| return true; | |||||
| } | |||||
| /* returns 1 in case (de)selection was successful */ | /* returns 1 in case (de)selection was successful */ | ||||
| bool select_bpoint(BPoint *bp, bool selstatus, short flag, bool hidden) | bool select_bpoint(BPoint *bp, bool selstatus, short flag, bool hidden) | ||||
| { | { | ||||
| Context not available. | |||||
| { | { | ||||
| bool changed = false; | bool changed = false; | ||||
| for (Nurb *nu = editnurb->nurbs.first; nu; nu = nu->next) { | for (Nurb *nu = editnurb->nurbs.first; nu; nu = nu->next) { | ||||
| nu->flag2 |= CU_SELECTED2; | |||||
| changed |= ED_curve_nurb_select_all(nu); | changed |= ED_curve_nurb_select_all(nu); | ||||
| } | } | ||||
| return changed; | return changed; | ||||
| Context not available. | |||||
| { | { | ||||
| bool changed = false; | bool changed = false; | ||||
| for (Nurb *nu = editnurb->nurbs.first; nu; nu = nu->next) { | for (Nurb *nu = editnurb->nurbs.first; nu; nu = nu->next) { | ||||
| nu->flag2 &= ~CU_SELECTED2; | |||||
| changed |= ED_curve_nurb_deselect_all(nu); | changed |= ED_curve_nurb_deselect_all(nu); | ||||
| } | } | ||||
| return changed; | return changed; | ||||
| Context not available. | |||||
| return changed; | return changed; | ||||
| } | } | ||||
| /* Each Nurb object keeps track of the selected points on its control polygon. | |||||
| * This information is also used to decide which nurbs to show in the UV editor. | |||||
| * A Nurb is shown iff it has one or more of its BPoints selected. | |||||
| * The CU_SELECTED2 flag of nu->flag2 is where this data is stored. | |||||
| */ | |||||
| void ED_curve_propagate_selected_pts_to_flag2(Curve *cu) { | |||||
| Nurb *nu; | |||||
| EditNurb *editnurb = cu->editnurb; | |||||
| int numpts, i; | |||||
| for (nu=editnurb->nurbs.first; nu; nu=nu->next) { | |||||
| if (nu->type != CU_NURBS) continue; | |||||
| numpts = nu->pntsu * nu->pntsv; | |||||
| nu->flag2 &= ~CU_SELECTED2; | |||||
| for (i=0; i<numpts; i++) { | |||||
| if (nu->bp[i].f1 & SELECT) { | |||||
| nu->flag2 |= CU_SELECTED2; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * \param next: -1/1 for prev/next | * \param next: -1/1 for prev/next | ||||
| * \param cont: when true select continuously | * \param cont: when true select continuously | ||||
| Context not available. | |||||
| int a; | int a; | ||||
| const bool select = !RNA_boolean_get(op->ptr, "deselect"); | const bool select = !RNA_boolean_get(op->ptr, "deselect"); | ||||
| Base *basact = NULL; | Base *basact = NULL; | ||||
| int dir; /* for directional select (alt+click) 0:-v 1:+v 2:-u 3:+u */ | |||||
| view3d_operator_needs_opengl(C); | view3d_operator_needs_opengl(C); | ||||
| ED_view3d_viewcontext_init(C, &vc, depsgraph); | ED_view3d_viewcontext_init(C, &vc, depsgraph); | ||||
| copy_v2_v2_int(vc.mval, event->mval); | copy_v2_v2_int(vc.mval, event->mval); | ||||
| if (!ED_curve_pick_vert(&vc, 1, &nu, &bezt, &bp, NULL, &basact)) { | if (!ED_curve_pick_vert(&vc, 1, &nu, &bezt, &bp, NULL, &basact, &dir)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| Context not available. | |||||
| int vert_dst; | int vert_dst; | ||||
| void *vert_dst_p; | void *vert_dst_p; | ||||
| Base *basact = NULL; | Base *basact = NULL; | ||||
| int dir; /* for directional select (alt+click) 0:-v 1:+v 2:-u 3:+u */ | |||||
| view3d_operator_needs_opengl(C); | view3d_operator_needs_opengl(C); | ||||
| ED_view3d_viewcontext_init(C, &vc, depsgraph); | ED_view3d_viewcontext_init(C, &vc, depsgraph); | ||||
| copy_v2_v2_int(vc.mval, event->mval); | copy_v2_v2_int(vc.mval, event->mval); | ||||
| if (!ED_curve_pick_vert(&vc, 1, &nu_dst, &bezt_dst, &bp_dst, NULL, &basact)) { | if (!ED_curve_pick_vert(&vc, 1, &nu_dst, &bezt_dst, &bp_dst, NULL, &basact, &dir)) { | ||||
| return OPERATOR_PASS_THROUGH; | return OPERATOR_PASS_THROUGH; | ||||
| } | } | ||||
| Context not available. | |||||