[Bf-blender-cvs] [c80f9822fd] blender2.8: Support activating collections from outliner

Julian Eisel noreply at git.blender.org
Thu Feb 9 20:32:50 CET 2017


Commit: c80f9822fdb7bb3a647197bc5bdc5611fbd3b29e
Author: Julian Eisel
Date:   Thu Feb 9 20:25:56 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBc80f9822fdb7bb3a647197bc5bdc5611fbd3b29e

Support activating collections from outliner

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

M	source/blender/editors/space_outliner/outliner_select.c

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

diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index f0ef184b4f..1fad5f2621 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -754,6 +754,24 @@ static eOLDrawState tree_element_active_keymap_item(
 	return OL_DRAWSEL_NONE;
 }
 
+static eOLDrawState tree_element_active_collection(
+        bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set)
+{
+	if (set != OL_SETSEL_NONE) {
+		Scene *scene = CTX_data_scene(C);
+		SceneLayer *slayer = BLI_findlink(&scene->render_layers, scene->active_layer);
+		LayerCollection *collection = te->directdata;
+		const int collection_index = BKE_layer_collection_findindex(slayer, collection);
+
+		BLI_assert(collection_index >= 0);
+		slayer->active_collection = collection_index;
+		WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
+		return OL_DRAWSEL_ACTIVE;
+	}
+
+	return OL_DRAWSEL_NONE;
+}
+
 /* ---------------------------------------------- */
 
 /* generic call for ID data check or make/check active in UI */
@@ -831,7 +849,8 @@ eOLDrawState tree_element_type_active(
 		case TSE_GP_LAYER:
 		    //return tree_element_active_gplayer(C, scene, s, te, tselem, set);
 			break;
-			
+		case TSE_COLLECTION:
+			return tree_element_active_collection(C, te, tselem, set);
 	}
 	return OL_DRAWSEL_NONE;
 }
@@ -849,7 +868,7 @@ static void outliner_item_activate(
 	/* always makes active object, except for some specific types.
 	 * Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects, we do not want
 	 * to switch out of edit mode (see T48328 for details). */
-	if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, TSE_EBONE)) {
+	if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, TSE_EBONE, TSE_COLLECTION)) {
 		tree_element_set_active_object(C, scene, sl, soops, te,
 		                               (extend && tselem->type == 0) ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
 		                               recursive && tselem->type == 0);




More information about the Bf-blender-cvs mailing list