Fix Viewport root order after Node2D raise
This commit is contained in:
parent
754552b34d
commit
022d24a9ae
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "node_2d.h"
|
#include "node_2d.h"
|
||||||
|
|
||||||
|
#include "scene/main/viewport.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
Dictionary Node2D::_edit_get_state() const {
|
Dictionary Node2D::_edit_get_state() const {
|
||||||
Dictionary state;
|
Dictionary state;
|
||||||
@ -389,6 +391,16 @@ bool Node2D::is_y_sort_enabled() const {
|
|||||||
return y_sort_enabled;
|
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() {
|
void Node2D::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_position", "position"), &Node2D::set_position);
|
ClassDB::bind_method(D_METHOD("set_position", "position"), &Node2D::set_position);
|
||||||
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Node2D::set_rotation);
|
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Node2D::set_rotation);
|
||||||
|
@ -53,6 +53,7 @@ class Node2D : public CanvasItem {
|
|||||||
void _update_xform_values();
|
void _update_xform_values();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void _notification(int p_notification);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -2921,7 +2921,7 @@ void Control::_notification(int p_notification) {
|
|||||||
queue_redraw();
|
queue_redraw();
|
||||||
|
|
||||||
if (data.RI) {
|
if (data.RI) {
|
||||||
get_viewport()->_gui_set_root_order_dirty();
|
get_viewport()->gui_set_root_order_dirty();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void CanvasLayer::set_layer(int p_xform) {
|
|||||||
layer = p_xform;
|
layer = p_xform;
|
||||||
if (viewport.is_valid()) {
|
if (viewport.is_valid()) {
|
||||||
RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
|
RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
|
||||||
vp->_gui_set_root_order_dirty();
|
vp->gui_set_root_order_dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2094,7 +2094,7 @@ List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) {
|
|||||||
return gui.roots.push_back(p_control);
|
return gui.roots.push_back(p_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewport::_gui_set_root_order_dirty() {
|
void Viewport::gui_set_root_order_dirty() {
|
||||||
gui.roots_order_dirty = true;
|
gui.roots_order_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,8 +455,6 @@ private:
|
|||||||
|
|
||||||
void _update_canvas_items(Node *p_node);
|
void _update_canvas_items(Node *p_node);
|
||||||
|
|
||||||
void _gui_set_root_order_dirty();
|
|
||||||
|
|
||||||
friend class Window;
|
friend class Window;
|
||||||
|
|
||||||
void _sub_window_update_order();
|
void _sub_window_update_order();
|
||||||
@ -513,6 +511,8 @@ public:
|
|||||||
|
|
||||||
Transform2D get_final_transform() const;
|
Transform2D get_final_transform() const;
|
||||||
|
|
||||||
|
void gui_set_root_order_dirty();
|
||||||
|
|
||||||
void set_transparent_background(bool p_enable);
|
void set_transparent_background(bool p_enable);
|
||||||
bool has_transparent_background() const;
|
bool has_transparent_background() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user