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

Also copy edit group/lock when replacing a Node3D

(cherry picked from commit a22275c8a2)
This commit is contained in:
Gabriel Van Eyck 2020-10-18 11:22:54 -07:00 committed by Rémi Verschelde
parent 730d42d8a4
commit 5b9c16a324
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 2 deletions

View File

@ -2128,8 +2128,12 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
continue;
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<Spatial>(newnode)) {
if (metadata.has("_edit_group_") && metadata["_edit_group_"]) {
newnode->set_meta("_edit_group_", true);
}