diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-03-30 02:01:27 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-03-30 02:03:47 +0300 |
commit | cc69831796cbc7038351283d7de33668be5360d4 (patch) | |
tree | f6d5ac165af7b41d8d42bc84a2fc8b66d306e050 | |
parent | 41a81fece4ff031b512d2303ca8956824d76e6ff (diff) |
Select Grouped: Collection Part II
Selecting not only the objetcs directly linked to the selected collection.
So we also do it for the objetcs in the nested collections, just as we can
do from the outliner.
-rw-r--r-- | source/blender/editors/object/object_select.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 829144dcb93..2feca9184f8 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -768,17 +768,7 @@ static bool select_grouped_collection(bContext *C, Object *ob) /* Select object } else if (collection_count == 1) { collection = ob_collections[0].collection; - CTX_DATA_BEGIN (C, Base *, base, visible_bases) - { - if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) { - if (BKE_collection_object_exists(collection, base->object)) { - ED_object_base_select(base, BA_SELECT); - changed = true; - } - } - } - CTX_DATA_END; - return changed; + return BKE_collection_objects_select(CTX_data_view_layer(C), collection); } /* build the menu. */ @@ -1139,17 +1129,9 @@ static int object_select_same_collection_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; } - CTX_DATA_BEGIN (C, Base *, base, visible_bases) - { - if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) { - if (BKE_collection_object_exists(collection, base->object)) { - ED_object_base_select(base, BA_SELECT); - } - } + if (BKE_collection_objects_select(CTX_data_view_layer(C), collection)) { + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); } - CTX_DATA_END; - - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); return OPERATOR_FINISHED; } |