Expand project root directory on editor start

close #16232
Option for expanding all directories on start up is a bit tricky and buggy.

(cherry picked from commit 127d1241bd)
This commit is contained in:
volzhs 2018-02-01 10:53:31 +09:00 committed by Hein-Pieter van Braam
parent 4a3a597377
commit 62dc7ba82f
2 changed files with 7 additions and 3 deletions

View File

@ -77,7 +77,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
return true;
}
void FileSystemDock::_update_tree(bool keep_collapse_state) {
void FileSystemDock::_update_tree(bool keep_collapse_state, bool p_uncollapse_root) {
Vector<String> uncollapsed_paths;
if (keep_collapse_state) {
@ -129,6 +129,10 @@ void FileSystemDock::_update_tree(bool keep_collapse_state) {
ti->set_metadata(0, fave);
}
if (p_uncollapse_root) {
uncollapsed_paths.push_back("res://");
}
_create_tree(root, EditorFileSystem::get_singleton()->get_filesystem(), uncollapsed_paths);
tree->ensure_cursor_is_visible();
updating_tree = false;
@ -204,7 +208,7 @@ void FileSystemDock::_notification(int p_what) {
if (EditorFileSystem::get_singleton()->is_scanning()) {
_set_scanning_mode();
} else {
_update_tree(false);
_update_tree(false, true);
}
} break;

View File

@ -157,7 +157,7 @@ private:
bool import_dock_needs_update;
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths);
void _update_tree(bool keep_collapse_state);
void _update_tree(bool keep_collapse_state, bool p_uncollapse_root = false);
void _update_files(bool p_keep_selection);
void _update_file_display_toggle_button();