Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncollapse res:// by default #77509

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4842,8 +4842,13 @@ void EditorNode::_load_editor_layout() {
Ref<ConfigFile> config;
config.instantiate();
Error err = config->load(EditorPaths::get_singleton()->get_project_settings_dir().path_join("editor_layout.cfg"));
if (err != OK) {
// No config.
if (err != OK) { // No config.
// If config is not found, expand the res:// folder by default.
TreeItem *root = FileSystemDock::get_singleton()->get_tree_control()->get_item_with_metadata("res://", 0);
if (root) {
root->set_collapsed(false);
}

if (overridden_default_layout >= 0) {
_layout_menu_option(overridden_default_layout);
}
Expand Down Expand Up @@ -5110,8 +5115,14 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
}

// Restore collapsed state of FileSystemDock.
PackedStringArray uncollapsed_tis;
if (p_layout->has_section_key(p_section, "dock_filesystem_uncollapsed_paths")) {
PackedStringArray uncollapsed_tis = p_layout->get_value(p_section, "dock_filesystem_uncollapsed_paths");
uncollapsed_tis = p_layout->get_value(p_section, "dock_filesystem_uncollapsed_paths");
} else {
uncollapsed_tis = { "res://" };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really necessary, but it provides compatibility with pre-4.1 layout files.

}

if (!uncollapsed_tis.is_empty()) {
for (int i = 0; i < uncollapsed_tis.size(); i++) {
TreeItem *uncollapsed_ti = FileSystemDock::get_singleton()->get_tree_control()->get_item_with_metadata(uncollapsed_tis[i], 0);
if (uncollapsed_ti) {
Expand Down