From 1eb1837d0cf95c2c12d8ec51127e222f6f4888c5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 19 Dec 2017 09:55:01 -0300 Subject: [PATCH] Should no longer crash after rebaking, may be a solution to #14795 Not sure if this is the same problem, as reported, please test. --- editor/progress_dialog.cpp | 3 +++ modules/gridmap/grid_map.cpp | 17 +++++++++-------- scene/main/viewport.cpp | 7 ++++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index 2c2e5a7c9b29..e02925e377de 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -188,6 +188,9 @@ void ProgressDialog::add_task(const String &p_task, const String &p_label, int p cancel_hb->raise(); cancelled = false; _popup(); + if (p_can_cancel) { + cancel->grab_focus(); + } } bool ProgressDialog::task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) { diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 1860176f0c98..060d9848ba66 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -475,16 +475,17 @@ bool GridMap::_octant_update(const OctantKey &p_key) { xform.basis.set_orthogonal_index(c.rot); xform.set_origin(cellpos * cell_size + ofs); xform.basis.scale(Vector3(cell_scale, cell_scale, cell_scale)); + if (baked_meshes.size()) { + if (theme->get_item_mesh(c.item).is_valid()) { + if (!multimesh_items.has(c.item)) { + multimesh_items[c.item] = List >(); + } - if (theme->get_item_mesh(c.item).is_valid()) { - if (!multimesh_items.has(c.item)) { - multimesh_items[c.item] = List >(); + Pair p; + p.first = xform; + p.second = E->get(); + multimesh_items[c.item].push_back(p); } - - Pair p; - p.first = xform; - p.second = E->get(); - multimesh_items[c.item].push_back(p); } Vector shapes = theme->get_item_shapes(c.item); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f5d7043a4033..ae855e803cc5 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1659,6 +1659,7 @@ void Viewport::_gui_input_event(Ref p_event) { //cancel event, sorry, modal exclusive EATS UP ALL //alternative, you can't pop out a window the same frame it was made modal (fixes many issues) get_tree()->set_input_as_handled(); + return; // no one gets the event if exclusive NO ONE } @@ -2348,7 +2349,6 @@ void Viewport::_gui_control_grab_focus(Control *p_control) { //no need for change if (gui.key_focus && gui.key_focus == p_control) return; - get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, "_viewports", "_gui_remove_focus"); gui.key_focus = p_control; p_control->notification(Control::NOTIFICATION_FOCUS_ENTER); @@ -2370,6 +2370,11 @@ List::Element *Viewport::_gui_show_modal(Control *p_control) { else p_control->_modal_set_prev_focus_owner(0); + if (gui.mouse_focus && !p_control->is_a_parent_of(gui.mouse_focus)) { + gui.mouse_focus->notification(Control::NOTIFICATION_MOUSE_EXIT); + gui.mouse_focus = NULL; + } + return gui.modal_stack.back(); }