[Bf-blender-cvs] [6af21b4e7f] blender2.8: Highlight active collection in outliner

Julian Eisel noreply at git.blender.org
Tue Feb 28 14:14:25 CET 2017


Commit: 6af21b4e7f5d6920cf17d836ed2b51b186e09e77
Author: Julian Eisel
Date:   Tue Feb 28 14:06:04 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB6af21b4e7f5d6920cf17d836ed2b51b186e09e77

Highlight active collection in outliner

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

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

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

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index b8a4335748..cc5afd5149 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1237,7 +1237,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Sce
 				}
 			}
 			else {
-				active = tree_element_type_active(NULL, scene, sl, soops, te, tselem, OL_SETSEL_NONE, false);
+				active = tree_element_type_active(C, scene, sl, soops, te, tselem, OL_SETSEL_NONE, false);
 			}
 
 			if (active != OL_DRAWSEL_NONE) {
@@ -1366,9 +1366,7 @@ static void outliner_draw_tree_element(
 			}
 		}
 		else {
-			if (tree_element_type_active(NULL, scene, sl, soops, te, tselem, OL_SETSEL_NONE, false) != OL_DRAWSEL_NONE) {
-				active = OL_DRAWSEL_ACTIVE;
-			}
+			active = tree_element_type_active(C, scene, sl, soops, te, tselem, OL_SETSEL_NONE, false);
 			rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
 		}
 		
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 0793ba50c3..cb4d5e9255 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -186,7 +186,7 @@ static eOLDrawState tree_element_set_active_object(
 			do_outliner_object_select_recursive(scene, ob, (ob->flag & SELECT) != 0);
 		}
 
-		if (C) {
+		if (set != OL_SETSEL_NONE) {
 			ED_object_base_activate(C, base); /* adds notifier */
 			WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 		}
@@ -757,7 +757,12 @@ static eOLDrawState tree_element_active_keymap_item(
 static eOLDrawState tree_element_active_collection(
         bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set)
 {
-	if (set != OL_SETSEL_NONE) {
+	if (set == OL_SETSEL_NONE) {
+		if (CTX_data_layer_collection(C) == te->directdata) {
+			return OL_DRAWSEL_NORMAL;
+		}
+	}
+	else {
 		SceneLayer *sl = CTX_data_scene_layer(C);
 		LayerCollection *lc = te->directdata;
 		const int collection_index = BKE_layer_collection_findindex(sl, lc);
@@ -765,7 +770,6 @@ static eOLDrawState tree_element_active_collection(
 		BLI_assert(collection_index >= 0);
 		sl->active_collection = collection_index;
 		WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-		return OL_DRAWSEL_ACTIVE;
 	}
 
 	return OL_DRAWSEL_NONE;
@@ -803,8 +807,6 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, SceneLayer *sl, Spac
 
 /**
  * Generic call for non-id data to make/check active in UI
- *
- * \note Context can be NULL when ``(set == OL_SETSEL_NONE)``
  */
 eOLDrawState tree_element_type_active(
         bContext *C, Scene *scene, SceneLayer *sl, SpaceOops *soops,




More information about the Bf-blender-cvs mailing list