Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_collections.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 87a9e019ee7..c5cfd47486f 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -54,6 +54,21 @@ static LayerCollection *outliner_collection_active(bContext *C)
return CTX_data_layer_collection(C);
}
+SceneCollection *outliner_scene_collection_from_tree_element(TreeElement *te)
+{
+ TreeStoreElem *tselem = TREESTORE(te);
+
+ if (tselem->type == TSE_SCENE_COLLECTION) {
+ return te->directdata;
+ }
+ else if (tselem->type == TSE_LAYER_COLLECTION) {
+ LayerCollection *lc = te->directdata;
+ return lc->scene_collection;
+ }
+
+ return NULL;
+}
+
#if 0
static CollectionOverride *outliner_override_active(bContext *UNUSED(C))
{
@@ -294,16 +309,9 @@ static TreeTraversalAction collection_delete_cb(TreeElement *te, void *customdat
{
struct CollectionDeleteData *data = customdata;
TreeStoreElem *tselem = TREESTORE(te);
- SceneCollection *scene_collection;
+ SceneCollection *scene_collection = outliner_scene_collection_from_tree_element(te);
- if (tselem->type == TSE_LAYER_COLLECTION) {
- LayerCollection *lc = te->directdata;
- scene_collection = lc->scene_collection;
- }
- else if (tselem->type == TSE_SCENE_COLLECTION) {
- scene_collection = te->directdata;
- }
- else {
+ if (!scene_collection) {
return TRAVERSE_SKIP_CHILDS;
}