1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Expose dialog parent-and-popup logic to the API

This commit is contained in:
Yuri Sizov
2023-04-20 15:13:21 +02:00
parent 5c653c27cd
commit 17f492fb82
12 changed files with 242 additions and 82 deletions

View File

@@ -32,6 +32,7 @@
#include "core/object/message_queue.h"
#include "core/os/os.h"
#include "editor/editor_interface.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "main/main.h"
@@ -155,17 +156,7 @@ void ProgressDialog::_popup() {
main->set_offset(SIDE_TOP, style->get_margin(SIDE_TOP));
main->set_offset(SIDE_BOTTOM, -style->get_margin(SIDE_BOTTOM));
EditorNode *ed = EditorNode::get_singleton();
if (ed && !is_inside_tree()) {
Window *w = ed->get_window();
while (w && w->get_exclusive_child()) {
w = w->get_exclusive_child();
}
if (w && w != this) {
w->add_child(this);
popup_centered(ms);
}
}
EditorInterface::get_singleton()->popup_dialog_centered(this, ms);
}
void ProgressDialog::add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {