summaryrefslogtreecommitdiff
path: root/scene/2d/node_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/node_2d.cpp')
-rw-r--r--scene/2d/node_2d.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 2518069b78..84bfc48a43 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -30,6 +30,8 @@
#include "node_2d.h"
+#include "scene/main/viewport.h"
+
#ifdef TOOLS_ENABLED
Dictionary Node2D::_edit_get_state() const {
Dictionary state;
@@ -389,6 +391,16 @@ bool Node2D::is_y_sort_enabled() const {
return y_sort_enabled;
}
+void Node2D::_notification(int p_notification) {
+ switch (p_notification) {
+ case NOTIFICATION_MOVED_IN_PARENT: {
+ if (get_viewport()) {
+ get_viewport()->gui_set_root_order_dirty();
+ }
+ } break;
+ }
+}
+
void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_position", "position"), &Node2D::set_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Node2D::set_rotation);