Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve_select.c
| Context not available. | |||||
| static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) | static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | |||||
| ListBase *editnurb = object_editcurve_get(obedit); | |||||
| Nurb *nu; | Nurb *nu; | ||||
| BPoint *bp, *tempbp; | BPoint *bp, *tempbp; | ||||
| int a; | int a; | ||||
| Context not available. | |||||
| /* the behavior of "select more" of mesh tools. */ | /* the behavior of "select more" of mesh tools. */ | ||||
| /* The algorithm is designed to work in planar cases so it */ | /* The algorithm is designed to work in planar cases so it */ | ||||
| /* may not be optimal always (example: end of NURBS sphere) */ | /* may not be optimal always (example: end of NURBS sphere) */ | ||||
| if (obedit->type == OB_SURF) { | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| for (nu = editnurb->first; nu; nu = nu->next) { | uint objects_len = 0; | ||||
| BLI_bitmap *selbpoints; | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); | ||||
| a = nu->pntsu * nu->pntsv; | for (uint ob_index = 0; ob_index < objects_len; ob_index++) | ||||
| bp = nu->bp; | { | ||||
| selbpoints = BLI_BITMAP_NEW(a, "selectlist"); | Object *obedit = objects[ob_index]; | ||||
| while (a > 0) { | ListBase *editnurb = object_editcurve_get(obedit); | ||||
| if ((!BLI_BITMAP_TEST(selbpoints, a)) && (bp->hide == 0) && (bp->f1 & SELECT)) { | |||||
| /* upper control point */ | |||||
| if (a % nu->pntsu != 0) { | |||||
| tempbp = bp - 1; | |||||
| if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | |||||
| } | |||||
| /* left control point. select only if it is not selected already */ | if (obedit->type == OB_SURF) { | ||||
| if (a - nu->pntsu > 0) { | for (nu = editnurb->first; nu; nu = nu->next) { | ||||
| sel = 0; | BLI_bitmap *selbpoints; | ||||
| tempbp = bp + nu->pntsu; | a = nu->pntsu * nu->pntsv; | ||||
| if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | bp = nu->bp; | ||||
| /* make sure selected bpoint is discarded */ | selbpoints = BLI_BITMAP_NEW(a, "selectlist"); | ||||
| if (sel == 1) BLI_BITMAP_ENABLE(selbpoints, a - nu->pntsu); | while (a > 0) { | ||||
| } | if ((!BLI_BITMAP_TEST(selbpoints, a)) && (bp->hide == 0) && (bp->f1 & SELECT)) { | ||||
| /* upper control point */ | |||||
| if (a % nu->pntsu != 0) { | |||||
| tempbp = bp - 1; | |||||
| if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | |||||
| } | |||||
| /* right control point */ | /* left control point. select only if it is not selected already */ | ||||
| if (a + nu->pntsu < nu->pntsu * nu->pntsv) { | if (a - nu->pntsu > 0) { | ||||
| tempbp = bp - nu->pntsu; | sel = 0; | ||||
| if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | tempbp = bp + nu->pntsu; | ||||
| } | if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | ||||
| /* make sure selected bpoint is discarded */ | |||||
| if (sel == 1) BLI_BITMAP_ENABLE(selbpoints, a - nu->pntsu); | |||||
| } | |||||
| /* lower control point. skip next bp in case selection was made */ | /* right control point */ | ||||
| if (a % nu->pntsu != 1) { | if (a + nu->pntsu < nu->pntsu * nu->pntsv) { | ||||
| sel = 0; | tempbp = bp - nu->pntsu; | ||||
| tempbp = bp + 1; | if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | ||||
| if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | } | ||||
| if (sel) { | |||||
| bp++; | /* lower control point. skip next bp in case selection was made */ | ||||
| a--; | if (a % nu->pntsu != 1) { | ||||
| sel = 0; | |||||
| tempbp = bp + 1; | |||||
| if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE); | |||||
| if (sel) { | |||||
| bp++; | |||||
| a--; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| bp++; | |||||
| a--; | |||||
| } | } | ||||
| bp++; | MEM_freeN(selbpoints); | ||||
| a--; | |||||
| } | } | ||||
| MEM_freeN(selbpoints); | |||||
| } | } | ||||
| } | else { | ||||
| else { | select_adjacent_cp(editnurb, 1, 0, SELECT); | ||||
| select_adjacent_cp(editnurb, 1, 0, SELECT); | select_adjacent_cp(editnurb, -1, 0, SELECT); | ||||
| select_adjacent_cp(editnurb, -1, 0, SELECT); | } | ||||
| } | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | ||||
| } | |||||
| MEM_freeN(objects); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||