From f91e05778612712050ed6f19ce9a2223c0404653 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 30 Nov 2017 18:38:07 -0200 Subject: Groups and collection: editing group collections Allow users to edit either the object group active collection or view layer one We can't support users selecting the group collections from the outliner group because that would be imply having an active group for the scene or workspace. But the way it is now allows to see and edit the collection values after the group is instanced. --- .../editors/space_outliner/outliner_select.c | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to '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 70d01007d89..08b5f337936 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -781,15 +781,24 @@ static eOLDrawState tree_element_active_collection( /* don't allow selecting a scene collection, it can have multiple layer collection * instances (which one would the user want to be selected then?) */ else if (tselem->type == TSE_LAYER_COLLECTION) { - ViewLayer *view_layer = CTX_data_view_layer(C); - LayerCollection *lc = te->directdata; - const int collection_index = BKE_layer_collection_findindex(view_layer, lc); + LayerCollection *layer_collection = te->directdata; + + switch (layer_collection->scene_collection->type) { + case COLLECTION_TYPE_NONE: + case COLLECTION_TYPE_GROUP_INTERNAL: + { + ViewLayer *view_layer = BKE_view_layer_find_from_collection(tselem->id, layer_collection); + const int collection_index = BKE_layer_collection_findindex(view_layer, layer_collection); - /* If the collection is part of a group we don't change active collection. */ - if (collection_index > -1) { - view_layer->active_collection = collection_index; - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + if (collection_index > -1) { + view_layer->active_collection = collection_index; + } + break; + } + default: + BLI_assert(!"Collection type not fully implemented"); } + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); } return OL_DRAWSEL_NONE; -- cgit v1.2.3