Skip to content

Commit

Permalink
Now EditorFilesystemDock will apply the split_mode setting immediatel…
Browse files Browse the repository at this point in the history
…y. Also smaller fixes.
  • Loading branch information
Relintai committed Oct 20, 2023
1 parent 4628e53 commit 4b29c01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["docks/filesystem/dock_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/dock_mode", PROPERTY_HINT_ENUM, "Dock,Bottom Bar", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);

_initial_set("docks/filesystem/split_mode", 0);
hints["docks/filesystem/split_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/split_mode", PROPERTY_HINT_ENUM, "Vertical,Horizontal", PROPERTY_USAGE_DEFAULT);
hints["docks/filesystem/split_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/split_mode", PROPERTY_HINT_ENUM, "Horizontal,Vertical", PROPERTY_USAGE_DEFAULT);

// Property editor
_initial_set("docks/property_editor/auto_refresh_interval", 0.3);
Expand Down
9 changes: 7 additions & 2 deletions editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,11 @@ void FileSystemDock::_notification(int p_what) {
_update_file_list(true);
}

SplitMode new_split_mode = SplitMode(int(EditorSettings::get_singleton()->get("docks/filesystem/split_mode")));
if (new_split_mode != split_mode) {
set_split_mode(new_split_mode);
}

// Change full tree mode.
_update_display_mode();
} break;
Expand Down Expand Up @@ -2034,9 +2039,9 @@ void FileSystemDock::set_split_mode(SplitMode p_split_mode) {
split_mode = p_split_mode;

if (split_mode == SPLIT_MODE_HORIZONTAL) {
split_box->set_mode(CSplitContainer::CONTAINER_MODE_HORIZONTAL);
} else {
split_box->set_mode(CSplitContainer::CONTAINER_MODE_VERTICAL);
} else {
split_box->set_mode(CSplitContainer::CONTAINER_MODE_HORIZONTAL);
}
}
FileSystemDock::SplitMode FileSystemDock::get_split_mode() {
Expand Down
2 changes: 1 addition & 1 deletion editor/filesystem_dock.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class FileSystemDock : public VBoxContainer {
};

enum SplitMode {
SPLIT_MODE_HORIZONTAL = 0,
SPLIT_MODE_VERTICAL,
SPLIT_MODE_HORIZONTAL,
};

enum DockMode {
Expand Down

0 comments on commit 4b29c01

Please sign in to comment.