Skip to content

Commit

Permalink
Keep 'Editor Description' metadata when changing a Node's type
Browse files Browse the repository at this point in the history
Also copy edit group/lock when replacing a Node3D
  • Loading branch information
gvaneyck committed Oct 18, 2020
1 parent 6a8dfdb commit a22275c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit a22275c

Please sign in to comment.