Resolves Issue #30271 Reparent selection without flattening

When reparenting a multi-selection via drag and drop, the hierarchy was flattened. This change resolves that issue.
This commit is contained in:
Emmanuel Barroga 2019-07-04 06:41:21 -07:00
parent 7b569e91c0
commit 839c3bd1bf

View file

@ -2225,23 +2225,20 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) {
void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) { void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) {
Vector<Node *> nodes; List<Node *> selection = editor_selection->get_selected_node_list();
Node *to_node;
for (int i = 0; i < p_nodes.size(); i++) { if (selection.empty())
Node *n = get_node((p_nodes[i])); return; //nothing to reparent
if (n) {
nodes.push_back(n);
}
}
if (nodes.size() == 0) Node *to_node = get_node(p_to);
return;
to_node = get_node(p_to);
if (!to_node) if (!to_node)
return; return;
Vector<Node *> nodes;
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
nodes.push_back(E->get());
}
int to_pos = -1; int to_pos = -1;
_normalize_drop(to_node, to_pos, p_type); _normalize_drop(to_node, to_pos, p_type);