diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-12-01 16:24:21 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-12-01 19:15:54 +0300 |
commit | be9e469ead227aee8d4c29b98a125cf599c5c8bb (patch) | |
tree | 381ee3e58a94495a923c575bb8185899d84ab4bc /source/blender/editors/space_outliner/outliner_select.c | |
parent | e8c15e0ed15f8369d0d0f706b4953fb64e357902 (diff) |
Groups and collection: initial integration
Since we are ditching layers from Blender (2.8) we need a replacement to
control groups visibility. This commit introduces collections as the building
blocks for groups, allowing users to control visibility as well as overrides
for groups.
Features
========
* Groups now have collections
This way you can change the visibility of a collection inside a group, and add
overrides which are part of the group and are prioritized over other overrides.
* Outliner
Groups can inspect their collections, change visibility, and add/remove members.
To change an override of a group collection, you need to select an instance of
the group, and then you can choose "group" in the collection properties editor
to edit this group active collection instead of the view layer one.
* Dupli groups overrides
We can now have multiple instances of the same group with an original "override"
and different overrides depending on the collection the instanced object is part
of.
Technical
=========
* Layers
We use the same api for groups and scene as much as possible.
Reviewers: sergey (depsgraph), mont29 (read/write and user count)
Differential Revision: https://developer.blender.org/D2892
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 5215efaa05c..70d01007d89 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -44,6 +44,7 @@ #include "BLI_listbase.h" #include "BKE_context.h" +#include "BKE_group.h" #include "BKE_object.h" #include "BKE_layer.h" #include "BKE_scene.h" @@ -784,9 +785,11 @@ static eOLDrawState tree_element_active_collection( LayerCollection *lc = te->directdata; const int collection_index = BKE_layer_collection_findindex(view_layer, lc); - BLI_assert(collection_index >= 0); - view_layer->active_collection = collection_index; - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + /* 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); + } } return OL_DRAWSEL_NONE; @@ -906,26 +909,30 @@ static void do_outliner_item_activate_tree_element( } else if (te->idcode == ID_GR) { Group *gr = (Group *)tselem->id; - GroupObject *gob; if (extend) { int sel = BA_SELECT; - for (gob = gr->gobject.first; gob; gob = gob->next) { - if (gob->ob->flag & SELECT) { + FOREACH_GROUP_BASE(gr, base) + { + if (base->flag & BASE_SELECTED) { sel = BA_DESELECT; break; } } + FOREACH_GROUP_BASE_END - for (gob = gr->gobject.first; gob; gob = gob->next) { - ED_object_base_select(BKE_view_layer_base_find(view_layer, gob->ob), sel); + FOREACH_GROUP_OBJECT(gr, object) + { + ED_object_base_select(BKE_view_layer_base_find(view_layer, object), sel); } + FOREACH_GROUP_OBJECT_END } else { BKE_view_layer_base_deselect_all(view_layer); - for (gob = gr->gobject.first; gob; gob = gob->next) { - Base *base = BKE_view_layer_base_find(view_layer, gob->ob); + FOREACH_GROUP_OBJECT(gr, object) + { + Base *base = BKE_view_layer_base_find(view_layer, object); /* Object may not be in this scene */ if (base != NULL) { if ((base->flag & BASE_SELECTED) == 0) { @@ -933,6 +940,7 @@ static void do_outliner_item_activate_tree_element( } } } + FOREACH_GROUP_OBJECT_END } WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); |