From cc69831796cbc7038351283d7de33668be5360d4 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 29 Mar 2018 20:01:27 -0300 Subject: [PATCH] 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. --- source/blender/editors/object/object_select.c | 24 +++---------------- 1 file 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; }