diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-03-01 15:10:29 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-03-01 17:35:21 +0300 |
commit | b00b9dadd819d3b94405f755131e609afa827438 (patch) | |
tree | ea73eb72a089799151299e32d861e60f1af94cb9 /source/blender/editors/space_outliner/outliner_collections.c | |
parent | c1f43c9dc654f5257790654f4b77c7e55c137a19 (diff) |
Outliner: Support dragging object into collection
Doing this will add the object to the collection.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_collections.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_collections.c | 26 |
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; } |