Keep "lock" metadata when changing a Node's type, if applicable

(cherry picked from commit d015e4d6fc)
This commit is contained in:
Michael Alexsander 2020-05-18 11:38:48 -03:00 committed by Rémi Verschelde
parent 6dfd80673a
commit 3d8cc49ec5

View file

@ -2090,8 +2090,21 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
if (E->get().name == "__meta__")
if (E->get().name == "__meta__") {
if (Object::cast_to<CanvasItem>(newnode)) {
Dictionary metadata = n->get(E->get().name);
if (metadata.has("_edit_group_") && metadata["_edit_group_"]) {
newnode->set_meta("_edit_group_", true);
}
if (metadata.has("_edit_lock_") && metadata["_edit_lock_"]) {
newnode->set_meta("_edit_lock_", true);
}
}
continue;
}
if (default_oldnode->get(E->get().name) != n->get(E->get().name)) {
newnode->set(E->get().name, n->get(E->get().name));
}