Keep 'Editor Description' metadata when changing a Node's type

Also copy edit group/lock when replacing a Node3D
This commit is contained in:
Gabriel Van Eyck 2020-10-18 11:22:54 -07:00
parent 6a8dfdb60e
commit a22275c8a2

View file

@ -2107,8 +2107,12 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
} }
if (E->get().name == "__meta__") { if (E->get().name == "__meta__") {
if (Object::cast_to<CanvasItem>(newnode)) { Dictionary metadata = n->get(E->get().name);
Dictionary metadata = n->get(E->get().name); if (metadata.has("_editor_description_")) {
newnode->set_meta("_editor_description_", metadata["_editor_description_"]);
}
if (Object::cast_to<CanvasItem>(newnode) || Object::cast_to<Node3D>(newnode)) {
if (metadata.has("_edit_group_") && metadata["_edit_group_"]) { if (metadata.has("_edit_group_") && metadata["_edit_group_"]) {
newnode->set_meta("_edit_group_", true); newnode->set_meta("_edit_group_", true);
} }