diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-03-13 11:54:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 11:54:10 +0100 |
commit | 319167a67ab027fe63b533d09efe6b4dfb85b8c7 (patch) | |
tree | bbaed92efe4cb6c9d9771b58cec7216884ef7b73 | |
parent | b49746f3cd3aeead93f795ed4b08122c46faa413 (diff) | |
parent | 8ea4ea0d53e772673dea69a9df83aa8445ad49ea (diff) |
Merge pull request #17380 from robfram/fix-change-node-type
Fix overwriting all common properties when using `Change Type` tool
-rw-r--r-- | editor/scene_tree_dock.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9f0f62592b..002d702bac 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1411,6 +1411,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node) { Node *n = p_node; Node *newnode = p_by_node; + Node *default_oldnode = Object::cast_to<Node>(ClassDB::instance(n->get_class())); List<PropertyInfo> pinfo; n->get_property_list(&pinfo); @@ -1419,8 +1420,11 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node) { continue; if (E->get().name == "__meta__") continue; - newnode->set(E->get().name, n->get(E->get().name)); + if (default_oldnode->get(E->get().name) != n->get(E->get().name)) { + newnode->set(E->get().name, n->get(E->get().name)); + } } + memdelete(default_oldnode); editor->push_item(NULL); |