Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,9 @@
Path to the SSH executable (used for remote deploy to desktop platforms). If left empty, the editor will attempt to run [code]ssh[/code] from [code]PATH[/code].
</member>
<member name="filesystem/directories/autoscan_project_path" type="String" setter="" getter="">
The folder where projects should be scanned for (recursively), in a way similar to the project manager's [b]Scan[/b] button. This can be set to the same value as [member filesystem/directories/default_project_path] for convenience.
The folder where projects should be scanned for (recursively), in a way similar to the project manager's [b]Scan[/b] button.
[b]Note:[/b] Setting this path to a folder with very large amounts of files/folders can slow down the project manager startup significantly. To keep the project manager quick to start up, it is recommended to set this value to a folder as "specific" as possible.
</member>
<member name="filesystem/directories/default_project_path" type="String" setter="" getter="">
The folder where new projects should be created by default when clicking the project manager's [b]New Project[/b] button. This can be set to the same value as [member filesystem/directories/autoscan_project_path] for convenience.
</member>
<member name="filesystem/external_programs/3d_model_editor" type="String" setter="" getter="">
The program that opens 3D model scene files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
</member>
Expand Down
23 changes: 20 additions & 3 deletions editor/project_manager/project_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ void ProjectDialog::_set_target_path(const String &p_text) {
}
}

String ProjectDialog::_get_default_project_path() const {
const String path = EDITOR_GET("_default_project_path");
if (path.is_empty()) {
return OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS);
}
return path;
}

void ProjectDialog::_update_target_auto_dir() {
String new_auto_dir;
if (mode == MODE_NEW || mode == MODE_INSTALL || mode == MODE_DUPLICATE) {
Expand Down Expand Up @@ -402,7 +410,7 @@ void ProjectDialog::_install_path_changed() {
void ProjectDialog::_browse_project_path() {
String path = project_path->get_text();
if (path.is_relative_path()) {
path = EDITOR_GET("filesystem/directories/default_project_path");
path = _get_default_project_path();
}
if (mode == MODE_IMPORT && install_path->is_visible_in_tree()) {
// Select last ZIP file.
Expand Down Expand Up @@ -433,7 +441,7 @@ void ProjectDialog::_browse_install_path() {

String path = install_path->get_text();
if (path.is_relative_path() || !DirAccess::dir_exists_absolute(path)) {
path = EDITOR_GET("filesystem/directories/default_project_path");
path = _get_default_project_path();
}
if (create_dir->is_pressed()) {
// Select parent directory of install path.
Expand Down Expand Up @@ -553,6 +561,9 @@ void ProjectDialog::ok_pressed() {
}

String path = project_path->get_text();
if (set_as_default_dir->is_pressed()) {
EditorSettings::get_singleton()->set("_default_project_path", path.get_base_dir());
}

if (mode == MODE_NEW) {
if (create_dir->is_pressed()) {
Expand Down Expand Up @@ -883,7 +894,7 @@ void ProjectDialog::show_dialog(bool p_reset_name, bool p_is_confirmed) {
install_path->set_text(original_dir);
fdialog_project->set_current_dir(original_dir);
} else {
String fav_dir = EDITOR_GET("filesystem/directories/default_project_path");
String fav_dir = _get_default_project_path();
fav_dir = fav_dir.simplify_path();
if (!fav_dir.is_empty()) {
project_path->set_text(fav_dir);
Expand Down Expand Up @@ -1040,6 +1051,12 @@ ProjectDialog::ProjectDialog() {
l->set_h_size_flags(Control::SIZE_EXPAND_FILL);
pphb_label->add_child(l);

set_as_default_dir = memnew(CheckBox);
set_as_default_dir->set_text(TTRC("Set As Default"));
set_as_default_dir->set_tooltip_text(TTRC("If enabled, the base folder will be used as default folder for future projects."));
set_as_default_dir->set_pressed(EDITOR_DEF("_default_project_path", "").operator String().is_empty());
pphb_label->add_child(set_as_default_dir);

create_dir = memnew(CheckButton);
create_dir->set_text(TTRC("Create Folder"));
create_dir->set_pressed(true);
Expand Down
2 changes: 2 additions & 0 deletions editor/project_manager/project_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class ProjectDialog : public ConfirmationDialog {
bool is_folder_empty = true;
ConfirmationDialog *nonempty_confirmation = nullptr;

CheckBox *set_as_default_dir = nullptr;
CheckButton *create_dir = nullptr;
Button *project_browse = nullptr;
Button *install_browse = nullptr;
Expand Down Expand Up @@ -120,6 +121,7 @@ class ProjectDialog : public ConfirmationDialog {
// Install path is only visible when importing a ZIP.
String _get_target_path();
void _set_target_path(const String &p_text);
String _get_default_project_path() const;

// Calculated from project name / ZIP name.
String auto_dir;
Expand Down
4 changes: 2 additions & 2 deletions editor/project_manager/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ ProjectManager::ProjectManager() {
scan_dir->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
scan_dir->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);
scan_dir->set_title(TTRC("Select a Folder to Scan")); // Must be after mode or it's overridden.
scan_dir->set_current_dir(EDITOR_GET("filesystem/directories/default_project_path"));
scan_dir->set_current_dir(EDITOR_GET("_default_project_path"));
add_child(scan_dir);
scan_dir->connect("dir_selected", callable_mp(project_list, &ProjectList::find_projects));

Expand Down Expand Up @@ -1934,7 +1934,7 @@ ProjectManager::ProjectManager() {

Ref<DirAccess> dir_access = DirAccess::create(DirAccess::AccessType::ACCESS_FILESYSTEM);

String default_project_path = EDITOR_GET("filesystem/directories/default_project_path");
String default_project_path = EDITOR_GET("_default_project_path");
if (!default_project_path.is_empty() && !dir_access->dir_exists(default_project_path)) {
Error error = dir_access->make_dir_recursive(default_project_path);
if (error != OK) {
Expand Down
2 changes: 0 additions & 2 deletions editor/settings/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {

// Directories
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/directories/autoscan_project_path", "", "")
const String fs_dir_default_project_path = OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS);
EDITOR_SETTING_BASIC(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/directories/default_project_path", fs_dir_default_project_path, "")

// On save
_initial_set("filesystem/on_save/compress_binary_resources", true);
Expand Down