Merge pull request #113642 from KoBeWi/uno_reverse🔁

Use ObjectID in ProgressDialog Window list
This commit is contained in:
Thaddeus Crews
2026-01-06 09:56:54 -06:00
3 changed files with 23 additions and 14 deletions

View File

@@ -157,8 +157,11 @@ void ProgressDialog::_popup() {
// will discard every key input.
EditorNode::get_singleton()->set_process_input(true);
// Disable all other windows to prevent interaction with them.
for (Window *w : host_windows) {
w->set_process_mode(PROCESS_MODE_DISABLED);
for (ObjectID wid : host_windows) {
Window *w = ObjectDB::get_instance<Window>(wid);
if (w) {
w->set_process_mode(PROCESS_MODE_DISABLED);
}
}
Size2 ms = main->get_combined_minimum_size();
@@ -256,21 +259,22 @@ void ProgressDialog::end_task(const String &p_task) {
if (tasks.is_empty()) {
hide();
EditorNode::get_singleton()->set_process_input(false);
for (Window *w : host_windows) {
w->set_process_mode(PROCESS_MODE_INHERIT);
for (ObjectID wid : host_windows) {
Window *w = ObjectDB::get_instance<Window>(wid);
if (w) {
w->set_process_mode(PROCESS_MODE_INHERIT);
}
}
} else {
_popup();
}
}
void ProgressDialog::add_host_window(Window *p_window) {
ERR_FAIL_NULL(p_window);
void ProgressDialog::add_host_window(ObjectID p_window) {
host_windows.push_back(p_window);
}
void ProgressDialog::remove_host_window(Window *p_window) {
ERR_FAIL_NULL(p_window);
void ProgressDialog::remove_host_window(ObjectID p_window) {
host_windows.erase(p_window);
}
@@ -304,3 +308,7 @@ ProgressDialog::ProgressDialog() {
cancel_hb->add_spacer();
cancel->connect(SceneStringName(pressed), callable_mp(this, &ProgressDialog::_cancel_pressed));
}
ProgressDialog::~ProgressDialog() {
singleton = nullptr;
}

View File

@@ -79,7 +79,7 @@ class ProgressDialog : public CenterContainer {
PanelContainer *center_panel = nullptr;
VBoxContainer *main = nullptr;
LocalVector<Window *> host_windows;
LocalVector<ObjectID> host_windows;
Size2 main_border_size;
@@ -101,8 +101,9 @@ public:
bool task_step(const String &p_task, const String &p_state, int p_step = -1, bool p_force_redraw = true);
void end_task(const String &p_task);
void add_host_window(Window *p_window);
void remove_host_window(Window *p_window);
void add_host_window(ObjectID p_window);
void remove_host_window(ObjectID p_window);
ProgressDialog();
~ProgressDialog();
};

View File

@@ -383,12 +383,12 @@ WindowWrapper::WindowWrapper() {
window_background->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
window->add_child(window_background);
ProgressDialog::get_singleton()->add_host_window(window);
ProgressDialog::get_singleton()->add_host_window(window_id);
}
WindowWrapper::~WindowWrapper() {
if (ObjectDB::get_instance(window_id)) {
ProgressDialog::get_singleton()->remove_host_window(window);
if (ProgressDialog::get_singleton()) {
ProgressDialog::get_singleton()->remove_host_window(window_id);
}
}