Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/lattice/editlattice_select.c
| Context not available. | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_lattice.h" | #include "ED_lattice.h" | ||||
| Context not available. | |||||
| static int lattice_select_all_exec(bContext *C, wmOperator *op) | static int lattice_select_all_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Lattice *lt = obedit->data; | uint objects_len = 0; | ||||
| BPoint *bp; | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode(view_layer, &objects_len); | ||||
| int a; | |||||
| int action = RNA_enum_get(op->ptr, "action"); | for (uint ob_index = 0; ob_index < objects_len; ob_index++) | ||||
| { | |||||
| if (action == SEL_TOGGLE) { | Object *obedit = objects[ob_index]; | ||||
| action = SEL_SELECT; | Lattice *lt = obedit->data; | ||||
| BPoint *bp; | |||||
| bp = lt->editlatt->latt->def; | int a; | ||||
| a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; | int action = RNA_enum_get(op->ptr, "action"); | ||||
| while (a--) { | if (action == SEL_TOGGLE) { | ||||
| if (bp->hide == 0) { | action = SEL_SELECT; | ||||
| if (bp->f1 & SELECT) { | |||||
| action = SEL_DESELECT; | bp = lt->editlatt->latt->def; | ||||
| break; | a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; | ||||
| } | |||||
| } | while (a--) { | ||||
| bp++; | if (bp->hide == 0) { | ||||
| } | if (bp->f1 & SELECT) { | ||||
| } | action = SEL_DESELECT; | ||||
| break; | |||||
| switch (action) { | } | ||||
| case SEL_SELECT: | } | ||||
| ED_lattice_flags_set(obedit, 1); | bp++; | ||||
| break; | } | ||||
| case SEL_DESELECT: | } | ||||
| ED_lattice_flags_set(obedit, 0); | |||||
| break; | switch (action) { | ||||
| case SEL_INVERT: | case SEL_SELECT: | ||||
| bp = lt->editlatt->latt->def; | ED_lattice_flags_set(obedit, 1); | ||||
| a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; | break; | ||||
| lt->editlatt->latt->actbp = LT_ACTBP_NONE; | case SEL_DESELECT: | ||||
| ED_lattice_flags_set(obedit, 0); | |||||
| while (a--) { | break; | ||||
| if (bp->hide == 0) { | case SEL_INVERT: | ||||
| bp->f1 ^= SELECT; | bp = lt->editlatt->latt->def; | ||||
| } | a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; | ||||
| bp++; | lt->editlatt->latt->actbp = LT_ACTBP_NONE; | ||||
| } | |||||
| break; | while (a--) { | ||||
| } | if (bp->hide == 0) { | ||||
| bp->f1 ^= SELECT; | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | } | ||||
| bp++; | |||||
| } | |||||
| break; | |||||
| } | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | |||||
| } | |||||
| MEM_freeN(objects); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||