Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-22 09:11:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-22 09:11:13 +0300
commitee1327a84cd5d76f58d40df28d8f8b30f7674d4a (patch)
tree0786e2a38f0ea2994b10f793cf8878c5bdd603c3 /source/blender/editors/lattice
parent99f994e7edfd20fb162ea45cad09b5e8c7fc7e26 (diff)
Multi-Object-Mode: EditLattice Select All
D3164 by @ranjian0
Diffstat (limited to 'source/blender/editors/lattice')
-rw-r--r--source/blender/editors/lattice/editlattice_select.c72
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;
}