[Bf-blender-cvs] [cc69831796c] blender2.8: Select Grouped: Collection Part II

Dalai Felinto noreply at git.blender.org
Fri Mar 30 01:06:03 CEST 2018


Commit: cc69831796cbc7038351283d7de33668be5360d4
Author: Dalai Felinto
Date:   Thu Mar 29 20:01:27 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBcc69831796cbc7038351283d7de33668be5360d4

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.

===================================================================

M	source/blender/editors/object/object_select.c

===================================================================

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;
 }



More information about the Bf-blender-cvs mailing list