summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-07-13 14:38:35 +0300
committerAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-07-13 14:38:35 +0300
commit1f73469b50b75d26c7fc5c3465d4413de18d47ae (patch)
tree9c95cd6b6ea0606c7098d46f52a2bd28cf3f33ec
parentf10f76d95db3248ffb11d2b97b0cdd317b0b5e73 (diff)
Fix overriding compression related settings
-rw-r--r--core/project_settings.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 3f9585c03c..638987bb2f 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -488,6 +488,14 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo
_load_settings_text(custom_settings);
}
}
+ // Using GLOBAL_GET on every block for compressing can be slow, so assigning here.
+ Compression::zstd_long_distance_matching = GLOBAL_GET("compression/formats/zstd/long_distance_matching");
+ Compression::zstd_level = GLOBAL_GET("compression/formats/zstd/compression_level");
+ Compression::zstd_window_log_size = GLOBAL_GET("compression/formats/zstd/window_log_size");
+
+ Compression::zlib_level = GLOBAL_GET("compression/formats/zlib/compression_level");
+
+ Compression::gzip_level = GLOBAL_GET("compression/formats/gzip/compression_level");
return err;
}
@@ -1007,6 +1015,9 @@ void ProjectSettings::_bind_methods() {
}
ProjectSettings::ProjectSettings() {
+ // Initialization of engine variables should be done in the setup() method,
+ // so that the values can be overridden from project.godot or project.binary.
+
singleton = this;
Array events;
@@ -1206,18 +1217,17 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("debug/settings/profiler/max_functions", 16384);
custom_prop_info["debug/settings/profiler/max_functions"] = PropertyInfo(Variant::INT, "debug/settings/profiler/max_functions", PROPERTY_HINT_RANGE, "128,65535,1");
- //assigning here, because using GLOBAL_GET on every block for compressing can be slow
- Compression::zstd_long_distance_matching = GLOBAL_DEF("compression/formats/zstd/long_distance_matching", false);
+ GLOBAL_DEF("compression/formats/zstd/long_distance_matching", Compression::zstd_long_distance_matching);
custom_prop_info["compression/formats/zstd/long_distance_matching"] = PropertyInfo(Variant::BOOL, "compression/formats/zstd/long_distance_matching");
- Compression::zstd_level = GLOBAL_DEF("compression/formats/zstd/compression_level", 3);
+ GLOBAL_DEF("compression/formats/zstd/compression_level", Compression::zstd_level);
custom_prop_info["compression/formats/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1");
- Compression::zstd_window_log_size = GLOBAL_DEF("compression/formats/zstd/window_log_size", 27);
+ GLOBAL_DEF("compression/formats/zstd/window_log_size", Compression::zstd_window_log_size);
custom_prop_info["compression/formats/zstd/window_log_size"] = PropertyInfo(Variant::INT, "compression/formats/zstd/window_log_size", PROPERTY_HINT_RANGE, "10,30,1");
- Compression::zlib_level = GLOBAL_DEF("compression/formats/zlib/compression_level", Z_DEFAULT_COMPRESSION);
+ GLOBAL_DEF("compression/formats/zlib/compression_level", Compression::zlib_level);
custom_prop_info["compression/formats/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1");
- Compression::gzip_level = GLOBAL_DEF("compression/formats/gzip/compression_level", Z_DEFAULT_COMPRESSION);
+ GLOBAL_DEF("compression/formats/gzip/compression_level", Compression::gzip_level);
custom_prop_info["compression/formats/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1");
}