summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorEric M <itsjusteza@gmail.com>2021-07-12 00:40:18 +1000
committerEric M <itsjusteza@gmail.com>2021-07-15 21:48:58 +1000
commit3ca25ffe8a8b2726cd959b20efe1a4066c75a6b6 (patch)
tree4aad28a14c69ab9684157de6c7f381c8f0cc6bbd /scene/main
parentfb3961b2ef9ed03501f98a8aa621f78679cc2be9 (diff)
Added Node name to print() when printing Nodes.
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp12
-rw-r--r--scene/main/node.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index ef6d2e72f6..233288ebfa 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1822,6 +1822,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<SceneState> &p_state) {
data.instance_state = p_state;
}
diff --git a/scene/main/node.h b/scene/main/node.h
index fc5af43829..95a9820874 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -329,6 +329,8 @@ public:
bool is_editable_instance(const Node *p_node) const;
Node *get_deepest_editable_node(Node *p_start_node) const;
+ virtual String to_string() override;
+
/* NOTIFICATIONS */
void propagate_notification(int p_notification);