Merge pull request #78300 from ajreckof/fix-replace-node-destroying-Node-properties

Auto-update properties when replacing a node
This commit is contained in:
Yuri Sizov
2023-08-03 22:37:40 +02:00
5 changed files with 114 additions and 31 deletions

View File

@ -281,6 +281,8 @@ class SceneTreeDock : public VBoxContainer {
bool _update_node_path(Node *p_root_node, NodePath &r_node_path, HashMap<Node *, NodePath> *p_renames) const;
bool _check_node_path_recursive(Node *p_root_node, Variant &r_variant, HashMap<Node *, NodePath> *p_renames) const;
bool _check_node_recursive(Variant &r_variant, Node *p_node, Node *p_by_node, const String type_hint, String &r_warn_message);
void _replace_node(Node *p_node, Node *p_by_node, bool p_keep_properties = true, bool p_remove_old = true);
private:
static SceneTreeDock *singleton;
@ -306,6 +308,7 @@ public:
void set_selected(Node *p_node, bool p_emit_selected = false);
void fill_path_renames(Node *p_node, Node *p_new_parent, HashMap<Node *, NodePath> *p_renames);
void perform_node_renames(Node *p_base, HashMap<Node *, NodePath> *p_renames, HashMap<Ref<Animation>, HashSet<int>> *r_rem_anims = nullptr);
void perform_node_replace(Node *p_base, Node *p_node, Node *p_by_node);
SceneTreeEditor *get_tree_editor() { return scene_tree; }
EditorData *get_editor_data() { return editor_data; }
@ -315,7 +318,7 @@ public:
void show_tab_buttons();
void hide_tab_buttons();
void replace_node(Node *p_node, Node *p_by_node, bool p_keep_properties = true, bool p_remove_old = true);
void replace_node(Node *p_node, Node *p_by_node);
void attach_script_to_selected(bool p_extend);
void open_script_dialog(Node *p_for_node, bool p_extend);