Browse Source

Should no longer crash after rebaking, may be a solution to #14795
Not sure if this is the same problem, as reported, please test.

Juan Linietsky 7 years ago
parent
commit
1eb1837d0c
3 changed files with 18 additions and 9 deletions
  1. 3 0
      editor/progress_dialog.cpp
  2. 9 8
      modules/gridmap/grid_map.cpp
  3. 6 1
      scene/main/viewport.cpp

+ 3 - 0
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();
 	cancel_hb->raise();
 	cancelled = false;
 	cancelled = false;
 	_popup();
 	_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) {
 bool ProgressDialog::task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) {

+ 9 - 8
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.basis.set_orthogonal_index(c.rot);
 		xform.set_origin(cellpos * cell_size + ofs);
 		xform.set_origin(cellpos * cell_size + ofs);
 		xform.basis.scale(Vector3(cell_scale, cell_scale, cell_scale));
 		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<Pair<Transform, IndexKey> >();
+				}
 
 
-		if (theme->get_item_mesh(c.item).is_valid()) {
-			if (!multimesh_items.has(c.item)) {
-				multimesh_items[c.item] = List<Pair<Transform, IndexKey> >();
+				Pair<Transform, IndexKey> p;
+				p.first = xform;
+				p.second = E->get();
+				multimesh_items[c.item].push_back(p);
 			}
 			}
-
-			Pair<Transform, IndexKey> p;
-			p.first = xform;
-			p.second = E->get();
-			multimesh_items[c.item].push_back(p);
 		}
 		}
 
 
 		Vector<MeshLibrary::ShapeData> shapes = theme->get_item_shapes(c.item);
 		Vector<MeshLibrary::ShapeData> shapes = theme->get_item_shapes(c.item);

+ 6 - 1
scene/main/viewport.cpp

@@ -1659,6 +1659,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
 							//cancel event, sorry, modal exclusive EATS UP ALL
 							//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)
 							//alternative, you can't pop out a window the same frame it was made modal (fixes many issues)
 							get_tree()->set_input_as_handled();
 							get_tree()->set_input_as_handled();
+
 							return; // no one gets the event if exclusive NO ONE
 							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
 	//no need for change
 	if (gui.key_focus && gui.key_focus == p_control)
 	if (gui.key_focus && gui.key_focus == p_control)
 		return;
 		return;
-
 	get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, "_viewports", "_gui_remove_focus");
 	get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, "_viewports", "_gui_remove_focus");
 	gui.key_focus = p_control;
 	gui.key_focus = p_control;
 	p_control->notification(Control::NOTIFICATION_FOCUS_ENTER);
 	p_control->notification(Control::NOTIFICATION_FOCUS_ENTER);
@@ -2370,6 +2370,11 @@ List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
 	else
 	else
 		p_control->_modal_set_prev_focus_owner(0);
 		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();
 	return gui.modal_stack.back();
 }
 }