Skip to content

Commit

Permalink
Merge pull request #42878 from gvaneyck/copy-description-node-replace
Browse files Browse the repository at this point in the history
Keep 'Editor Description' metadata when changing a Node's type
  • Loading branch information
akien-mga authored Oct 19, 2020
2 parents 7318305 + a22275c commit fb8d7f9
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 fb8d7f9

Please sign in to comment.