Merge pull request #17380 from robfram/fix-change-node-type

Fix overwriting all common properties when using `Change Type` tool
This commit is contained in:
Rémi Verschelde 2018-03-13 11:54:10 +01:00 committed by GitHub
commit 319167a67a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);