From 879c37d65802735f17326c1a668fdd7d9209bc53 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 4 Sep 2021 00:12:37 +0200 Subject: [PATCH] Rename Node's `NOTIFICATION_PATH_CHANGED` to `NOTIFICATION_PATH_RENAMED` The new name is less misleading, as the notification is only emitted when the node name (or one of its parents' names) is changed. --- doc/classes/Node.xml | 4 ++-- scene/main/node.cpp | 6 +++--- scene/main/node.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 7d79c504668..ef03191a189 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -786,8 +786,8 @@ Notification received when a drag ends. - - Notification received when the node's [NodePath] changed. + + Notification received when the node's name or one of its parents' name is changed. This notification is [i]not[/i] received when the node is removed from the scene tree to be added to another parent later on. Notification received every frame when the internal process flag is set (see [method set_process_internal]). diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f2a2648140a..0ea9c938736 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -116,7 +116,7 @@ void Node::_notification(int p_notification) { get_multiplayer()->scene_enter_exit_notify(data.filename, this, false); } } break; - case NOTIFICATION_PATH_CHANGED: { + case NOTIFICATION_PATH_RENAMED: { if (data.path_cache) { memdelete(data.path_cache); data.path_cache = nullptr; @@ -897,7 +897,7 @@ void Node::set_name(const String &p_name) { data.parent->_validate_child_name(this); } - propagate_notification(NOTIFICATION_PATH_CHANGED); + propagate_notification(NOTIFICATION_PATH_RENAMED); if (is_inside_tree()) { emit_signal(SNAME("renamed")); @@ -2785,7 +2785,7 @@ void Node::_bind_methods() { BIND_CONSTANT(NOTIFICATION_INSTANCED); BIND_CONSTANT(NOTIFICATION_DRAG_BEGIN); BIND_CONSTANT(NOTIFICATION_DRAG_END); - BIND_CONSTANT(NOTIFICATION_PATH_CHANGED); + BIND_CONSTANT(NOTIFICATION_PATH_RENAMED); BIND_CONSTANT(NOTIFICATION_INTERNAL_PROCESS); BIND_CONSTANT(NOTIFICATION_INTERNAL_PHYSICS_PROCESS); BIND_CONSTANT(NOTIFICATION_POST_ENTER_TREE); diff --git a/scene/main/node.h b/scene/main/node.h index d0246ebe840..48187818f98 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -256,7 +256,7 @@ public: NOTIFICATION_INSTANCED = 20, NOTIFICATION_DRAG_BEGIN = 21, NOTIFICATION_DRAG_END = 22, - NOTIFICATION_PATH_CHANGED = 23, + NOTIFICATION_PATH_RENAMED = 23, //NOTIFICATION_TRANSLATION_CHANGED = 24, moved below NOTIFICATION_INTERNAL_PROCESS = 25, NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26,