diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-01-14 13:41:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-01-14 13:41:54 -0300 |
commit | 6f884cc88409fa1eb25b95f0fe91fc848c1b1481 (patch) | |
tree | 751d96196a16bb693566f38bf4d157c2f6ac43e0 /editor/scene_tree_dock.cpp | |
parent | ed9b230744eb5dbb3a5e956c32ea87791abed68c (diff) |
Use SceneTreeDock to replace particles node properly, fixes #24162
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r-- | editor/scene_tree_dock.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 6c79fad82c..daa7f92dcf 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1737,24 +1737,28 @@ void SceneTreeDock::_create() { } } -void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node) { +void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_properties) { 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); - for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) - continue; - if (E->get().name == "__meta__") - continue; - if (default_oldnode->get(E->get().name) != n->get(E->get().name)) { - newnode->set(E->get().name, n->get(E->get().name)); + if (p_keep_properties) { + Node *default_oldnode = Object::cast_to<Node>(ClassDB::instance(n->get_class())); + List<PropertyInfo> pinfo; + n->get_property_list(&pinfo); + + for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { + if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) + continue; + if (E->get().name == "__meta__") + continue; + 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); } - memdelete(default_oldnode); editor->push_item(NULL); |