فهرست منبع

Merge pull request #97136 from chocola-mint/fix-#97021

Stop EditorNode from refreshing the current scene tab when not needed
Rémi Verschelde 8 ماه پیش
والد
کامیت
9890cc9d59
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      editor/editor_node.cpp

+ 10 - 1
editor/editor_node.cpp

@@ -1113,7 +1113,14 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
 		ap->stop(true);
 		ap->stop(true);
 	}
 	}
 
 
+	// Only refresh the current scene tab if it's been reimported.
+	// Otherwise the scene tab will try to grab focus unnecessarily.
+	bool should_refresh_current_scene_tab = false;
+	const String current_scene_tab = editor_data.get_scene_path(current_tab);
 	for (const String &E : scenes_reimported) {
 	for (const String &E : scenes_reimported) {
+		if (!should_refresh_current_scene_tab && E == current_scene_tab) {
+			should_refresh_current_scene_tab = true;
+		}
 		reload_scene(E);
 		reload_scene(E);
 	}
 	}
 
 
@@ -1123,7 +1130,9 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
 	scenes_reimported.clear();
 	scenes_reimported.clear();
 	resources_reimported.clear();
 	resources_reimported.clear();
 
 
-	_set_current_scene_nocheck(current_tab);
+	if (should_refresh_current_scene_tab) {
+		_set_current_scene_nocheck(current_tab);
+	}
 }
 }
 
 
 void EditorNode::_sources_changed(bool p_exist) {
 void EditorNode::_sources_changed(bool p_exist) {