From 3a1748146bcdb0d99d9620b3a52b77110e2eb5f1 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 3 Mar 2017 16:14:21 +0100 Subject: Layers: move SceneCollection This is to be used from the Outliner, when dragging and dropping. It does not include moving LayerCollection (from Active Render Layer) --- source/blender/editors/space_outliner/outliner_tree.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/space_outliner/outliner_tree.c') diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index afd9610b6bf..1db530804b7 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1298,21 +1298,30 @@ static void outliner_layer_collections_reorder(const Scene *scene, TreeElement * BKE_layer_collection_reinsert_after(scene, sl, insert_coll, insert_handle_coll); } else if (action == TE_INSERT_INTO) { - BKE_layer_collection_reinsert_into(insert_coll, insert_handle_coll); + BKE_layer_collection_move_into(scene, insert_coll, insert_handle_coll); } } static void outliner_scene_collections_reorder(const Scene *scene, TreeElement *insert_element, TreeElement *insert_handle, TreeElementInsertType action) { - SceneCollection *insert_coll = insert_element->directdata; - SceneCollection *insert_handle_coll = insert_handle ? insert_handle->directdata : NULL; + SceneCollection *sc_src = insert_element->directdata; + SceneCollection *sc_dst = insert_handle ? insert_handle->directdata : NULL; if (action == TE_INSERT_AFTER) { - BKE_collection_reinsert_after(scene, insert_coll, insert_handle_coll); + if (sc_dst == NULL) { + /* It needs a SceneCollection to use as reference, + * specially now that we are to allow insert in collections + * that don't belong to the same hierarchical level*/ + TODO_LAYER_OPERATORS; + /* BKE_collection_move_after(scene, sc_dst, sc_src); */ + } + else { + BKE_collection_move_below(scene, sc_dst, sc_src); + } } else if (action == TE_INSERT_INTO) { - BKE_collection_reinsert_into(insert_coll, insert_handle_coll); + BKE_collection_move_into(scene, sc_dst, sc_src); } } -- cgit v1.2.3