|
@@ -1103,38 +1103,11 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) {
|
|
|
hints[p_hint.name] = p_hint;
|
|
|
}
|
|
|
|
|
|
-// Editor data and config directories
|
|
|
-// EditorPaths::create() is responsible for the creation of these directories.
|
|
|
-
|
|
|
-String EditorSettings::get_export_templates_dir() const {
|
|
|
- return EditorPaths::get_singleton()->get_data_dir().plus_file("export_templates");
|
|
|
-}
|
|
|
-
|
|
|
-String EditorSettings::get_project_settings_dir() const {
|
|
|
- return EditorPaths::get_singleton()->get_project_data_dir().plus_file("editor");
|
|
|
-}
|
|
|
-
|
|
|
-String EditorSettings::get_text_editor_themes_dir() const {
|
|
|
- return EditorPaths::get_singleton()->get_config_dir().plus_file("text_editor_themes");
|
|
|
-}
|
|
|
-
|
|
|
-String EditorSettings::get_script_templates_dir() const {
|
|
|
- return EditorPaths::get_singleton()->get_config_dir().plus_file("script_templates");
|
|
|
-}
|
|
|
-
|
|
|
-String EditorSettings::get_project_script_templates_dir() const {
|
|
|
- return ProjectSettings::get_singleton()->get("editor/script/templates_search_path");
|
|
|
-}
|
|
|
-
|
|
|
-String EditorSettings::get_feature_profiles_dir() const {
|
|
|
- return EditorPaths::get_singleton()->get_config_dir().plus_file("feature_profiles");
|
|
|
-}
|
|
|
-
|
|
|
// Metadata
|
|
|
|
|
|
void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, Variant p_data) {
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
|
|
- String path = get_project_settings_dir().plus_file("project_metadata.cfg");
|
|
|
+ String path = EditorPaths::get_singleton()->get_project_settings_dir().plus_file("project_metadata.cfg");
|
|
|
Error err;
|
|
|
err = cf->load(path);
|
|
|
ERR_FAIL_COND_MSG(err != OK && err != ERR_FILE_NOT_FOUND, "Cannot load editor settings from file '" + path + "'.");
|
|
@@ -1145,7 +1118,7 @@ void EditorSettings::set_project_metadata(const String &p_section, const String
|
|
|
|
|
|
Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const {
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
|
|
- String path = get_project_settings_dir().plus_file("project_metadata.cfg");
|
|
|
+ String path = EditorPaths::get_singleton()->get_project_settings_dir().plus_file("project_metadata.cfg");
|
|
|
Error err = cf->load(path);
|
|
|
if (err != OK) {
|
|
|
return p_default;
|
|
@@ -1159,7 +1132,7 @@ void EditorSettings::set_favorites(const Vector<String> &p_favorites) {
|
|
|
if (Engine::get_singleton()->is_project_manager_hint()) {
|
|
|
favorites_file = EditorPaths::get_singleton()->get_config_dir().plus_file("favorite_dirs");
|
|
|
} else {
|
|
|
- favorites_file = get_project_settings_dir().plus_file("favorites");
|
|
|
+ favorites_file = EditorPaths::get_singleton()->get_project_settings_dir().plus_file("favorites");
|
|
|
}
|
|
|
Ref<FileAccess> f = FileAccess::open(favorites_file, FileAccess::WRITE);
|
|
|
if (f.is_valid()) {
|
|
@@ -1179,7 +1152,7 @@ void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) {
|
|
|
if (Engine::get_singleton()->is_project_manager_hint()) {
|
|
|
recent_dirs_file = EditorPaths::get_singleton()->get_config_dir().plus_file("recent_dirs");
|
|
|
} else {
|
|
|
- recent_dirs_file = get_project_settings_dir().plus_file("recent_dirs");
|
|
|
+ recent_dirs_file = EditorPaths::get_singleton()->get_project_settings_dir().plus_file("recent_dirs");
|
|
|
}
|
|
|
Ref<FileAccess> f = FileAccess::open(recent_dirs_file, FileAccess::WRITE);
|
|
|
if (f.is_valid()) {
|
|
@@ -1200,8 +1173,8 @@ void EditorSettings::load_favorites_and_recent_dirs() {
|
|
|
favorites_file = EditorPaths::get_singleton()->get_config_dir().plus_file("favorite_dirs");
|
|
|
recent_dirs_file = EditorPaths::get_singleton()->get_config_dir().plus_file("recent_dirs");
|
|
|
} else {
|
|
|
- favorites_file = get_project_settings_dir().plus_file("favorites");
|
|
|
- recent_dirs_file = get_project_settings_dir().plus_file("recent_dirs");
|
|
|
+ favorites_file = EditorPaths::get_singleton()->get_project_settings_dir().plus_file("favorites");
|
|
|
+ recent_dirs_file = EditorPaths::get_singleton()->get_project_settings_dir().plus_file("recent_dirs");
|
|
|
}
|
|
|
Ref<FileAccess> f = FileAccess::open(favorites_file, FileAccess::READ);
|
|
|
if (f.is_valid()) {
|
|
@@ -1233,7 +1206,7 @@ bool EditorSettings::is_dark_theme() {
|
|
|
void EditorSettings::list_text_editor_themes() {
|
|
|
String themes = "Default,Godot 2,Custom";
|
|
|
|
|
|
- Ref<DirAccess> d = DirAccess::open(get_text_editor_themes_dir());
|
|
|
+ Ref<DirAccess> d = DirAccess::open(EditorPaths::get_singleton()->get_text_editor_themes_dir());
|
|
|
if (d.is_valid()) {
|
|
|
List<String> custom_themes;
|
|
|
d->list_dir_begin();
|
|
@@ -1264,7 +1237,7 @@ void EditorSettings::load_text_editor_theme() {
|
|
|
return; // sorry for "Settings changed" console spam
|
|
|
}
|
|
|
|
|
|
- String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet");
|
|
|
+ String theme_path = EditorPaths::get_singleton()->get_text_editor_themes_dir().plus_file(p_file + ".tet");
|
|
|
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
|
|
Error err = cf->load(theme_path);
|
|
@@ -1299,9 +1272,9 @@ bool EditorSettings::import_text_editor_theme(String p_file) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- Ref<DirAccess> d = DirAccess::open(get_text_editor_themes_dir());
|
|
|
+ Ref<DirAccess> d = DirAccess::open(EditorPaths::get_singleton()->get_text_editor_themes_dir());
|
|
|
if (d.is_valid()) {
|
|
|
- d->copy(p_file, get_text_editor_themes_dir().plus_file(p_file.get_file()));
|
|
|
+ d->copy(p_file, EditorPaths::get_singleton()->get_text_editor_themes_dir().plus_file(p_file.get_file()));
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -1314,7 +1287,7 @@ bool EditorSettings::save_text_editor_theme() {
|
|
|
if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
|
|
|
return false;
|
|
|
}
|
|
|
- String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet");
|
|
|
+ String theme_path = EditorPaths::get_singleton()->get_text_editor_themes_dir().plus_file(p_file + ".tet");
|
|
|
return _save_text_editor_theme(theme_path);
|
|
|
}
|
|
|
|
|
@@ -1331,7 +1304,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
|
|
|
list_text_editor_themes();
|
|
|
String theme_name = p_file.substr(0, p_file.length() - 4).get_file();
|
|
|
|
|
|
- if (p_file.get_base_dir() == get_text_editor_themes_dir()) {
|
|
|
+ if (p_file.get_base_dir() == EditorPaths::get_singleton()->get_text_editor_themes_dir()) {
|
|
|
_initial_set("text_editor/theme/color_theme", theme_name);
|
|
|
load_text_editor_theme();
|
|
|
}
|
|
@@ -1347,7 +1320,7 @@ bool EditorSettings::is_default_text_editor_theme() {
|
|
|
|
|
|
Vector<String> EditorSettings::get_script_templates(const String &p_extension, const String &p_custom_path) {
|
|
|
Vector<String> templates;
|
|
|
- String template_dir = get_script_templates_dir();
|
|
|
+ String template_dir = EditorPaths::get_singleton()->get_script_templates_dir();
|
|
|
if (!p_custom_path.is_empty()) {
|
|
|
template_dir = p_custom_path;
|
|
|
}
|
|
@@ -1654,8 +1627,6 @@ void EditorSettings::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &EditorSettings::property_get_revert);
|
|
|
ClassDB::bind_method(D_METHOD("add_property_info", "info"), &EditorSettings::_add_property_info_bind);
|
|
|
|
|
|
- ClassDB::bind_method(D_METHOD("get_project_settings_dir"), &EditorSettings::get_project_settings_dir);
|
|
|
-
|
|
|
ClassDB::bind_method(D_METHOD("set_project_metadata", "section", "key", "data"), &EditorSettings::set_project_metadata);
|
|
|
ClassDB::bind_method(D_METHOD("get_project_metadata", "section", "key", "default"), &EditorSettings::get_project_metadata, DEFVAL(Variant()));
|
|
|
|