summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-05 09:56:06 +0200
committerGitHub <noreply@github.com>2019-07-05 09:56:06 +0200
commit26cff6ff926b2f2cd879daf9aadc99e16fd6516b (patch)
tree1f3c6d69d2b6edef2e68baebc16ec106b6cab1ff
parent133a07ed2dc148c7bde38884eea9f4d367510af8 (diff)
parent839c3bd1bff722974d80f1d799916e558d2a10eb (diff)
Merge pull request #30316 from sparkart/master
Reparent selection without flattening
-rw-r--r--editor/scene_tree_dock.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 2458aa0759..37e37e28a6 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -2226,23 +2226,20 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) {
void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) {
- Vector<Node *> nodes;
- Node *to_node;
-
- for (int i = 0; i < p_nodes.size(); i++) {
- Node *n = get_node((p_nodes[i]));
- if (n) {
- nodes.push_back(n);
- }
- }
+ List<Node *> selection = editor_selection->get_selected_node_list();
- if (nodes.size() == 0)
- return;
+ if (selection.empty())
+ return; //nothing to reparent
- to_node = get_node(p_to);
+ Node *to_node = get_node(p_to);
if (!to_node)
return;
+ Vector<Node *> nodes;
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ nodes.push_back(E->get());
+ }
+
int to_pos = -1;
_normalize_drop(to_node, to_pos, p_type);