Skip to content

Commit edf7f9b

Browse files
authored
Merge pull request #586 from jss2a98aj/blazium-4.5-cherry-picks
[4.5] cherry-picks through 10/31
2 parents 0061f66 + a2acdcb commit edf7f9b

File tree

212 files changed

+2175
-1162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+2175
-1162
lines changed

SConstruct

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,11 @@ elif methods.using_clang(env):
681681
# Apple LLVM versions differ from upstream LLVM version \o/, compare
682682
# in https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
683683
if methods.is_apple_clang(env):
684-
if cc_version_major < 10:
684+
if cc_version_major < 16:
685685
print_error(
686-
"Detected Apple Clang version older than 10, which does not fully "
687-
"support C++17. Supported versions are Apple Clang 10 and later."
686+
"Detected Apple Clang version older than 16, supported versions are Apple Clang 16 (Xcode 16) and later."
688687
)
689688
Exit(255)
690-
elif env["debug_paths_relative"] and cc_version_major < 12:
691-
print_warning(
692-
"Apple Clang < 12 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option."
693-
)
694-
env["debug_paths_relative"] = False
695689
else:
696690
if cc_version_major < 6:
697691
print_error(

core/config/project_settings.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,14 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
785785
resource_path = current_dir;
786786
resource_path = resource_path.replace_char('\\', '/'); // Windows path to Unix path just in case.
787787
err = _load_settings_text_or_binary(current_dir.path_join("project.godot"), current_dir.path_join("project.binary"));
788-
if (err == OK && !p_ignore_override) {
789-
// Optional, we don't mind if it fails.
788+
if (err == OK) {
790789
#ifdef OVERRIDE_ENABLED
791-
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
792-
if (!disable_override) {
793-
_load_settings_text(current_dir.path_join("override.cfg"));
790+
if (!p_ignore_override) {
791+
// Optional, we don't mind if it fails.
792+
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
793+
if (!disable_override) {
794+
_load_settings_text(current_dir.path_join("override.cfg"));
795+
}
794796
}
795797
#endif // OVERRIDE_ENABLED
796798
found = true;

core/crypto/crypto.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ Error ResourceFormatSaverCrypto::save(const Ref<Resource> &p_resource, const Str
231231
if (cert.is_valid()) {
232232
err = cert->save(p_path);
233233
} else if (key.is_valid()) {
234-
String el = p_path.get_extension().to_lower();
235-
err = key->save(p_path, el == "pub");
234+
err = key->save(p_path, p_path.has_extension("pub"));
236235
} else {
237236
ERR_FAIL_V(ERR_INVALID_PARAMETER);
238237
}

core/extension/gdextension.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,7 @@ bool GDExtensionResourceLoader::handles_type(const String &p_type) const {
888888
}
889889

890890
String GDExtensionResourceLoader::get_resource_type(const String &p_path) const {
891-
String el = p_path.get_extension().to_lower();
892-
if (el == "gdextension") {
891+
if (p_path.has_extension("gdextension")) {
893892
return "GDExtension";
894893
}
895894
return "";

core/io/json.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ void JSON::_stringify(String &r_result, const Variant &p_var, const String &p_in
7676
case Variant::FLOAT: {
7777
const double num = p_var;
7878

79+
// JSON does not support NaN or Infinity, so use extremely large numbers for infinity.
80+
if (!Math::is_finite(num)) {
81+
if (num == Math::INF) {
82+
r_result += "1e99999";
83+
} else if (num == -Math::INF) {
84+
r_result += "-1e99999";
85+
} else {
86+
WARN_PRINT_ONCE("`NaN` (\"Not a Number\") found in argument passed to JSON.stringify(). `NaN` cannot be represented in JSON, so the value has been replaced with `null`. This warning will not be printed for any later NaN occurrences.");
87+
r_result += "null";
88+
}
89+
return;
90+
}
7991
// Only for exactly 0. If we have approximately 0 let the user decide how much
8092
// precision they want.
8193
if (num == double(0.0)) {
@@ -1056,7 +1068,15 @@ Variant JSON::_to_native(const Variant &p_json, bool p_allow_objects, int p_dept
10561068
if (s.begins_with("i:")) {
10571069
return s.substr(2).to_int();
10581070
} else if (s.begins_with("f:")) {
1059-
return s.substr(2).to_float();
1071+
const String sub = s.substr(2);
1072+
if (sub == "inf") {
1073+
return Math::INF;
1074+
} else if (sub == "-inf") {
1075+
return -Math::INF;
1076+
} else if (sub == "nan") {
1077+
return Math::NaN;
1078+
}
1079+
return sub.to_float();
10601080
} else if (s.begins_with("s:")) {
10611081
return s.substr(2);
10621082
} else if (s.begins_with("sn:")) {
@@ -1573,8 +1593,7 @@ bool ResourceFormatLoaderJSON::handles_type(const String &p_type) const {
15731593
}
15741594

15751595
String ResourceFormatLoaderJSON::get_resource_type(const String &p_path) const {
1576-
String el = p_path.get_extension().to_lower();
1577-
if (el == "json") {
1596+
if (p_path.has_extension("json")) {
15781597
return "JSON";
15791598
}
15801599
return "";

core/io/resource_loader.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,20 +1068,6 @@ void ResourceLoader::remove_resource_format_loader(Ref<ResourceFormatLoader> p_f
10681068
--loader_count;
10691069
}
10701070

1071-
int ResourceLoader::get_import_order(const String &p_path) {
1072-
String local_path = _path_remap(_validate_local_path(p_path));
1073-
1074-
for (int i = 0; i < loader_count; i++) {
1075-
if (!loader[i]->recognize_path(local_path)) {
1076-
continue;
1077-
}
1078-
1079-
return loader[i]->get_import_order(p_path);
1080-
}
1081-
1082-
return 0;
1083-
}
1084-
10851071
String ResourceLoader::get_import_group_file(const String &p_path) {
10861072
String local_path = _path_remap(_validate_local_path(p_path));
10871073

@@ -1201,21 +1187,6 @@ ResourceUID::ID ResourceLoader::get_resource_uid(const String &p_path) {
12011187
return ResourceUID::INVALID_ID;
12021188
}
12031189

1204-
bool ResourceLoader::has_custom_uid_support(const String &p_path) {
1205-
String local_path = _validate_local_path(p_path);
1206-
1207-
for (int i = 0; i < loader_count; i++) {
1208-
if (!loader[i]->recognize_path(local_path)) {
1209-
continue;
1210-
}
1211-
if (loader[i]->has_custom_uid_support()) {
1212-
return true;
1213-
}
1214-
}
1215-
1216-
return false;
1217-
}
1218-
12191190
bool ResourceLoader::should_create_uid_file(const String &p_path) {
12201191
const String local_path = _validate_local_path(p_path);
12211192
if (FileAccess::exists(local_path + ".uid")) {

core/io/resource_loader.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,12 @@ class ResourceLoader {
244244
static String get_resource_type(const String &p_path);
245245
static String get_resource_script_class(const String &p_path);
246246
static ResourceUID::ID get_resource_uid(const String &p_path);
247-
static bool has_custom_uid_support(const String &p_path);
248247
static bool should_create_uid_file(const String &p_path);
249248
static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
250249
static Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
251250
static bool is_import_valid(const String &p_path);
252251
static String get_import_group_file(const String &p_path);
253252
static bool is_imported(const String &p_path);
254-
static int get_import_order(const String &p_path);
255253

256254
static void set_is_import_thread(bool p_import_thread);
257255

core/io/resource_saver.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ Error ResourceSaver::save(const Ref<Resource> &p_resource, const String &p_path,
105105
}
106106
ERR_FAIL_COND_V_MSG(path.is_empty(), ERR_INVALID_PARAMETER, "Can't save resource to empty path. Provide non-empty path or a Resource with non-empty resource_path.");
107107

108-
String extension = path.get_extension();
109108
Error err = ERR_FILE_UNRECOGNIZED;
110109

111110
for (int i = 0; i < saver_count; i++) {

core/io/translation_loader_po.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ bool TranslationLoaderPO::handles_type(const String &p_type) const {
368368
}
369369

370370
String TranslationLoaderPO::get_resource_type(const String &p_path) const {
371-
if (p_path.get_extension().to_lower() == "po" || p_path.get_extension().to_lower() == "mo") {
371+
if (p_path.has_extension("po") || p_path.has_extension("mo")) {
372372
return "Translation";
373373
}
374374
return "";

core/object/class_db.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
// Makes callable_mp readily available in all classes connecting signals.
3939
// Needs to come after method_bind and object have been included.
4040
#include "core/object/callable_method_pointer.h"
41+
#include "core/templates/a_hash_map.h"
4142
#include "core/templates/hash_set.h"
4243

4344
#include <type_traits>
@@ -127,14 +128,14 @@ class ClassDB {
127128

128129
HashMap<StringName, MethodBind *> method_map;
129130
HashMap<StringName, LocalVector<MethodBind *>> method_map_compatibility;
130-
HashMap<StringName, int64_t> constant_map;
131+
AHashMap<StringName, int64_t> constant_map;
131132
struct EnumInfo {
132133
List<StringName> constants;
133134
bool is_bitfield = false;
134135
};
135136

136137
HashMap<StringName, EnumInfo> enum_map;
137-
HashMap<StringName, MethodInfo> signal_map;
138+
AHashMap<StringName, MethodInfo> signal_map;
138139
List<PropertyInfo> property_list;
139140
HashMap<StringName, PropertyInfo> property_map;
140141

@@ -152,7 +153,7 @@ class ClassDB {
152153
List<StringName> dependency_list;
153154
#endif
154155

155-
HashMap<StringName, PropertySetGet> property_setget;
156+
AHashMap<StringName, PropertySetGet> property_setget;
156157
HashMap<StringName, Vector<uint32_t>> virtual_methods_compat;
157158

158159
StringName inherits;

0 commit comments

Comments
 (0)