summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-25 11:21:24 +0100
committerGitHub <noreply@github.com>2021-11-25 11:21:24 +0100
commit4261fb324424765c8aab3885c58511cdc130240a (patch)
tree222db9ee606d0c7257b943b85deea79cef801d83
parentdd10213d6ed24e834fc6f7ee8c16b9b84840c368 (diff)
parent9851d3c5b2a5f4c20850a821c2ab17a34b2544c5 (diff)
Merge pull request #55303 from aaronfranke/ps-wait-modified
-rw-r--r--core/config/project_settings.cpp41
-rw-r--r--core/config/project_settings.h1
-rw-r--r--editor/project_manager.cpp42
-rw-r--r--modules/mono/csharp_script.cpp6
4 files changed, 39 insertions, 51 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 21a802cb78..aecc509fc4 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -65,6 +65,14 @@ String ProjectSettings::get_resource_path() const {
return resource_path;
}
+String ProjectSettings::get_safe_project_name() const {
+ String safe_name = OS::get_singleton()->get_safe_dir_name(get("application/config/name"));
+ if (safe_name.is_empty()) {
+ safe_name = "UnnamedProject";
+ }
+ return safe_name;
+}
+
String ProjectSettings::get_imported_files_path() const {
return get_project_data_path().plus_file("imported");
}
@@ -701,11 +709,6 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
} else {
if (section == String()) {
set(assign, value);
- } else if (section == "application" && assign == "config/features") {
- const PackedStringArray project_features_untrimmed = value;
- const PackedStringArray project_features = _trim_to_supported_features(project_features_untrimmed);
- set("application/config/features", project_features);
- save();
} else {
set(section + "/" + assign, value);
}
@@ -923,6 +926,34 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par
Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) {
ERR_FAIL_COND_V_MSG(p_path == "", ERR_INVALID_PARAMETER, "Project settings save path cannot be empty.");
+ PackedStringArray project_features = get("application/config/features");
+ // If there is no feature list currently present, force one to generate.
+ if (project_features.is_empty()) {
+ project_features = ProjectSettings::get_required_features();
+ }
+ // Check the rendering API.
+ const String rendering_api = get("rendering/quality/driver/driver_name");
+ if (rendering_api != "") {
+ // Add the rendering API as a project feature if it doesn't already exist.
+ if (!project_features.has(rendering_api)) {
+ project_features.append(rendering_api);
+ }
+ }
+ // Check for the existence of a csproj file.
+ if (FileAccess::exists(get_resource_path().plus_file(get_safe_project_name() + ".csproj"))) {
+ // If there is a csproj file, add the C# feature if it doesn't already exist.
+ if (!project_features.has("C#")) {
+ project_features.append("C#");
+ }
+ } else {
+ // If there isn't a csproj file, remove the C# feature if it exists.
+ if (project_features.has("C#")) {
+ project_features.remove_at(project_features.find("C#"));
+ }
+ }
+ project_features = _trim_to_supported_features(project_features);
+ set("application/config/features", project_features);
+
Set<_VCSort> vclist;
if (p_merge_with_current) {
diff --git a/core/config/project_settings.h b/core/config/project_settings.h
index 2d8ec76b7a..5b74356337 100644
--- a/core/config/project_settings.h
+++ b/core/config/project_settings.h
@@ -151,6 +151,7 @@ public:
String get_project_data_dir_name() const;
String get_project_data_path() const;
String get_resource_path() const;
+ String get_safe_project_name() const;
String get_imported_files_path() const;
static ProjectSettings *get_singleton();
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 0be1f6d85b..372a77f67d 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1233,46 +1233,6 @@ ProjectList::Item ProjectList::load_project_data(const String &p_property_key, b
const String main_scene = cf->get_value("application", "run/main_scene", "");
PackedStringArray project_features = cf->get_value("application", "config/features", PackedStringArray());
- bool project_features_dirty = false;
- // If there is no feature list currently present, force one to generate.
- if (project_features.is_empty()) {
- project_features = ProjectSettings::get_required_features();
- project_features_dirty = true;
- }
- // Check the rendering API.
- const String rendering_api = cf->get_value("rendering", "quality/driver/driver_name", "");
- if (rendering_api != "") {
- // Add the rendering API as a project feature if it doesn't already exist.
- if (!project_features.has(rendering_api)) {
- project_features.append(rendering_api);
- project_features_dirty = true;
- }
- }
- // Check for the existence of a csproj file.
- if (FileAccess::exists(path.plus_file(project_name + ".csproj"))) {
- // If there is a csproj file, add the C# feature if it doesn't already exist.
- if (!project_features.has("C#")) {
- project_features.append("C#");
- project_features_dirty = true;
- }
- } else {
- // If there isn't a csproj file, remove the C# feature if it exists.
- if (project_features.has("C#")) {
- project_features.remove_at(project_features.find("C#"));
- project_features_dirty = true;
- }
- }
- if (project_features_dirty) {
- project_features.sort();
- // Write the updated feature list, but only if the project config version is the same.
- // Never write to project files with a different config version!
- if (config_version == ProjectSettings::CONFIG_VERSION) {
- ProjectSettings *ps = ProjectSettings::get_singleton();
- ps->load_custom(conf);
- ps->set("application/config/features", project_features);
- ps->save_custom(conf);
- }
- }
PackedStringArray unsupported_features = ProjectSettings::get_unsupported_features(project_features);
uint64_t last_edited = 0;
@@ -1470,7 +1430,7 @@ void ProjectList::create_project_item_control(int p_index) {
int length = unsupported_features_str.length();
if (length > 0) {
Label *unsupported_label = memnew(Label(unsupported_features_str));
- unsupported_label->set_custom_minimum_size(Size2(length * 15, 10));
+ unsupported_label->set_custom_minimum_size(Size2(length * 15, 10) * EDSCALE);
unsupported_label->add_theme_font_override("font", get_theme_font(SNAME("title"), SNAME("EditorFonts")));
unsupported_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
unsupported_label->set_clip_text(true);
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 544f2a7584..0ceb45d425 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -788,11 +788,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() {
GDMonoAssembly *proj_assembly = gdmono->get_project_assembly();
- String appname = ProjectSettings::get_singleton()->get("application/config/name");
- String appname_safe = OS::get_singleton()->get_safe_dir_name(appname);
- if (appname_safe.is_empty()) {
- appname_safe = "UnnamedProject";
- }
+ String appname_safe = ProjectSettings::get_singleton()->get_safe_project_name();
appname_safe += ".dll";