summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/CanvasItem.xml7
-rw-r--r--doc/classes/Node.xml6
-rw-r--r--editor/editor_node.cpp8
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp2
-rw-r--r--editor/progress_dialog.cpp2
-rw-r--r--scene/gui/color_picker.cpp2
-rw-r--r--scene/gui/graph_edit.cpp2
-rw-r--r--scene/main/canvas_item.cpp8
-rw-r--r--scene/main/canvas_item.h1
-rw-r--r--scene/main/node.cpp16
-rw-r--r--scene/main/node.h1
-rw-r--r--scene/main/viewport.cpp2
12 files changed, 25 insertions, 32 deletions
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index d8c1af0b3c..70d825efac 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -500,6 +500,13 @@
Transformations issued by [param event]'s inputs are applied in local space instead of global space.
</description>
</method>
+ <method name="move_to_front">
+ <return type="void" />
+ <description>
+ Moves this node to display on top of its siblings. This has more use in [Control], as [Node2D] can be ordered with [member Node2D.z_index].
+ Internally, the node is moved to the bottom of parent's children list. The method has no effect on nodes without a parent.
+ </description>
+ </method>
<method name="queue_redraw">
<return type="void" />
<description>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 87edc7de0a..c18bf3d40f 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -577,12 +577,6 @@
Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to [method Object.free]. Use [method Object.is_queued_for_deletion] to check whether a node will be deleted at the end of the frame.
</description>
</method>
- <method name="raise">
- <return type="void" />
- <description>
- Moves this node to the bottom of parent node's children hierarchy. This is often useful in GUIs ([Control] nodes), because their order of drawing depends on their order in the tree. The top Node is drawn first, then any siblings below the top Node in the hierarchy are successively drawn on top of it. After using [code]raise[/code], a Control will be drawn on top of its siblings.
- </description>
- </method>
<method name="remove_and_skip">
<return type="void" />
<description>
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 7a7576b241..d0e0adf04b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3375,7 +3375,7 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
singleton->main_editor_button_vb->add_child(tb);
singleton->editor_table.push_back(p_editor);
- singleton->distraction_free->raise();
+ singleton->distraction_free->move_to_front();
}
singleton->editor_data.add_editor_plugin(p_editor);
singleton->add_child(p_editor);
@@ -4965,7 +4965,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
}
if (atidx == i) {
- node->raise();
+ node->move_to_front();
continue;
}
@@ -5390,7 +5390,7 @@ Button *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) {
tb->set_toggle_mode(true);
tb->set_focus_mode(Control::FOCUS_NONE);
bottom_panel_vb->add_child(p_item);
- bottom_panel_hb->raise();
+ bottom_panel_hb->move_to_front();
bottom_panel_hb_editors->add_child(tb);
p_item->set_v_size_flags(Control::SIZE_EXPAND_FILL);
p_item->hide();
@@ -5424,7 +5424,7 @@ void EditorNode::make_bottom_panel_item_visible(Control *p_item) {
void EditorNode::raise_bottom_panel_item(Control *p_item) {
for (int i = 0; i < bottom_panel_items.size(); i++) {
if (bottom_panel_items[i].control == p_item) {
- bottom_panel_items[i].button->raise();
+ bottom_panel_items[i].button->move_to_front();
SWAP(bottom_panel_items.write[i], bottom_panel_items.write[bottom_panel_items.size() - 1]);
break;
}
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 6bc443039f..4434bcd765 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -577,7 +577,7 @@ void EditorAssetLibrary::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("AssetLib")));
- error_label->raise();
+ error_label->move_to_front();
} break;
case NOTIFICATION_ENTER_TREE:
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 1c9afa8be8..e90b063349 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -176,7 +176,7 @@ void ProgressDialog::add_task(const String &p_task, const String &p_label, int p
} else {
cancel_hb->hide();
}
- cancel_hb->raise();
+ cancel_hb->move_to_front();
cancelled = false;
_popup();
if (p_can_cancel) {
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 41ed1d16c4..4a1f2ab7c6 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -1086,7 +1086,7 @@ void ColorPicker::_screen_pick_pressed() {
} else {
screen->show();
}
- screen->raise();
+ screen->move_to_front();
#ifndef _MSC_VER
#warning show modal no longer works, needs to be converted to a popup
#endif
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 3efd465939..c8de8789fe 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -351,7 +351,7 @@ void GraphEdit::_graph_node_raised(Node *p_gn) {
if (gn->is_comment()) {
move_child(gn, 0);
} else {
- gn->raise();
+ gn->move_to_front();
}
}
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 65e7ba3e67..093e4a8cd3 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -369,6 +369,13 @@ void CanvasItem::queue_redraw() {
MessageQueue::get_singleton()->push_callable(callable_mp(this, &CanvasItem::_redraw_callback));
}
+void CanvasItem::move_to_front() {
+ if (!get_parent()) {
+ return;
+ }
+ get_parent()->move_child(this, get_parent()->get_child_count() - 1);
+}
+
void CanvasItem::set_modulate(const Color &p_modulate) {
if (modulate == p_modulate) {
return;
@@ -897,6 +904,7 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("hide"), &CanvasItem::hide);
ClassDB::bind_method(D_METHOD("queue_redraw"), &CanvasItem::queue_redraw);
+ ClassDB::bind_method(D_METHOD("move_to_front"), &CanvasItem::move_to_front);
ClassDB::bind_method(D_METHOD("set_as_top_level", "enable"), &CanvasItem::set_as_top_level);
ClassDB::bind_method(D_METHOD("is_set_as_top_level"), &CanvasItem::is_set_as_top_level);
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index 1abb4edec9..b80289fdb4 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -198,6 +198,7 @@ public:
void hide();
void queue_redraw();
+ void move_to_front();
void set_clip_children(bool p_enabled);
bool is_clipping_children() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 289e963077..273507a9fa 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -389,21 +389,6 @@ void Node::_move_child(Node *p_child, int p_pos, bool p_ignore_end) {
data.blocked--;
}
-void Node::raise() {
- if (!data.parent) {
- return;
- }
-
- // Internal children move within a different index range.
- if (_is_internal_front()) {
- data.parent->move_child(this, data.parent->data.internal_children_front - 1);
- } else if (_is_internal_back()) {
- data.parent->move_child(this, data.parent->data.internal_children_back - 1);
- } else {
- data.parent->move_child(this, data.parent->get_child_count(false) - 1);
- }
-}
-
void Node::_propagate_groups_dirty() {
for (const KeyValue<StringName, GroupData> &E : data.grouped) {
if (E.value.group) {
@@ -2816,7 +2801,6 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group);
ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_position"), &Node::move_child);
ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups);
- ClassDB::bind_method(D_METHOD("raise"), &Node::raise);
ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner);
ClassDB::bind_method(D_METHOD("get_owner"), &Node::get_owner);
ClassDB::bind_method(D_METHOD("remove_and_skip"), &Node::remove_and_skip);
diff --git a/scene/main/node.h b/scene/main/node.h
index ae6a997579..29f5410478 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -348,7 +348,6 @@ public:
void move_child(Node *p_child, int p_pos);
void _move_child(Node *p_child, int p_pos, bool p_ignore_end = false);
- void raise();
void set_owner(Node *p_owner);
Node *get_owner() const;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e901f76c0a..5295de5c09 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2103,7 +2103,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {
p_control->set_as_top_level(true);
p_control->set_position(gui.last_mouse_pos);
p_base->get_root_parent_control()->add_child(p_control); // Add as child of viewport.
- p_control->raise();
+ p_control->move_to_front();
gui.drag_preview_id = p_control->get_instance_id();
}