From e680d351080ecd1ae767a8d74bbeb38e8e45fcfa Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 23 May 2023 20:55:56 +0200 Subject: [PATCH] Fix build. --- class_db_api_json.cpp | 2 +- class_db_api_json.h | 4 +- csharp_script.cpp | 63 +++---- csharp_script.h | 32 ++-- editor/bindings_generator.cpp | 72 ++++---- editor/bindings_generator.h | 21 +-- editor/code_completion.cpp | 2 +- editor/code_completion.h | 4 +- editor/csharp_project.cpp | 2 +- editor/csharp_project.h | 2 +- editor/editor_internal_calls.cpp | 13 +- editor/godotsharp_export.cpp | 2 +- editor/godotsharp_export.h | 6 +- editor/script_class_parser.cpp | 6 +- editor/script_class_parser.h | 6 +- glue/GodotSharp/GodotSharp/Core/Basis.cs | 40 ++--- .../Core/{Quat.cs => Quaternion.cs} | 162 +++++++++--------- glue/GodotSharp/GodotSharp/Core/Transform.cs | 10 +- glue/GodotSharp/GodotSharp/GodotSharp.csproj | 2 +- glue/base_object_glue.cpp | 6 +- glue/base_object_glue.h | 4 +- glue/gd_glue.cpp | 4 +- glue/glue_header.h | 16 +- glue/nodepath_glue.cpp | 2 +- glue/rid_glue.h | 2 +- glue/string_glue.cpp | 6 +- godotsharp_dirs.cpp | 4 +- godotsharp_dirs.h | 2 +- mono_gc_handle.h | 2 +- mono_gd/android_mono_config.h | 2 +- mono_gd/gd_mono.cpp | 2 +- mono_gd/gd_mono_assembly.cpp | 10 +- mono_gd/gd_mono_assembly.h | 10 +- mono_gd/gd_mono_cache.cpp | 4 +- mono_gd/gd_mono_cache.h | 2 +- mono_gd/gd_mono_class.cpp | 14 +- mono_gd/gd_mono_class.h | 10 +- mono_gd/gd_mono_field.cpp | 12 +- mono_gd/gd_mono_internals.h | 2 +- mono_gd/gd_mono_log.cpp | 16 +- mono_gd/gd_mono_marshal.cpp | 24 +-- mono_gd/gd_mono_marshal.h | 56 +++--- mono_gd/gd_mono_utils.cpp | 6 +- mono_gd/gd_mono_utils.h | 4 +- mono_gd/gd_mono_wasm_m2n.cpp | 2 +- mono_gd/gd_mono_wasm_m2n.h | 2 +- mono_gd/support/android_support.cpp | 2 +- mono_gd/support/android_support.h | 2 +- mono_gd/support/ios_support.h | 2 +- mono_gd/support/ios_support.mm | 2 +- register_types.cpp | 52 +++--- register_types.h | 11 +- signal_awaiter_utils.h | 2 +- utils/mono_reg_utils.h | 2 +- utils/osx_utils.cpp | 2 +- utils/osx_utils.h | 2 +- utils/path_utils.cpp | 2 +- utils/path_utils.h | 4 +- utils/string_utils.cpp | 2 +- utils/string_utils.h | 4 +- utils/thread_local.cpp | 2 +- 61 files changed, 399 insertions(+), 371 deletions(-) rename glue/GodotSharp/GodotSharp/Core/{Quat.cs => Quaternion.cs} (79%) diff --git a/class_db_api_json.cpp b/class_db_api_json.cpp index 727d79f..dd5d939 100644 --- a/class_db_api_json.cpp +++ b/class_db_api_json.cpp @@ -34,7 +34,7 @@ #include "core/io/json.h" #include "core/os/file_access.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #include "core/version.h" void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) { diff --git a/class_db_api_json.h b/class_db_api_json.h index 9ae6aba..90f41e5 100644 --- a/class_db_api_json.h +++ b/class_db_api_json.h @@ -33,11 +33,11 @@ // '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" +#include "core/object/class_db.h" #ifdef DEBUG_METHODS_ENABLED -#include "core/ustring.h" +#include "core/string/ustring.h" void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api); diff --git a/csharp_script.cpp b/csharp_script.cpp index 9da68c4..c0f2367 100644 --- a/csharp_script.cpp +++ b/csharp_script.cpp @@ -36,7 +36,7 @@ #include "core/os/file_access.h" #include "core/os/os.h" #include "core/os/thread.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #ifdef TOOLS_ENABLED #include "core/os/keyboard.h" @@ -45,6 +45,7 @@ #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor/node_dock.h" +#include "editor/editor_inspector.h" #endif #ifdef DEBUG_METHODS_ENABLED @@ -136,7 +137,7 @@ void CSharpLanguage::finish() { finalizing = true; // Make sure all script binding gchandles are released before finalizing GDMono - for (Map::Element *E = script_bindings.front(); E; E = E->next()) { + for (RBMap::Element *E = script_bindings.front(); E; E = E->next()) { CSharpScriptBinding &script_binding = E->value(); if (script_binding.gchandle.is_valid()) { @@ -154,7 +155,7 @@ void CSharpLanguage::finish() { script_bindings.clear(); #ifdef DEBUG_ENABLED - for (Map::Element *E = unsafe_object_references.front(); E; E = E->next()) { + for (RBMap::Element *E = unsafe_object_references.front(); E; E = E->next()) { const ObjectID &id = E->key(); Object *obj = ObjectDB::get_instance(id); @@ -463,13 +464,13 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { Variant::VECTOR3, Variant::TRANSFORM2D, Variant::PLANE, - Variant::QUAT, + Variant::QUATERNION, Variant::AABB, Variant::BASIS, Variant::TRANSFORM, Variant::COLOR, Variant::NODE_PATH, - Variant::_RID + Variant::RID }; for (unsigned int i = 0; i < sizeof(var_types) / sizeof(Variant::Type); i++) { @@ -643,7 +644,7 @@ void CSharpLanguage::pre_unsafe_unreference(Object *p_obj) { #ifdef DEBUG_ENABLED MutexLock lock(unsafe_object_references_lock); ObjectID id = p_obj->get_instance_id(); - Map::Element *elem = unsafe_object_references.find(id); + RBMap::Element *elem = unsafe_object_references.find(id); ERR_FAIL_NULL(elem); if (--elem->value() == 0) unsafe_object_references.erase(elem); @@ -776,7 +777,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { // We need to keep reference instances alive during reloading List> ref_instances; - for (Map::Element *E = script_bindings.front(); E; E = E->next()) { + for (RBMap::Element *E = script_bindings.front(); E; E = E->next()) { CSharpScriptBinding &script_binding = E->value(); Reference *ref = Object::cast_to(script_binding.owner); if (ref) { @@ -807,7 +808,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { // Script::instances are deleted during managed object disposal, which happens on domain finalize. // Only placeholders are kept. Therefore we need to keep a copy before that happens. - for (Set::Element *F = script->instances.front(); F; F = F->next()) { + for (RBSet::Element *F = script->instances.front(); F; F = F->next()) { Object *obj = F->get(); script->pending_reload_instances.insert(obj->get_instance_id()); @@ -818,7 +819,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { } #ifdef TOOLS_ENABLED - for (Set::Element *F = script->placeholders.front(); F; F = F->next()) { + for (RBSet::Element *F = script->placeholders.front(); F; F = F->next()) { Object *obj = F->get()->get_owner(); script->pending_reload_instances.insert(obj->get_instance_id()); @@ -830,9 +831,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { #endif // Save state and remove script from instances - Map &owners_map = script->pending_reload_state; + RBMap &owners_map = script->pending_reload_state; - for (Set::Element *F = script->instances.front(); F; F = F->next()) { + for (RBSet::Element *F = script->instances.front(); F; F = F->next()) { Object *obj = F->get(); ERR_CONTINUE(!obj->get_script_instance()); @@ -872,7 +873,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { for (List>::Element *E = to_reload.front(); E; E = E->next()) { Ref scr = E->get(); - for (const Map::Element *F = scr->pending_reload_state.front(); F; F = F->next()) { + for (const RBMap::Element *F = scr->pending_reload_state.front(); F; F = F->next()) { Object *obj = ObjectDB::get_instance(F->key()); if (!obj) @@ -963,7 +964,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { String native_name = NATIVE_GDMONOCLASS_NAME(script->native); { - for (Set::Element *F = script->pending_reload_instances.front(); F; F = F->next()) { + for (RBSet::Element *F = script->pending_reload_instances.front(); F; F = F->next()) { ObjectID obj_id = F->get(); Object *obj = ObjectDB::get_instance(obj_id); @@ -1018,7 +1019,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { for (List>::Element *E = to_reload_state.front(); E; E = E->next()) { Ref script = E->get(); - for (Set::Element *F = script->pending_reload_instances.front(); F; F = F->next()) { + for (RBSet::Element *F = script->pending_reload_instances.front(); F; F = F->next()) { ObjectID obj_id = F->get(); Object *obj = ObjectDB::get_instance(obj_id); @@ -1156,7 +1157,7 @@ bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) { } void CSharpLanguage::_on_scripts_domain_unloaded() { - for (Map::Element *E = script_bindings.front(); E; E = E->next()) { + for (RBMap::Element *E = script_bindings.front(); E; E = E->next()) { CSharpScriptBinding &script_binding = E->value(); script_binding.inited = false; } @@ -1297,7 +1298,7 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) { MutexLock lock(language_bind_mutex); - Map::Element *match = script_bindings.find(p_object); + RBMap::Element *match = script_bindings.find(p_object); if (match) return (void *)match; @@ -1309,7 +1310,7 @@ void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) { return (void *)insert_script_binding(p_object, script_binding); } -Map::Element *CSharpLanguage::insert_script_binding(Object *p_object, const CSharpScriptBinding &p_script_binding) { +RBMap::Element *CSharpLanguage::insert_script_binding(Object *p_object, const CSharpScriptBinding &p_script_binding) { return script_bindings.insert(p_object, p_script_binding); } @@ -1330,7 +1331,7 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) { { MutexLock lock(language_bind_mutex); - Map::Element *data = (Map::Element *)p_data; + RBMap::Element *data = (RBMap::Element *)p_data; CSharpScriptBinding &script_binding = data->value(); @@ -1358,7 +1359,7 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) { void *data = p_object->get_script_instance_binding(get_language_index()); CRASH_COND(!data); - CSharpScriptBinding &script_binding = ((Map::Element *)data)->get(); + CSharpScriptBinding &script_binding = ((RBMap::Element *)data)->get(); Ref &gchandle = script_binding.gchandle; if (!script_binding.inited) @@ -1393,7 +1394,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) { void *data = p_object->get_script_instance_binding(get_language_index()); CRASH_COND(!data); - CSharpScriptBinding &script_binding = ((Map::Element *)data)->get(); + CSharpScriptBinding &script_binding = ((RBMap::Element *)data)->get(); Ref &gchandle = script_binding.gchandle; int refcount = ref_owner->reference_get_count(); @@ -2164,7 +2165,7 @@ CSharpInstance::~CSharpInstance() { void *data = owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index()); CRASH_COND(data == NULL); - CSharpScriptBinding &script_binding = ((Map::Element *)data)->get(); + CSharpScriptBinding &script_binding = ((RBMap::Element *)data)->get(); if (!script_binding.inited) { MutexLock lock(CSharpLanguage::get_singleton()->get_language_bind_mutex()); @@ -2187,7 +2188,7 @@ CSharpInstance::~CSharpInstance() { #ifdef DEBUG_ENABLED // CSharpInstance must not be created unless it's going to be added to the list for sure - Set::Element *match = script->instances.find(owner); + RBSet::Element *match = script->instances.find(owner); CRASH_COND(!match); script->instances.erase(match); #else @@ -2203,12 +2204,12 @@ void CSharpScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) #endif #ifdef TOOLS_ENABLED -void CSharpScript::_update_exports_values(Map &values, List &propnames) { +void CSharpScript::_update_exports_values(RBMap &values, List &propnames) { if (base_cache.is_valid()) { base_cache->_update_exports_values(values, propnames); } - for (Map::Element *E = exported_members_defval_cache.front(); E; E = E->next()) { + for (RBMap::Element *E = exported_members_defval_cache.front(); E; E = E->next()) { values[E->key()] = E->get(); } @@ -2438,12 +2439,12 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda if ((changed || p_instance_to_update) && placeholders.size()) { // Update placeholders if any - Map values; + RBMap values; List propnames; _update_exports_values(values, propnames); if (changed) { - for (Set::Element *E = placeholders.front(); E; E = E->next()) { + for (RBSet::Element *E = placeholders.front(); E; E = E->next()) { E->get()->update(propnames, values); } } else { @@ -2937,7 +2938,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg void *data = p_owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index()); CRASH_COND(data == NULL); - CSharpScriptBinding &script_binding = ((Map::Element *)data)->get(); + CSharpScriptBinding &script_binding = ((RBMap::Element *)data)->get(); if (script_binding.inited && script_binding.gchandle.is_valid()) { MonoObject *mono_object = script_binding.gchandle->get_target(); if (mono_object) { @@ -3241,7 +3242,7 @@ ScriptLanguage *CSharpScript::get_language() const { bool CSharpScript::get_property_default_value(const StringName &p_property, Variant &r_value) const { #ifdef TOOLS_ENABLED - const Map::Element *E = exported_members_defval_cache.find(p_property); + const RBMap::Element *E = exported_members_defval_cache.find(p_property); if (E) { r_value = E->get(); return true; @@ -3266,7 +3267,7 @@ bool CSharpScript::has_script_signal(const StringName &p_signal) const { } void CSharpScript::get_script_signal_list(List *r_signals) const { - for (const Map>::Element *E = _signals.front(); E; E = E->next()) { + for (const RBMap>::Element *E = _signals.front(); E; E = E->next()) { MethodInfo mi; mi.name = E->key(); @@ -3367,10 +3368,10 @@ CSharpScript::~CSharpScript() { #endif } -void CSharpScript::get_members(Set *p_members) { +void CSharpScript::get_members(RBSet *p_members) { #if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED) if (p_members) { - for (Set::Element *E = exported_members_names.front(); E; E = E->next()) { + for (RBSet::Element *E = exported_members_names.front(); E; E = E->next()) { p_members->insert(E->get()); } } diff --git a/csharp_script.h b/csharp_script.h index 3be5584..f482c48 100644 --- a/csharp_script.h +++ b/csharp_script.h @@ -33,8 +33,10 @@ #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/script_language.h" -#include "core/self_list.h" +#include "core/object/script_language.h" +#include "core/containers/self_list.h" +#include "core/containers/rb_set.h" +#include "core/containers/ordered_hash_map.h" #include "mono_gc_handle.h" #include "mono_gd/gd_mono.h" @@ -84,7 +86,7 @@ class CSharpScript : public Script { Ref base_cache; // TODO what's this for? - Set instances; + RBSet instances; #ifdef GD_MONO_HOT_RELOAD struct StateBackup { @@ -94,8 +96,8 @@ class CSharpScript : public Script { List> properties; }; - Set pending_reload_instances; - Map pending_reload_state; + RBSet pending_reload_instances; + RBMap pending_reload_state; StringName tied_class_name_for_reload; StringName tied_class_namespace_for_reload; #endif @@ -110,23 +112,23 @@ class CSharpScript : public Script { Variant::Type type; }; - Map> _signals; + RBMap> _signals; bool signals_invalidated; #ifdef TOOLS_ENABLED List exported_members_cache; // members_cache - Map exported_members_defval_cache; // member_default_values_cache - Set placeholders; + RBMap exported_members_defval_cache; // member_default_values_cache + RBSet placeholders; bool source_changed_cache; bool placeholder_fallback_enabled; bool exports_invalidated; - void _update_exports_values(Map &values, List &propnames); + void _update_exports_values(RBMap &values, List &propnames); void _update_member_info_no_exports(); virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); #endif #if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED) - Set exported_members_names; + RBSet exported_members_names; #endif OrderedHashMap member_info; @@ -180,7 +182,7 @@ public: virtual void get_script_property_list(List *p_list) const; virtual void update_exports(); - virtual void get_members(Set *p_members); + virtual void get_members(RBSet *p_members); virtual bool is_tool() const { return tool; } virtual bool is_valid() const { return valid; } @@ -312,11 +314,11 @@ class CSharpLanguage : public ScriptLanguage { Mutex script_gchandle_release_mutex; Mutex language_bind_mutex; - Map script_bindings; + RBMap script_bindings; #ifdef DEBUG_ENABLED // List of unsafe object references - Map unsafe_object_references; + RBMap unsafe_object_references; Mutex unsafe_object_references_lock; #endif @@ -409,7 +411,7 @@ public: virtual Ref