Fix overriding compression related settings

(cherry picked from commit 1f73469b50)
This commit is contained in:
Andrii Doroshenko (Xrayez) 2020-07-13 14:38:35 +03:00 committed by Rémi Verschelde
parent c88696cdb8
commit 813fab55d8

View file

@ -482,6 +482,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;
}
@ -997,6 +1005,8 @@ 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;
last_order = NO_BUILTIN_ORDER_BASE;
@ -1200,18 +1210,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");
// Would ideally be defined in an Android-specific file, but then it doesn't appear in the docs