diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-14 09:50:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-14 10:01:30 +0300 |
commit | c6cbcf83d0153922ac32452c198252f44867a6cb (patch) | |
tree | 2916f1301181d41655605dc472a762fe9c8aa641 /source/blender/editors/object/object_edit.c | |
parent | 6074f62d1a099fc378aa25506a93321dba2d956b (diff) |
Fix T61472: Hide Unselected fails w/ no selection
Also skip mesh recalculation when no hide/reveal is performed.
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 89f043966db..0115682c2c0 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -200,21 +200,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); const bool unselected = RNA_boolean_get(op->ptr, "unselected"); - - /* Do nothing if no objects was selected. */ - bool have_selected = false; - for (Base *base = view_layer->object_bases.first; base; base = base->next) { - if (base->flag & BASE_VISIBLE) { - if (base->flag & BASE_SELECTED) { - have_selected = true; - break; - } - } - } - - if (!have_selected) { - return OPERATOR_CANCELLED; - } + bool changed = false; /* Hide selected or unselected objects. */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { @@ -226,15 +212,20 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) if (base->flag & BASE_SELECTED) { ED_object_base_select(base, BA_DESELECT); base->flag |= BASE_HIDDEN; + changed = true; } } else { if (!(base->flag & BASE_SELECTED)) { ED_object_base_select(base, BA_DESELECT); base->flag |= BASE_HIDDEN; + changed = true; } } } + if (!changed) { + return OPERATOR_CANCELLED; + } BKE_layer_collection_sync(scene, view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); |