diff options
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/class_db_api_json.cpp | 4 | ||||
-rw-r--r-- | modules/mono/class_db_api_json.h | 7 | ||||
-rw-r--r-- | modules/mono/glue/Managed/Files/Mathf.cs | 6 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono.cpp | 26 |
4 files changed, 34 insertions, 9 deletions
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp index 71ccdb7aab..4a6637434a 100644 --- a/modules/mono/class_db_api_json.cpp +++ b/modules/mono/class_db_api_json.cpp @@ -30,6 +30,8 @@ #include "class_db_api_json.h" +#ifdef DEBUG_METHODS_ENABLED + #include "core/io/json.h" #include "core/os/file_access.h" #include "core/project_settings.h" @@ -240,3 +242,5 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) { print_line(String() + "ClassDB API JSON written to: " + ProjectSettings::get_singleton()->globalize_path(p_output_file)); } + +#endif // DEBUG_METHODS_ENABLED diff --git a/modules/mono/class_db_api_json.h b/modules/mono/class_db_api_json.h index 0aa9c20930..ddfe2debea 100644 --- a/modules/mono/class_db_api_json.h +++ b/modules/mono/class_db_api_json.h @@ -31,9 +31,16 @@ #ifndef CLASS_DB_API_JSON_H #define CLASS_DB_API_JSON_H +// 'core/method_bind.h' defines DEBUG_METHODS_ENABLED, but it looks like we +// cannot include it here. That's why we include it through 'core/class_db.h'. #include "core/class_db.h" + +#ifdef DEBUG_METHODS_ENABLED + #include "core/ustring.h" void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api); +#endif // DEBUG_METHODS_ENABLED + #endif // CLASS_DB_API_JSON_H diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs index 2d8c63fe7f..6c1a51fcf9 100644 --- a/modules/mono/glue/Managed/Files/Mathf.cs +++ b/modules/mono/glue/Managed/Files/Mathf.cs @@ -185,6 +185,12 @@ namespace Godot return from + (to - from) * weight; } + public static real_t LerpAngle(real_t from, real_t to, real_t weight) { + real_t difference = (to - from) % Mathf.Tau; + real_t distance = ((2 * difference) % Mathf.Tau) - difference; + return from + distance * weight; + } + public static real_t Log(real_t s) { return (real_t)Math.Log(s); diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 096ad0f5e3..571bf598f3 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -602,12 +602,12 @@ bool GDMono::copy_prebuilt_api_assembly(APIAssembly::Type p_api_type) { String GDMono::update_api_assemblies_from_prebuilt() { -#define FAIL_REASON(m_out_of_sync, m_prebuilt_exist) \ +#define FAIL_REASON(m_out_of_sync, m_prebuilt_exists) \ ( \ (m_out_of_sync ? \ String("The assembly is invalidated") : \ String("The assembly was not found")) + \ - (m_prebuilt_exist ? \ + (m_prebuilt_exists ? \ String(" and the prebuilt assemblies are missing") : \ String(" and we failed to copy the prebuilt assemblies"))) @@ -619,16 +619,18 @@ String GDMono::update_api_assemblies_from_prebuilt() { if (!api_assembly_out_of_sync && FileAccess::exists(core_assembly_path) && FileAccess::exists(editor_assembly_path)) return String(); // No update needed + print_verbose("Updating API assemblies"); + String prebuilt_api_dir = GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file("Debug"); String prebuilt_core_dll_path = prebuilt_api_dir.plus_file(CORE_API_ASSEMBLY_NAME ".dll"); String prebuilt_editor_dll_path = prebuilt_api_dir.plus_file(EDITOR_API_ASSEMBLY_NAME ".dll"); if (!FileAccess::exists(prebuilt_core_dll_path) || !FileAccess::exists(prebuilt_editor_dll_path)) - return FAIL_REASON(api_assembly_out_of_sync, /* prebuilt_exist: */ false); + return FAIL_REASON(api_assembly_out_of_sync, /* prebuilt_exists: */ false); // Copy the prebuilt Api if (!copy_prebuilt_api_assembly(APIAssembly::API_CORE) || !copy_prebuilt_api_assembly(APIAssembly::API_EDITOR)) - return FAIL_REASON(api_assembly_out_of_sync, /* prebuilt_exist: */ true); + return FAIL_REASON(api_assembly_out_of_sync, /* prebuilt_exists: */ true); return String(); // Updated successfully @@ -699,9 +701,6 @@ bool GDMono::_try_load_api_assemblies() { return false; } - if (core_api_assembly_out_of_sync || !GDMonoUtils::mono_cache.godot_api_cache_updated) - return false; - #ifdef TOOLS_ENABLED if (!_load_editor_api_assembly()) { if (OS::get_singleton()->is_stdout_verbose()) @@ -713,12 +712,19 @@ bool GDMono::_try_load_api_assemblies() { return false; #endif + // Check if the core API assembly is out of sync only after trying to load the + // editor API assembly. Otherwise, if both assemblies are out of sync, we would + // only update the former as we won't know the latter also needs to be updated. + if (core_api_assembly_out_of_sync || !GDMonoUtils::mono_cache.godot_api_cache_updated) + return false; + return true; } void GDMono::_load_api_assemblies() { if (!_try_load_api_assemblies()) { +#ifdef TOOLS_ENABLED // The API assemblies are out of sync. Fine, try one more time, but this time // update them from the prebuilt assemblies directory before trying to load them. @@ -752,11 +758,9 @@ void GDMono::_load_api_assemblies() { ERR_PRINT("The loaded assembly '" CORE_API_ASSEMBLY_NAME "' is in sync, but the cache update failed"); } -#ifdef TOOLS_ENABLED if (editor_api_assembly_out_of_sync) { ERR_PRINT("The assembly '" EDITOR_API_ASSEMBLY_NAME "' is out of sync"); } -#endif CRASH_NOW(); } else { @@ -764,6 +768,10 @@ void GDMono::_load_api_assemblies() { CRASH_NOW(); } } +#else + ERR_EXPLAIN("Failed to load one of the API assemblies"); + CRASH_NOW(); +#endif } } |