Merge pull request #42878 from gvaneyck/copy-description-node-replace

Keep 'Editor Description' metadata when changing a Node's type
This commit is contained in:
Rémi Verschelde 2020-10-19 08:30:26 +02:00 committed by GitHub
commit fb8d7f9a84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 (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_"]) {
newnode->set_meta("_edit_group_", true);
}