瀏覽代碼

Fix checking the visibility condition of selected file in the Godot editor's dock.

S.V.I. Vilcrow 2 年之前
父節點
當前提交
1ec2272e0b
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      editor/filesystem_dock.cpp

+ 6 - 4
editor/filesystem_dock.cpp

@@ -733,7 +733,11 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
 	_update_tree(get_uncollapsed_paths(), false, p_select_in_favorites, true);
 	if (display_mode != DISPLAY_MODE_TREE_ONLY) {
 		_update_file_list(false);
-		files->get_v_scroll_bar()->set_value(0);
+
+		// Reset the scroll for a directory.
+		if (p_path.ends_with("/")) {
+			files->get_v_scroll_bar()->set_value(0);
+		}
 	}
 
 	String file_name = p_path.get_file();
@@ -1160,9 +1164,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
 void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorites) {
 	String fpath = p_path;
 	if (fpath.ends_with("/")) {
-		if (fpath != "res://") {
-			fpath = fpath.substr(0, fpath.length() - 1);
-		}
+		// Ignore a directory.
 	} else if (fpath != "Favorites") {
 		if (FileAccess::exists(fpath + ".import")) {
 			Ref<ConfigFile> config;