diff --git a/scene/main/node.cpp b/scene/main/node.cpp index eca805f5c80..dd06b9671e4 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1866,6 +1866,18 @@ Node *Node::get_deepest_editable_node(Node *p_start_node) const { return node; } +String Node::to_string() { + if (get_script_instance()) { + bool valid; + String ret = get_script_instance()->to_string(&valid); + if (valid) { + return ret; + } + } + + return (get_name() ? String(get_name()) + ":" : "") + Object::to_string(); +} + void Node::set_scene_instance_state(const Ref &p_state) { data.instance_state = p_state; } diff --git a/scene/main/node.h b/scene/main/node.h index 296fa922196..dc7541d9987 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -314,6 +314,8 @@ public: bool is_editable_instance(const Node *p_node) const; Node *get_deepest_editable_node(Node *start_node) const; + virtual String to_string(); + /* NOTIFICATIONS */ void propagate_notification(int p_notification);