Fix Viewport root order after Node2D raise

This commit is contained in:
Markus Sauermann
2022-11-02 21:45:00 +01:00
parent 754552b34d
commit 022d24a9ae
6 changed files with 18 additions and 5 deletions
+12
View File
@@ -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);