diff options
Diffstat (limited to 'source/blender/editors/lattice')
-rw-r--r-- | source/blender/editors/lattice/editlattice_select.c | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c index ccf90452b0f..2ba1dde243b 100644 --- a/source/blender/editors/lattice/editlattice_select.c +++ b/source/blender/editors/lattice/editlattice_select.c @@ -366,51 +366,55 @@ void ED_lattice_flags_set(Object *obedit, int flag) static int lattice_select_all_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - Lattice *lt = obedit->data; - BPoint *bp; - int a; + ViewLayer *view_layer = CTX_data_view_layer(C); int action = RNA_enum_get(op->ptr, "action"); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); + if (action == SEL_TOGGLE) { action = SEL_SELECT; - - bp = lt->editlatt->latt->def; - a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; - - while (a--) { - if (bp->hide == 0) { - if (bp->f1 & SELECT) { - action = SEL_DESELECT; - break; - } + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + Lattice *lt = obedit->data; + if (BKE_lattice_is_any_selected(lt->editlatt->latt)) { + action = SEL_DESELECT; + break; } - bp++; } } - switch (action) { - case SEL_SELECT: - ED_lattice_flags_set(obedit, 1); - break; - case SEL_DESELECT: - ED_lattice_flags_set(obedit, 0); - break; - case SEL_INVERT: - bp = lt->editlatt->latt->def; - a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; - lt->editlatt->latt->actbp = LT_ACTBP_NONE; - - while (a--) { - if (bp->hide == 0) { - bp->f1 ^= SELECT; + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + Lattice *lt; + BPoint *bp; + int a; + + switch (action) { + case SEL_SELECT: + ED_lattice_flags_set(obedit, 1); + break; + case SEL_DESELECT: + ED_lattice_flags_set(obedit, 0); + break; + case SEL_INVERT: + lt = obedit->data; + bp = lt->editlatt->latt->def; + a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; + lt->editlatt->latt->actbp = LT_ACTBP_NONE; + + while (a--) { + if (bp->hide == 0) { + bp->f1 ^= SELECT; + } + bp++; } - bp++; - } - break; + break; + } + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); } + MEM_freeN(objects); - WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); return OPERATOR_FINISHED; } |