mirror of
https://github.com/Relintai/mono.git
synced 2024-11-20 10:57:23 +01:00
Fix build.
This commit is contained in:
parent
e7b9b694e8
commit
e680d35108
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
|
||||
for (RBMap<Object *, CSharpScriptBinding>::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<ObjectID, int>::Element *E = unsafe_object_references.front(); E; E = E->next()) {
|
||||
for (RBMap<ObjectID, int>::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<ObjectID, int>::Element *elem = unsafe_object_references.find(id);
|
||||
RBMap<ObjectID, int>::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<Reference>> ref_instances;
|
||||
|
||||
for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
|
||||
for (RBMap<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
|
||||
CSharpScriptBinding &script_binding = E->value();
|
||||
Reference *ref = Object::cast_to<Reference>(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<Object *>::Element *F = script->instances.front(); F; F = F->next()) {
|
||||
for (RBSet<Object *>::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<PlaceHolderScriptInstance *>::Element *F = script->placeholders.front(); F; F = F->next()) {
|
||||
for (RBSet<PlaceHolderScriptInstance *>::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<ObjectID, CSharpScript::StateBackup> &owners_map = script->pending_reload_state;
|
||||
RBMap<ObjectID, CSharpScript::StateBackup> &owners_map = script->pending_reload_state;
|
||||
|
||||
for (Set<Object *>::Element *F = script->instances.front(); F; F = F->next()) {
|
||||
for (RBSet<Object *>::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<Ref<CSharpScript>>::Element *E = to_reload.front(); E; E = E->next()) {
|
||||
Ref<CSharpScript> scr = E->get();
|
||||
|
||||
for (const Map<ObjectID, CSharpScript::StateBackup>::Element *F = scr->pending_reload_state.front(); F; F = F->next()) {
|
||||
for (const RBMap<ObjectID, CSharpScript::StateBackup>::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<ObjectID>::Element *F = script->pending_reload_instances.front(); F; F = F->next()) {
|
||||
for (RBSet<ObjectID>::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<Ref<CSharpScript>>::Element *E = to_reload_state.front(); E; E = E->next()) {
|
||||
Ref<CSharpScript> script = E->get();
|
||||
|
||||
for (Set<ObjectID>::Element *F = script->pending_reload_instances.front(); F; F = F->next()) {
|
||||
for (RBSet<ObjectID>::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<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
|
||||
for (RBMap<Object *, CSharpScriptBinding>::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<Object *, CSharpScriptBinding>::Element *match = script_bindings.find(p_object);
|
||||
RBMap<Object *, CSharpScriptBinding>::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<Object *, CSharpScriptBinding>::Element *CSharpLanguage::insert_script_binding(Object *p_object, const CSharpScriptBinding &p_script_binding) {
|
||||
RBMap<Object *, CSharpScriptBinding>::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<Object *, CSharpScriptBinding>::Element *data = (Map<Object *, CSharpScriptBinding>::Element *)p_data;
|
||||
RBMap<Object *, CSharpScriptBinding>::Element *data = (RBMap<Object *, CSharpScriptBinding>::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<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
Ref<MonoGCHandle> &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<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
Ref<MonoGCHandle> &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<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::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<Object *>::Element *match = script->instances.find(owner);
|
||||
RBSet<Object *>::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<StringName, Variant> &values, List<PropertyInfo> &propnames) {
|
||||
void CSharpScript::_update_exports_values(RBMap<StringName, Variant> &values, List<PropertyInfo> &propnames) {
|
||||
if (base_cache.is_valid()) {
|
||||
base_cache->_update_exports_values(values, propnames);
|
||||
}
|
||||
|
||||
for (Map<StringName, Variant>::Element *E = exported_members_defval_cache.front(); E; E = E->next()) {
|
||||
for (RBMap<StringName, Variant>::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<StringName, Variant> values;
|
||||
RBMap<StringName, Variant> values;
|
||||
List<PropertyInfo> propnames;
|
||||
_update_exports_values(values, propnames);
|
||||
|
||||
if (changed) {
|
||||
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
|
||||
for (RBSet<PlaceHolderScriptInstance *>::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<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::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<StringName, Variant>::Element *E = exported_members_defval_cache.find(p_property);
|
||||
const RBMap<StringName, Variant>::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<MethodInfo> *r_signals) const {
|
||||
for (const Map<StringName, Vector<Argument>>::Element *E = _signals.front(); E; E = E->next()) {
|
||||
for (const RBMap<StringName, Vector<Argument>>::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<StringName> *p_members) {
|
||||
void CSharpScript::get_members(RBSet<StringName> *p_members) {
|
||||
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
|
||||
if (p_members) {
|
||||
for (Set<StringName>::Element *E = exported_members_names.front(); E; E = E->next()) {
|
||||
for (RBSet<StringName>::Element *E = exported_members_names.front(); E; E = E->next()) {
|
||||
p_members->insert(E->get());
|
||||
}
|
||||
}
|
||||
|
@ -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<CSharpScript> base_cache; // TODO what's this for?
|
||||
|
||||
Set<Object *> instances;
|
||||
RBSet<Object *> instances;
|
||||
|
||||
#ifdef GD_MONO_HOT_RELOAD
|
||||
struct StateBackup {
|
||||
@ -94,8 +96,8 @@ class CSharpScript : public Script {
|
||||
List<Pair<StringName, Variant>> properties;
|
||||
};
|
||||
|
||||
Set<ObjectID> pending_reload_instances;
|
||||
Map<ObjectID, StateBackup> pending_reload_state;
|
||||
RBSet<ObjectID> pending_reload_instances;
|
||||
RBMap<ObjectID, StateBackup> 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<StringName, Vector<Argument>> _signals;
|
||||
RBMap<StringName, Vector<Argument>> _signals;
|
||||
bool signals_invalidated;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
List<PropertyInfo> exported_members_cache; // members_cache
|
||||
Map<StringName, Variant> exported_members_defval_cache; // member_default_values_cache
|
||||
Set<PlaceHolderScriptInstance *> placeholders;
|
||||
RBMap<StringName, Variant> exported_members_defval_cache; // member_default_values_cache
|
||||
RBSet<PlaceHolderScriptInstance *> placeholders;
|
||||
bool source_changed_cache;
|
||||
bool placeholder_fallback_enabled;
|
||||
bool exports_invalidated;
|
||||
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
|
||||
void _update_exports_values(RBMap<StringName, Variant> &values, List<PropertyInfo> &propnames);
|
||||
void _update_member_info_no_exports();
|
||||
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
|
||||
#endif
|
||||
|
||||
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
|
||||
Set<StringName> exported_members_names;
|
||||
RBSet<StringName> exported_members_names;
|
||||
#endif
|
||||
|
||||
OrderedHashMap<StringName, PropertyInfo> member_info;
|
||||
@ -180,7 +182,7 @@ public:
|
||||
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
|
||||
virtual void update_exports();
|
||||
|
||||
virtual void get_members(Set<StringName> *p_members);
|
||||
virtual void get_members(RBSet<StringName> *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<Object *, CSharpScriptBinding> script_bindings;
|
||||
RBMap<Object *, CSharpScriptBinding> script_bindings;
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
// List of unsafe object references
|
||||
Map<ObjectID, int> unsafe_object_references;
|
||||
RBMap<ObjectID, int> unsafe_object_references;
|
||||
Mutex unsafe_object_references_lock;
|
||||
#endif
|
||||
|
||||
@ -409,7 +411,7 @@ public:
|
||||
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
|
||||
virtual bool is_using_templates();
|
||||
virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
|
||||
/* TODO */ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const { return true; }
|
||||
/* TODO */ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings = NULL, RBSet<int> *r_safe_lines = NULL) const { return true; }
|
||||
virtual String validate_path(const String &p_path) const;
|
||||
virtual Script *create_script() const;
|
||||
virtual bool has_named_classes() const;
|
||||
@ -464,7 +466,7 @@ public:
|
||||
virtual void refcount_incremented_instance_binding(Object *p_object);
|
||||
virtual bool refcount_decremented_instance_binding(Object *p_object);
|
||||
|
||||
Map<Object *, CSharpScriptBinding>::Element *insert_script_binding(Object *p_object, const CSharpScriptBinding &p_script_binding);
|
||||
RBMap<Object *, CSharpScriptBinding>::Element *insert_script_binding(Object *p_object, const CSharpScriptBinding &p_script_binding);
|
||||
bool setup_csharp_script_binding(CSharpScriptBinding &r_script_binding, Object *p_object);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
@ -32,13 +32,13 @@
|
||||
|
||||
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "core/global_constants.h"
|
||||
#include "core/io/compression.h"
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/ucaps.h"
|
||||
#include "core/string/ucaps.h"
|
||||
#include "main/main.h"
|
||||
|
||||
#include "../glue/cs_glue_version.gen.h"
|
||||
@ -556,7 +556,7 @@ void BindingsGenerator::_append_xml_member(StringBuilder &p_xml_output, const Ty
|
||||
void BindingsGenerator::_append_xml_enum(StringBuilder &p_xml_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts) {
|
||||
const StringName search_cname = !p_target_itype ? p_target_cname : StringName(p_target_itype->name + "." + (String)p_target_cname);
|
||||
|
||||
const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(search_cname);
|
||||
const RBMap<StringName, TypeInterface>::Element *enum_match = enum_types.find(search_cname);
|
||||
|
||||
if (!enum_match && search_cname != p_target_cname) {
|
||||
enum_match = enum_types.find(p_target_cname);
|
||||
@ -1747,7 +1747,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
|
||||
return OK; // Won't increment method bind count
|
||||
}
|
||||
|
||||
const Map<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&p_imethod);
|
||||
const RBMap<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&p_imethod);
|
||||
ERR_FAIL_NULL_V(match, ERR_BUG);
|
||||
|
||||
const InternalCall *im_icall = match->value();
|
||||
@ -2011,7 +2011,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
|
||||
i++;
|
||||
}
|
||||
|
||||
const Map<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&p_imethod);
|
||||
const RBMap<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&p_imethod);
|
||||
ERR_FAIL_NULL_V(match, ERR_BUG);
|
||||
|
||||
const InternalCall *im_icall = match->value();
|
||||
@ -2147,7 +2147,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
|
||||
}
|
||||
|
||||
const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_null(const TypeReference &p_typeref) {
|
||||
const Map<StringName, TypeInterface>::Element *builtin_type_match = builtin_types.find(p_typeref.cname);
|
||||
const RBMap<StringName, TypeInterface>::Element *builtin_type_match = builtin_types.find(p_typeref.cname);
|
||||
|
||||
if (builtin_type_match)
|
||||
return &builtin_type_match->get();
|
||||
@ -2158,13 +2158,13 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_null(con
|
||||
return &obj_type_match.get();
|
||||
|
||||
if (p_typeref.is_enum) {
|
||||
const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(p_typeref.cname);
|
||||
const RBMap<StringName, TypeInterface>::Element *enum_match = enum_types.find(p_typeref.cname);
|
||||
|
||||
if (enum_match)
|
||||
return &enum_match->get();
|
||||
|
||||
// Enum not found. Most likely because none of its constants were bound, so it's empty. That's fine. Use int instead.
|
||||
const Map<StringName, TypeInterface>::Element *int_match = builtin_types.find(name_cache.type_int);
|
||||
const RBMap<StringName, TypeInterface>::Element *int_match = builtin_types.find(name_cache.type_int);
|
||||
ERR_FAIL_NULL_V(int_match, NULL);
|
||||
return &int_match->get();
|
||||
}
|
||||
@ -2180,7 +2180,7 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placehol
|
||||
|
||||
ERR_PRINT(String() + "Type not found. Creating placeholder: '" + p_typeref.cname.operator String() + "'.");
|
||||
|
||||
const Map<StringName, TypeInterface>::Element *match = placeholder_types.find(p_typeref.cname);
|
||||
const RBMap<StringName, TypeInterface>::Element *match = placeholder_types.find(p_typeref.cname);
|
||||
|
||||
if (match)
|
||||
return &match->get();
|
||||
@ -2191,30 +2191,30 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placehol
|
||||
return &placeholder_types.insert(placeholder.cname, placeholder)->get();
|
||||
}
|
||||
|
||||
StringName BindingsGenerator::_get_int_type_name_from_meta(GodotTypeInfo::Metadata p_meta) {
|
||||
StringName BindingsGenerator::_get_int_type_name_from_meta(PandemoniumTypeInfo::Metadata p_meta) {
|
||||
switch (p_meta) {
|
||||
case GodotTypeInfo::METADATA_INT_IS_INT8:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_INT8:
|
||||
return "sbyte";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_INT16:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_INT16:
|
||||
return "short";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_INT32:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_INT32:
|
||||
return "int";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_INT64:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_INT64:
|
||||
return "long";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_UINT8:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_UINT8:
|
||||
return "byte";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_UINT16:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_UINT16:
|
||||
return "ushort";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_UINT32:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_UINT32:
|
||||
return "uint";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_INT_IS_UINT64:
|
||||
case PandemoniumTypeInfo::METADATA_INT_IS_UINT64:
|
||||
return "ulong";
|
||||
break;
|
||||
default:
|
||||
@ -2223,12 +2223,12 @@ StringName BindingsGenerator::_get_int_type_name_from_meta(GodotTypeInfo::Metada
|
||||
}
|
||||
}
|
||||
|
||||
StringName BindingsGenerator::_get_float_type_name_from_meta(GodotTypeInfo::Metadata p_meta) {
|
||||
StringName BindingsGenerator::_get_float_type_name_from_meta(PandemoniumTypeInfo::Metadata p_meta) {
|
||||
switch (p_meta) {
|
||||
case GodotTypeInfo::METADATA_REAL_IS_FLOAT:
|
||||
case PandemoniumTypeInfo::METADATA_REAL_IS_FLOAT:
|
||||
return "float";
|
||||
break;
|
||||
case GodotTypeInfo::METADATA_REAL_IS_DOUBLE:
|
||||
case PandemoniumTypeInfo::METADATA_REAL_IS_DOUBLE:
|
||||
return "double";
|
||||
break;
|
||||
default:
|
||||
@ -2298,7 +2298,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
||||
List<PropertyInfo> property_list;
|
||||
ClassDB::get_property_list(type_cname, &property_list, true);
|
||||
|
||||
Map<StringName, StringName> accessor_methods;
|
||||
RBMap<StringName, StringName> accessor_methods;
|
||||
|
||||
for (const List<PropertyInfo>::Element *E = property_list.front(); E; E = E->next()) {
|
||||
const PropertyInfo &property = E->get();
|
||||
@ -2423,9 +2423,9 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
||||
imethod.return_type.cname = name_cache.type_void;
|
||||
} else {
|
||||
if (return_info.type == Variant::INT) {
|
||||
imethod.return_type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE);
|
||||
imethod.return_type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(-1) : PandemoniumTypeInfo::METADATA_NONE);
|
||||
} else if (return_info.type == Variant::REAL) {
|
||||
imethod.return_type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE);
|
||||
imethod.return_type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(-1) : PandemoniumTypeInfo::METADATA_NONE);
|
||||
} else {
|
||||
imethod.return_type.cname = Variant::get_type_name(return_info.type);
|
||||
}
|
||||
@ -2450,9 +2450,9 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
||||
iarg.type.cname = name_cache.type_Variant;
|
||||
} else {
|
||||
if (arginfo.type == Variant::INT) {
|
||||
iarg.type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE);
|
||||
iarg.type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(i) : PandemoniumTypeInfo::METADATA_NONE);
|
||||
} else if (arginfo.type == Variant::REAL) {
|
||||
iarg.type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE);
|
||||
iarg.type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(i) : PandemoniumTypeInfo::METADATA_NONE);
|
||||
} else {
|
||||
iarg.type.cname = Variant::get_type_name(arginfo.type);
|
||||
}
|
||||
@ -2486,7 +2486,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
||||
imethod.proxy_name += "_";
|
||||
}
|
||||
|
||||
Map<StringName, StringName>::Element *accessor = accessor_methods.find(imethod.cname);
|
||||
RBMap<StringName, StringName>::Element *accessor = accessor_methods.find(imethod.cname);
|
||||
if (accessor) {
|
||||
const PropertyInterface *accessor_property = itype.find_property_by_name(accessor->value());
|
||||
|
||||
@ -2673,7 +2673,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
|
||||
r_iarg.default_argument = "new %s()";
|
||||
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
|
||||
break;
|
||||
case Variant::_RID:
|
||||
case Variant::RID:
|
||||
ERR_FAIL_COND_V_MSG(r_iarg.type.cname != name_cache.type_RID, false,
|
||||
"Parameter of type '" + String(r_iarg.type.cname) + "' cannot have a default value of type '" + String(name_cache.type_RID) + "'.");
|
||||
|
||||
@ -2701,7 +2701,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
|
||||
if (transform == Transform2D()) {
|
||||
r_iarg.default_argument = "Transform2D.Identity";
|
||||
} else {
|
||||
r_iarg.default_argument = "new Transform2D(new Vector2" + transform.elements[0].operator String() + ", new Vector2" + transform.elements[1].operator String() + ", new Vector2" + transform.elements[2].operator String() + ")";
|
||||
r_iarg.default_argument = "new Transform2D(new Vector2" + transform.columns[0].operator String() + ", new Vector2" + transform.columns[1].operator String() + ", new Vector2" + transform.columns[2].operator String() + ")";
|
||||
}
|
||||
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
|
||||
} break;
|
||||
@ -2724,12 +2724,12 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
|
||||
}
|
||||
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
|
||||
} break;
|
||||
case Variant::QUAT: {
|
||||
Quat quat = p_val.operator Quat();
|
||||
if (quat == Quat()) {
|
||||
r_iarg.default_argument = "Quat.Identity";
|
||||
case Variant::QUATERNION: {
|
||||
Quaternion quat = p_val.operator Quaternion();
|
||||
if (quat == Quaternion()) {
|
||||
r_iarg.default_argument = "Quaternion.Identity";
|
||||
} else {
|
||||
r_iarg.default_argument = "new Quat" + quat.operator String();
|
||||
r_iarg.default_argument = "new Quaternion" + quat.operator String();
|
||||
}
|
||||
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
|
||||
} break;
|
||||
@ -2770,7 +2770,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
|
||||
INSERT_STRUCT_TYPE(Transform2D)
|
||||
INSERT_STRUCT_TYPE(Vector3)
|
||||
INSERT_STRUCT_TYPE(Basis)
|
||||
INSERT_STRUCT_TYPE(Quat)
|
||||
INSERT_STRUCT_TYPE(Quaternion)
|
||||
INSERT_STRUCT_TYPE(Transform)
|
||||
INSERT_STRUCT_TYPE(AABB)
|
||||
INSERT_STRUCT_TYPE(Color)
|
||||
@ -3027,7 +3027,7 @@ void BindingsGenerator::_populate_global_constants() {
|
||||
int global_constants_count = GlobalConstants::get_global_constant_count();
|
||||
|
||||
if (global_constants_count > 0) {
|
||||
Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@GlobalScope");
|
||||
RBMap<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@GlobalScope");
|
||||
|
||||
CRASH_COND_MSG(!match, "Could not find '@GlobalScope' in DocData.");
|
||||
|
||||
|
@ -31,14 +31,15 @@
|
||||
#ifndef BINDINGS_GENERATOR_H
|
||||
#define BINDINGS_GENERATOR_H
|
||||
|
||||
#include "core/class_db.h"
|
||||
#include "core/string_builder.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/containers/ordered_hash_map.h"
|
||||
#include "core/string/string_builder.h"
|
||||
#include "editor/doc/doc_data.h"
|
||||
#include "editor/editor_help.h"
|
||||
|
||||
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
class BindingsGenerator {
|
||||
struct ConstantInterface {
|
||||
@ -493,22 +494,22 @@ class BindingsGenerator {
|
||||
|
||||
OrderedHashMap<StringName, TypeInterface> obj_types;
|
||||
|
||||
Map<StringName, TypeInterface> placeholder_types;
|
||||
Map<StringName, TypeInterface> builtin_types;
|
||||
Map<StringName, TypeInterface> enum_types;
|
||||
RBMap<StringName, TypeInterface> placeholder_types;
|
||||
RBMap<StringName, TypeInterface> builtin_types;
|
||||
RBMap<StringName, TypeInterface> enum_types;
|
||||
|
||||
List<EnumInterface> global_enums;
|
||||
List<ConstantInterface> global_constants;
|
||||
|
||||
List<InternalCall> method_icalls;
|
||||
Map<const MethodInterface *, const InternalCall *> method_icalls_map;
|
||||
RBMap<const MethodInterface *, const InternalCall *> method_icalls_map;
|
||||
|
||||
List<const InternalCall *> generated_icall_funcs;
|
||||
|
||||
List<InternalCall> core_custom_icalls;
|
||||
List<InternalCall> editor_custom_icalls;
|
||||
|
||||
Map<StringName, List<StringName>> blacklisted_methods;
|
||||
RBMap<StringName, List<StringName>> blacklisted_methods;
|
||||
|
||||
void _initialize_blacklisted_methods();
|
||||
|
||||
@ -617,8 +618,8 @@ class BindingsGenerator {
|
||||
const TypeInterface *_get_type_or_null(const TypeReference &p_typeref);
|
||||
const TypeInterface *_get_type_or_placeholder(const TypeReference &p_typeref);
|
||||
|
||||
StringName _get_int_type_name_from_meta(GodotTypeInfo::Metadata p_meta);
|
||||
StringName _get_float_type_name_from_meta(GodotTypeInfo::Metadata p_meta);
|
||||
StringName _get_int_type_name_from_meta(PandemoniumTypeInfo::Metadata p_meta);
|
||||
StringName _get_float_type_name_from_meta(PandemoniumTypeInfo::Metadata p_meta);
|
||||
|
||||
bool _arg_default_value_from_variant(const Variant &p_val, ArgumentInterface &r_iarg);
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "code_completion.h"
|
||||
|
||||
#include "core/project_settings.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "editor/editor_file_system.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "scene/gui/control.h"
|
||||
|
@ -31,8 +31,8 @@
|
||||
#ifndef CODE_COMPLETION_H
|
||||
#define CODE_COMPLETION_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/variant.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
namespace gdmono {
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#include "../csharp_script.h"
|
||||
#include "../mono_gd/gd_mono_class.h"
|
||||
|
@ -31,7 +31,7 @@
|
||||
#ifndef CSHARP_PROJECT_H
|
||||
#define CSHARP_PROJECT_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
namespace CSharpProject {
|
||||
|
||||
|
@ -38,9 +38,12 @@
|
||||
#include "core/version.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/plugins/script_editor_plugin.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/script_editor_debugger.h"
|
||||
#include "editor_code_editor/script_editor_plugin.h"
|
||||
#include "editor_code_editor/editor_script_editor.h"
|
||||
#include "main/main.h"
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#include "../csharp_script.h"
|
||||
#include "../glue/cs_glue_version.gen.h"
|
||||
@ -285,16 +288,16 @@ void godot_icall_Internal_ReloadAssemblies(MonoBoolean p_soft_reload) {
|
||||
}
|
||||
|
||||
void godot_icall_Internal_ScriptEditorDebuggerReloadScripts() {
|
||||
ScriptEditor::get_singleton()->get_debugger()->reload_scripts();
|
||||
EditorScriptEditor::get_singleton()->get_debugger()->reload_scripts();
|
||||
}
|
||||
|
||||
MonoBoolean godot_icall_Internal_ScriptEditorEdit(MonoObject *p_resource, int32_t p_line, int32_t p_col, MonoBoolean p_grab_focus) {
|
||||
Ref<Resource> resource = GDMonoMarshal::mono_object_to_variant(p_resource);
|
||||
return (MonoBoolean)ScriptEditor::get_singleton()->edit(resource, p_line, p_col, (bool)p_grab_focus);
|
||||
return (MonoBoolean)EditorScriptEditor::get_singleton()->edit(resource, p_line, p_col, (bool)p_grab_focus);
|
||||
}
|
||||
|
||||
void godot_icall_Internal_EditorNodeShowScriptScreen() {
|
||||
EditorNode::get_singleton()->call("_editor_select", EditorNode::EDITOR_SCRIPT);
|
||||
EditorNode::get_singleton()->call("_editor_select", 2);
|
||||
}
|
||||
|
||||
MonoObject *godot_icall_Internal_GetScriptsMetadataOrNothing(MonoReflectionType *p_dict_reftype) {
|
||||
@ -327,7 +330,7 @@ void godot_icall_Internal_EditorRunStop() {
|
||||
}
|
||||
|
||||
void godot_icall_Internal_ScriptEditorDebugger_ReloadScripts() {
|
||||
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
|
||||
EditorScriptEditorDebugger *sed = EditorScriptEditor::get_singleton()->get_debugger();
|
||||
if (sed) {
|
||||
sed->reload_scripts();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "core/io/file_access_pack.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#include "../mono_gd/gd_mono.h"
|
||||
#include "../mono_gd/gd_mono_assembly.h"
|
||||
|
@ -31,9 +31,9 @@
|
||||
#ifndef GODOTSHARP_EXPORT_H
|
||||
#define GODOTSHARP_EXPORT_H
|
||||
|
||||
#include "core/dictionary.h"
|
||||
#include "core/error_list.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/variant/dictionary.h"
|
||||
#include "core/error/error_list.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "../mono_gd/gd_mono_header.h"
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "script_class_parser.h"
|
||||
|
||||
#include "core/map.h"
|
||||
#include "core/containers/rb_map.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include "../utils/string_utils.h"
|
||||
@ -504,7 +504,7 @@ Error ScriptClassParser::parse(const String &p_code) {
|
||||
|
||||
Token tk = get_token();
|
||||
|
||||
Map<int, NameDecl> name_stack;
|
||||
RBMap<int, NameDecl> name_stack;
|
||||
int curly_stack = 0;
|
||||
int type_curly_stack = 0;
|
||||
|
||||
@ -521,7 +521,7 @@ Error ScriptClassParser::parse(const String &p_code) {
|
||||
|
||||
ClassDecl class_decl;
|
||||
|
||||
for (Map<int, NameDecl>::Element *E = name_stack.front(); E; E = E->next()) {
|
||||
for (RBMap<int, NameDecl>::Element *E = name_stack.front(); E; E = E->next()) {
|
||||
const NameDecl &name_decl = E->value();
|
||||
|
||||
if (name_decl.type == NameDecl::NAMESPACE_DECL) {
|
||||
|
@ -31,9 +31,9 @@
|
||||
#ifndef SCRIPT_CLASS_PARSER_H
|
||||
#define SCRIPT_CLASS_PARSER_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/variant.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
#include "core/containers/vector.h"
|
||||
|
||||
class ScriptClassParser {
|
||||
public:
|
||||
|
@ -226,12 +226,12 @@ namespace Godot
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Basis"/>'s rotation in the form of a
|
||||
/// <see cref="Quat"/>. See <see cref="GetEuler"/> if you
|
||||
/// <see cref="Quaternion"/>. See <see cref="GetEuler"/> if you
|
||||
/// need Euler angles, but keep in mind quaternions should generally
|
||||
/// be preferred to Euler angles.
|
||||
/// </summary>
|
||||
/// <returns>The basis rotation.</returns>
|
||||
public Quat RotationQuat()
|
||||
public Quaternion RotationQuaternion()
|
||||
{
|
||||
Basis orthonormalizedBasis = Orthonormalized();
|
||||
real_t det = orthonormalizedBasis.Determinant();
|
||||
@ -242,16 +242,16 @@ namespace Godot
|
||||
orthonormalizedBasis = orthonormalizedBasis.Scaled(-Vector3.One);
|
||||
}
|
||||
|
||||
return orthonormalizedBasis.Quat();
|
||||
return orthonormalizedBasis.Quaternion();
|
||||
}
|
||||
|
||||
internal void SetQuatScale(Quat quaternion, Vector3 scale)
|
||||
internal void SetQuaternionScale(Quaternion quaternion, Vector3 scale)
|
||||
{
|
||||
SetDiagonal(scale);
|
||||
Rotate(quaternion);
|
||||
}
|
||||
|
||||
private void Rotate(Quat quaternion)
|
||||
private void Rotate(Quaternion quaternion)
|
||||
{
|
||||
this *= new Basis(quaternion);
|
||||
}
|
||||
@ -287,8 +287,8 @@ namespace Godot
|
||||
/// The returned vector contains the rotation angles in
|
||||
/// the format (X angle, Y angle, Z angle).
|
||||
///
|
||||
/// Consider using the <see cref="RotationQuat"/> method instead, which
|
||||
/// returns a <see cref="Godot.Quat"/> quaternion instead of Euler angles.
|
||||
/// Consider using the <see cref="RotationQuaternion"/> method instead, which
|
||||
/// returns a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Vector3"/> representing the basis rotation in Euler angles.</returns>
|
||||
public Vector3 GetEuler()
|
||||
@ -303,8 +303,8 @@ namespace Godot
|
||||
/// first Z, then X, and Y last. The returned vector contains
|
||||
/// the rotation angles in the format (X angle, Y angle, Z angle).
|
||||
///
|
||||
/// Consider using the <see cref="RotationQuat"/> method instead, which
|
||||
/// returns a <see cref="Godot.Quat"/> quaternion instead of Euler angles.
|
||||
/// Consider using the <see cref="RotationQuaternion"/> method instead, which
|
||||
/// returns a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
|
||||
/// </summary>
|
||||
/// <param name="order">The Euler order to use.</param>
|
||||
/// <returns>A <see cref="Vector3"/> representing the basis rotation in Euler angles.</returns>
|
||||
@ -772,8 +772,8 @@ namespace Godot
|
||||
/// <returns>The resulting basis matrix of the interpolation.</returns>
|
||||
public Basis Slerp(Basis target, real_t weight)
|
||||
{
|
||||
Quat from = new Quat(this);
|
||||
Quat to = new Quat(target);
|
||||
Quaternion from = new Quaternion(this);
|
||||
Quaternion to = new Quaternion(target);
|
||||
|
||||
Basis b = new Basis(from.Slerp(to, weight));
|
||||
b.Row0 *= Mathf.Lerp(Row0.Length(), target.Row0.Length(), weight);
|
||||
@ -876,8 +876,8 @@ namespace Godot
|
||||
/// See <see cref="GetEuler"/> if you need Euler angles, but keep in
|
||||
/// mind that quaternions should generally be preferred to Euler angles.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Godot.Quat"/> representing the basis's rotation.</returns>
|
||||
public Quat Quat()
|
||||
/// <returns>A <see cref="Godot.Quaternion"/> representing the basis's rotation.</returns>
|
||||
public Quaternion Quaternion()
|
||||
{
|
||||
real_t trace = Row0[0] + Row1[1] + Row2[2];
|
||||
|
||||
@ -885,7 +885,7 @@ namespace Godot
|
||||
{
|
||||
real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
|
||||
real_t inv_s = 1f / s;
|
||||
return new Quat(
|
||||
return new Quaternion(
|
||||
(Row2[1] - Row1[2]) * inv_s,
|
||||
(Row0[2] - Row2[0]) * inv_s,
|
||||
(Row1[0] - Row0[1]) * inv_s,
|
||||
@ -897,7 +897,7 @@ namespace Godot
|
||||
{
|
||||
real_t s = Mathf.Sqrt(Row0[0] - Row1[1] - Row2[2] + 1.0f) * 2f;
|
||||
real_t inv_s = 1f / s;
|
||||
return new Quat(
|
||||
return new Quaternion(
|
||||
s * 0.25f,
|
||||
(Row0[1] + Row1[0]) * inv_s,
|
||||
(Row0[2] + Row2[0]) * inv_s,
|
||||
@ -909,7 +909,7 @@ namespace Godot
|
||||
{
|
||||
real_t s = Mathf.Sqrt(-Row0[0] + Row1[1] - Row2[2] + 1.0f) * 2f;
|
||||
real_t inv_s = 1f / s;
|
||||
return new Quat(
|
||||
return new Quaternion(
|
||||
(Row0[1] + Row1[0]) * inv_s,
|
||||
s * 0.25f,
|
||||
(Row1[2] + Row2[1]) * inv_s,
|
||||
@ -920,7 +920,7 @@ namespace Godot
|
||||
{
|
||||
real_t s = Mathf.Sqrt(-Row0[0] - Row1[1] + Row2[2] + 1.0f) * 2f;
|
||||
real_t inv_s = 1f / s;
|
||||
return new Quat(
|
||||
return new Quaternion(
|
||||
(Row0[2] + Row2[0]) * inv_s,
|
||||
(Row1[2] + Row2[1]) * inv_s,
|
||||
s * 0.25f,
|
||||
@ -988,7 +988,7 @@ namespace Godot
|
||||
/// Constructs a pure rotation basis matrix from the given quaternion.
|
||||
/// </summary>
|
||||
/// <param name="quaternion">The quaternion to create the basis from.</param>
|
||||
public Basis(Quat quaternion)
|
||||
public Basis(Quaternion quaternion)
|
||||
{
|
||||
real_t s = 2.0f / quaternion.LengthSquared;
|
||||
|
||||
@ -1015,8 +1015,8 @@ namespace Godot
|
||||
/// (in the YXZ convention: when *composing*, first Y, then X, and Z last),
|
||||
/// given in the vector format as (X angle, Y angle, Z angle).
|
||||
///
|
||||
/// Consider using the <see cref="Basis(Quat)"/> constructor instead, which
|
||||
/// uses a <see cref="Godot.Quat"/> quaternion instead of Euler angles.
|
||||
/// Consider using the <see cref="Basis(Quaternion)"/> constructor instead, which
|
||||
/// uses a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
|
||||
/// </summary>
|
||||
/// <param name="eulerYXZ">The Euler angles to create the basis from.</param>
|
||||
public Basis(Vector3 eulerYXZ)
|
||||
|
@ -10,12 +10,12 @@ namespace Godot
|
||||
{
|
||||
/// <summary>
|
||||
/// A unit quaternion used for representing 3D rotations.
|
||||
/// Quaternions need to be normalized to be used for rotation.
|
||||
/// Quaternionernions need to be normalized to be used for rotation.
|
||||
///
|
||||
/// It is similar to <see cref="Basis"/>, which implements matrix
|
||||
/// representation of rotations, and can be parametrized using both
|
||||
/// an axis-angle pair or Euler angles. Basis stores rotation, scale,
|
||||
/// and shearing, while Quat only stores rotation.
|
||||
/// and shearing, while Quaternion only stores rotation.
|
||||
///
|
||||
/// Due to its compactness and the way it is stored in memory, certain
|
||||
/// operations (obtaining axis-angle and performing SLERP, in particular)
|
||||
@ -23,29 +23,29 @@ namespace Godot
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Quat : IEquatable<Quat>
|
||||
public struct Quaternion : IEquatable<Quaternion>
|
||||
{
|
||||
/// <summary>
|
||||
/// X component of the quaternion (imaginary <c>i</c> axis part).
|
||||
/// Quaternion components should usually not be manipulated directly.
|
||||
/// Quaternionernion components should usually not be manipulated directly.
|
||||
/// </summary>
|
||||
public real_t x;
|
||||
|
||||
/// <summary>
|
||||
/// Y component of the quaternion (imaginary <c>j</c> axis part).
|
||||
/// Quaternion components should usually not be manipulated directly.
|
||||
/// Quaternionernion components should usually not be manipulated directly.
|
||||
/// </summary>
|
||||
public real_t y;
|
||||
|
||||
/// <summary>
|
||||
/// Z component of the quaternion (imaginary <c>k</c> axis part).
|
||||
/// Quaternion components should usually not be manipulated directly.
|
||||
/// Quaternionernion components should usually not be manipulated directly.
|
||||
/// </summary>
|
||||
public real_t z;
|
||||
|
||||
/// <summary>
|
||||
/// W component of the quaternion (real part).
|
||||
/// Quaternion components should usually not be manipulated directly.
|
||||
/// Quaternionernion components should usually not be manipulated directly.
|
||||
/// </summary>
|
||||
public real_t w;
|
||||
|
||||
@ -130,7 +130,7 @@ namespace Godot
|
||||
/// </summary>
|
||||
/// <param name="to">The other quaternion.</param>
|
||||
/// <returns>The angle between the quaternions.</returns>
|
||||
public real_t AngleTo(Quat to)
|
||||
public real_t AngleTo(Quaternion to)
|
||||
{
|
||||
real_t dot = Dot(to);
|
||||
return Mathf.Acos(Mathf.Clamp(dot * dot * 2 - 1, -1, 1));
|
||||
@ -145,11 +145,11 @@ namespace Godot
|
||||
/// <param name="postB">A quaternion after <paramref name="b"/>.</param>
|
||||
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
|
||||
/// <returns>The interpolated quaternion.</returns>
|
||||
public Quat CubicSlerp(Quat b, Quat preA, Quat postB, real_t weight)
|
||||
public Quaternion CubicSlerp(Quaternion b, Quaternion preA, Quaternion postB, real_t weight)
|
||||
{
|
||||
real_t t2 = (1.0f - weight) * weight * 2f;
|
||||
Quat sp = Slerp(b, weight);
|
||||
Quat sq = preA.Slerpni(postB, weight);
|
||||
Quaternion sp = Slerp(b, weight);
|
||||
Quaternion sq = preA.Slerpni(postB, weight);
|
||||
return sp.Slerpni(sq, t2);
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ namespace Godot
|
||||
/// </summary>
|
||||
/// <param name="b">The other quaternion.</param>
|
||||
/// <returns>The dot product.</returns>
|
||||
public real_t Dot(Quat b)
|
||||
public real_t Dot(Quaternion b)
|
||||
{
|
||||
return (x * b.x) + (y * b.y) + (z * b.z) + (w * b.w);
|
||||
}
|
||||
@ -175,7 +175,7 @@ namespace Godot
|
||||
#if DEBUG
|
||||
if (!IsNormalized())
|
||||
{
|
||||
throw new InvalidOperationException("Quat is not normalized");
|
||||
throw new InvalidOperationException("Quaternion is not normalized");
|
||||
}
|
||||
#endif
|
||||
var basis = new Basis(this);
|
||||
@ -186,15 +186,15 @@ namespace Godot
|
||||
/// Returns the inverse of the quaternion.
|
||||
/// </summary>
|
||||
/// <returns>The inverse quaternion.</returns>
|
||||
public Quat Inverse()
|
||||
public Quaternion Inverse()
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsNormalized())
|
||||
{
|
||||
throw new InvalidOperationException("Quat is not normalized");
|
||||
throw new InvalidOperationException("Quaternion is not normalized");
|
||||
}
|
||||
#endif
|
||||
return new Quat(-x, -y, -z, w);
|
||||
return new Quaternion(-x, -y, -z, w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -210,12 +210,12 @@ namespace Godot
|
||||
/// Returns a copy of the quaternion, normalized to unit length.
|
||||
/// </summary>
|
||||
/// <returns>The normalized quaternion.</returns>
|
||||
public Quat Normalized()
|
||||
public Quaternion Normalized()
|
||||
{
|
||||
return this / Length;
|
||||
}
|
||||
|
||||
[Obsolete("Set is deprecated. Use the Quat(" + nameof(real_t) + ", " + nameof(real_t) + ", " + nameof(real_t) + ", " + nameof(real_t) + ") constructor instead.", error: true)]
|
||||
[Obsolete("Set is deprecated. Use the Quaternion(" + nameof(real_t) + ", " + nameof(real_t) + ", " + nameof(real_t) + ", " + nameof(real_t) + ") constructor instead.", error: true)]
|
||||
public void Set(real_t x, real_t y, real_t z, real_t w)
|
||||
{
|
||||
this.x = x;
|
||||
@ -224,22 +224,22 @@ namespace Godot
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
[Obsolete("Set is deprecated. Use the Quat(" + nameof(Quat) + ") constructor instead.", error: true)]
|
||||
public void Set(Quat q)
|
||||
[Obsolete("Set is deprecated. Use the Quaternion(" + nameof(Quaternion) + ") constructor instead.", error: true)]
|
||||
public void Set(Quaternion q)
|
||||
{
|
||||
this = q;
|
||||
}
|
||||
|
||||
[Obsolete("SetAxisAngle is deprecated. Use the Quat(" + nameof(Vector3) + ", " + nameof(real_t) + ") constructor instead.", error: true)]
|
||||
[Obsolete("SetAxisAngle is deprecated. Use the Quaternion(" + nameof(Vector3) + ", " + nameof(real_t) + ") constructor instead.", error: true)]
|
||||
public void SetAxisAngle(Vector3 axis, real_t angle)
|
||||
{
|
||||
this = new Quat(axis, angle);
|
||||
this = new Quaternion(axis, angle);
|
||||
}
|
||||
|
||||
[Obsolete("SetEuler is deprecated. Use the Quat(" + nameof(Vector3) + ") constructor instead.", error: true)]
|
||||
[Obsolete("SetEuler is deprecated. Use the Quaternion(" + nameof(Vector3) + ") constructor instead.", error: true)]
|
||||
public void SetEuler(Vector3 eulerYXZ)
|
||||
{
|
||||
this = new Quat(eulerYXZ);
|
||||
this = new Quaternion(eulerYXZ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -251,12 +251,12 @@ namespace Godot
|
||||
/// <param name="to">The destination quaternion for interpolation. Must be normalized.</param>
|
||||
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
|
||||
/// <returns>The resulting quaternion of the interpolation.</returns>
|
||||
public Quat Slerp(Quat to, real_t weight)
|
||||
public Quaternion Slerp(Quaternion to, real_t weight)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsNormalized())
|
||||
{
|
||||
throw new InvalidOperationException("Quat is not normalized");
|
||||
throw new InvalidOperationException("Quaternion is not normalized");
|
||||
}
|
||||
if (!to.IsNormalized())
|
||||
{
|
||||
@ -267,7 +267,7 @@ namespace Godot
|
||||
// Calculate cosine.
|
||||
real_t cosom = x * to.x + y * to.y + z * to.z + w * to.w;
|
||||
|
||||
var to1 = new Quat();
|
||||
var to1 = new Quaternion();
|
||||
|
||||
// Adjust signs if necessary.
|
||||
if (cosom < 0.0)
|
||||
@ -299,13 +299,13 @@ namespace Godot
|
||||
}
|
||||
else
|
||||
{
|
||||
// Quaternions are very close so we can do a linear interpolation.
|
||||
// Quaternionernions are very close so we can do a linear interpolation.
|
||||
scale0 = 1.0f - weight;
|
||||
scale1 = weight;
|
||||
}
|
||||
|
||||
// Calculate final values.
|
||||
return new Quat
|
||||
return new Quaternion
|
||||
(
|
||||
(scale0 * x) + (scale1 * to1.x),
|
||||
(scale0 * y) + (scale1 * to1.y),
|
||||
@ -322,7 +322,7 @@ namespace Godot
|
||||
/// <param name="to">The destination quaternion for interpolation. Must be normalized.</param>
|
||||
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
|
||||
/// <returns>The resulting quaternion of the interpolation.</returns>
|
||||
public Quat Slerpni(Quat to, real_t weight)
|
||||
public Quaternion Slerpni(Quaternion to, real_t weight)
|
||||
{
|
||||
real_t dot = Dot(to);
|
||||
|
||||
@ -336,7 +336,7 @@ namespace Godot
|
||||
real_t newFactor = Mathf.Sin(weight * theta) * sinT;
|
||||
real_t invFactor = Mathf.Sin((1.0f - weight) * theta) * sinT;
|
||||
|
||||
return new Quat
|
||||
return new Quaternion
|
||||
(
|
||||
(invFactor * x) + (newFactor * to.x),
|
||||
(invFactor * y) + (newFactor * to.y),
|
||||
@ -355,7 +355,7 @@ namespace Godot
|
||||
#if DEBUG
|
||||
if (!IsNormalized())
|
||||
{
|
||||
throw new InvalidOperationException("Quat is not normalized");
|
||||
throw new InvalidOperationException("Quaternion is not normalized");
|
||||
}
|
||||
#endif
|
||||
var u = new Vector3(x, y, z);
|
||||
@ -364,24 +364,24 @@ namespace Godot
|
||||
}
|
||||
|
||||
// Constants
|
||||
private static readonly Quat _identity = new Quat(0, 0, 0, 1);
|
||||
private static readonly Quaternion _identity = new Quaternion(0, 0, 0, 1);
|
||||
|
||||
/// <summary>
|
||||
/// The identity quaternion, representing no rotation.
|
||||
/// Equivalent to an identity <see cref="Basis"/> matrix. If a vector is transformed by
|
||||
/// an identity quaternion, it will not change.
|
||||
/// </summary>
|
||||
/// <value>Equivalent to <c>new Quat(0, 0, 0, 1)</c>.</value>
|
||||
public static Quat Identity { get { return _identity; } }
|
||||
/// <value>Equivalent to <c>new Quaternion(0, 0, 0, 1)</c>.</value>
|
||||
public static Quaternion Identity { get { return _identity; } }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a <see cref="Quat"/> defined by the given values.
|
||||
/// Constructs a <see cref="Quaternion"/> defined by the given values.
|
||||
/// </summary>
|
||||
/// <param name="x">X component of the quaternion (imaginary <c>i</c> axis part).</param>
|
||||
/// <param name="y">Y component of the quaternion (imaginary <c>j</c> axis part).</param>
|
||||
/// <param name="z">Z component of the quaternion (imaginary <c>k</c> axis part).</param>
|
||||
/// <param name="w">W component of the quaternion (real part).</param>
|
||||
public Quat(real_t x, real_t y, real_t z, real_t w)
|
||||
public Quaternion(real_t x, real_t y, real_t z, real_t w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@ -390,30 +390,30 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a <see cref="Quat"/> from the given <see cref="Quat"/>.
|
||||
/// Constructs a <see cref="Quaternion"/> from the given <see cref="Quaternion"/>.
|
||||
/// </summary>
|
||||
/// <param name="q">The existing quaternion.</param>
|
||||
public Quat(Quat q)
|
||||
public Quaternion(Quaternion q)
|
||||
{
|
||||
this = q;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a <see cref="Quat"/> from the given <see cref="Basis"/>.
|
||||
/// Constructs a <see cref="Quaternion"/> from the given <see cref="Basis"/>.
|
||||
/// </summary>
|
||||
/// <param name="basis">The <see cref="Basis"/> to construct from.</param>
|
||||
public Quat(Basis basis)
|
||||
public Quaternion(Basis basis)
|
||||
{
|
||||
this = basis.Quat();
|
||||
this = basis.Quaternion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a <see cref="Quat"/> that will perform a rotation specified by
|
||||
/// Constructs a <see cref="Quaternion"/> that will perform a rotation specified by
|
||||
/// Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last),
|
||||
/// given in the vector format as (X angle, Y angle, Z angle).
|
||||
/// </summary>
|
||||
/// <param name="eulerYXZ">Euler angles that the quaternion will be rotated by.</param>
|
||||
public Quat(Vector3 eulerYXZ)
|
||||
public Quaternion(Vector3 eulerYXZ)
|
||||
{
|
||||
real_t halfA1 = eulerYXZ.y * 0.5f;
|
||||
real_t halfA2 = eulerYXZ.x * 0.5f;
|
||||
@ -437,12 +437,12 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a <see cref="Quat"/> that will rotate around the given axis
|
||||
/// Constructs a <see cref="Quaternion"/> that will rotate around the given axis
|
||||
/// by the specified angle. The axis must be a normalized vector.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis to rotate around. Must be normalized.</param>
|
||||
/// <param name="angle">The angle to rotate, in radians.</param>
|
||||
public Quat(Vector3 axis, real_t angle)
|
||||
public Quaternion(Vector3 axis, real_t angle)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!axis.IsNormalized())
|
||||
@ -481,9 +481,9 @@ namespace Godot
|
||||
/// <param name="left">The parent quaternion.</param>
|
||||
/// <param name="right">The child quaternion.</param>
|
||||
/// <returns>The composed quaternion.</returns>
|
||||
public static Quat operator *(Quat left, Quat right)
|
||||
public static Quaternion operator *(Quaternion left, Quaternion right)
|
||||
{
|
||||
return new Quat
|
||||
return new Quaternion
|
||||
(
|
||||
(left.w * right.x) + (left.x * right.w) + (left.y * right.z) - (left.z * right.y),
|
||||
(left.w * right.y) + (left.y * right.w) + (left.z * right.x) - (left.x * right.z),
|
||||
@ -493,8 +493,8 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds each component of the left <see cref="Quat"/>
|
||||
/// to the right <see cref="Quat"/>. This operation is not
|
||||
/// Adds each component of the left <see cref="Quaternion"/>
|
||||
/// to the right <see cref="Quaternion"/>. This operation is not
|
||||
/// meaningful on its own, but it can be used as a part of a
|
||||
/// larger expression, such as approximating an intermediate
|
||||
/// rotation between two nearby rotations.
|
||||
@ -502,42 +502,42 @@ namespace Godot
|
||||
/// <param name="left">The left quaternion to add.</param>
|
||||
/// <param name="right">The right quaternion to add.</param>
|
||||
/// <returns>The added quaternion.</returns>
|
||||
public static Quat operator +(Quat left, Quat right)
|
||||
public static Quaternion operator +(Quaternion left, Quaternion right)
|
||||
{
|
||||
return new Quat(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
|
||||
return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts each component of the left <see cref="Quat"/>
|
||||
/// by the right <see cref="Quat"/>. This operation is not
|
||||
/// Subtracts each component of the left <see cref="Quaternion"/>
|
||||
/// by the right <see cref="Quaternion"/>. This operation is not
|
||||
/// meaningful on its own, but it can be used as a part of a
|
||||
/// larger expression.
|
||||
/// </summary>
|
||||
/// <param name="left">The left quaternion to subtract.</param>
|
||||
/// <param name="right">The right quaternion to subtract.</param>
|
||||
/// <returns>The subtracted quaternion.</returns>
|
||||
public static Quat operator -(Quat left, Quat right)
|
||||
public static Quaternion operator -(Quaternion left, Quaternion right)
|
||||
{
|
||||
return new Quat(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
|
||||
return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the negative value of the <see cref="Quat"/>.
|
||||
/// Returns the negative value of the <see cref="Quaternion"/>.
|
||||
/// This is the same as writing
|
||||
/// <c>new Quat(-q.x, -q.y, -q.z, -q.w)</c>. This operation
|
||||
/// <c>new Quaternion(-q.x, -q.y, -q.z, -q.w)</c>. This operation
|
||||
/// results in a quaternion that represents the same rotation.
|
||||
/// </summary>
|
||||
/// <param name="quat">The quaternion to negate.</param>
|
||||
/// <returns>The negated quaternion.</returns>
|
||||
public static Quat operator -(Quat quat)
|
||||
public static Quaternion operator -(Quaternion quat)
|
||||
{
|
||||
return new Quat(-quat.x, -quat.y, -quat.z, -quat.w);
|
||||
return new Quaternion(-quat.x, -quat.y, -quat.z, -quat.w);
|
||||
}
|
||||
|
||||
[Obsolete("This operator does not have the correct behavior and will be replaced in the future. Do not use this.")]
|
||||
public static Quat operator *(Quat left, Vector3 right)
|
||||
public static Quaternion operator *(Quaternion left, Vector3 right)
|
||||
{
|
||||
return new Quat
|
||||
return new Quaternion
|
||||
(
|
||||
(left.w * right.x) + (left.y * right.z) - (left.z * right.y),
|
||||
(left.w * right.y) + (left.z * right.x) - (left.x * right.z),
|
||||
@ -547,9 +547,9 @@ namespace Godot
|
||||
}
|
||||
|
||||
[Obsolete("This operator does not have the correct behavior and will be replaced in the future. Do not use this.")]
|
||||
public static Quat operator *(Vector3 left, Quat right)
|
||||
public static Quaternion operator *(Vector3 left, Quaternion right)
|
||||
{
|
||||
return new Quat
|
||||
return new Quaternion
|
||||
(
|
||||
(right.w * left.x) + (right.y * left.z) - (right.z * left.y),
|
||||
(right.w * left.y) + (right.z * left.x) - (right.x * left.z),
|
||||
@ -559,7 +559,7 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies each component of the <see cref="Quat"/>
|
||||
/// Multiplies each component of the <see cref="Quaternion"/>
|
||||
/// by the given <see cref="real_t"/>. This operation is not
|
||||
/// meaningful on its own, but it can be used as a part of a
|
||||
/// larger expression.
|
||||
@ -567,13 +567,13 @@ namespace Godot
|
||||
/// <param name="left">The quaternion to multiply.</param>
|
||||
/// <param name="right">The value to multiply by.</param>
|
||||
/// <returns>The multiplied quaternion.</returns>
|
||||
public static Quat operator *(Quat left, real_t right)
|
||||
public static Quaternion operator *(Quaternion left, real_t right)
|
||||
{
|
||||
return new Quat(left.x * right, left.y * right, left.z * right, left.w * right);
|
||||
return new Quaternion(left.x * right, left.y * right, left.z * right, left.w * right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies each component of the <see cref="Quat"/>
|
||||
/// Multiplies each component of the <see cref="Quaternion"/>
|
||||
/// by the given <see cref="real_t"/>. This operation is not
|
||||
/// meaningful on its own, but it can be used as a part of a
|
||||
/// larger expression.
|
||||
@ -581,13 +581,13 @@ namespace Godot
|
||||
/// <param name="left">The value to multiply by.</param>
|
||||
/// <param name="right">The quaternion to multiply.</param>
|
||||
/// <returns>The multiplied quaternion.</returns>
|
||||
public static Quat operator *(real_t left, Quat right)
|
||||
public static Quaternion operator *(real_t left, Quaternion right)
|
||||
{
|
||||
return new Quat(right.x * left, right.y * left, right.z * left, right.w * left);
|
||||
return new Quaternion(right.x * left, right.y * left, right.z * left, right.w * left);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Divides each component of the <see cref="Quat"/>
|
||||
/// Divides each component of the <see cref="Quaternion"/>
|
||||
/// by the given <see cref="real_t"/>. This operation is not
|
||||
/// meaningful on its own, but it can be used as a part of a
|
||||
/// larger expression.
|
||||
@ -595,7 +595,7 @@ namespace Godot
|
||||
/// <param name="left">The quaternion to divide.</param>
|
||||
/// <param name="right">The value to divide by.</param>
|
||||
/// <returns>The divided quaternion.</returns>
|
||||
public static Quat operator /(Quat left, real_t right)
|
||||
public static Quaternion operator /(Quaternion left, real_t right)
|
||||
{
|
||||
return left * (1.0f / right);
|
||||
}
|
||||
@ -608,7 +608,7 @@ namespace Godot
|
||||
/// <param name="left">The left quaternion.</param>
|
||||
/// <param name="right">The right quaternion.</param>
|
||||
/// <returns>Whether or not the quaternions are exactly equal.</returns>
|
||||
public static bool operator ==(Quat left, Quat right)
|
||||
public static bool operator ==(Quaternion left, Quaternion right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
@ -621,7 +621,7 @@ namespace Godot
|
||||
/// <param name="left">The left quaternion.</param>
|
||||
/// <param name="right">The right quaternion.</param>
|
||||
/// <returns>Whether or not the quaternions are not equal.</returns>
|
||||
public static bool operator !=(Quat left, Quat right)
|
||||
public static bool operator !=(Quaternion left, Quaternion right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
@ -633,9 +633,9 @@ namespace Godot
|
||||
/// <returns>Whether or not the quaternion and the other object are exactly equal.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Quat)
|
||||
if (obj is Quaternion)
|
||||
{
|
||||
return Equals((Quat)obj);
|
||||
return Equals((Quaternion)obj);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -646,7 +646,7 @@ namespace Godot
|
||||
/// </summary>
|
||||
/// <param name="other">The other quaternion to compare.</param>
|
||||
/// <returns>Whether or not the quaternions are exactly equal.</returns>
|
||||
public bool Equals(Quat other)
|
||||
public bool Equals(Quaternion other)
|
||||
{
|
||||
return x == other.x && y == other.y && z == other.z && w == other.w;
|
||||
}
|
||||
@ -657,13 +657,13 @@ namespace Godot
|
||||
/// </summary>
|
||||
/// <param name="other">The other quaternion to compare.</param>
|
||||
/// <returns>Whether or not the quaternions are approximately equal.</returns>
|
||||
public bool IsEqualApprox(Quat other)
|
||||
public bool IsEqualApprox(Quaternion other)
|
||||
{
|
||||
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as the hash function for <see cref="Quat"/>.
|
||||
/// Serves as the hash function for <see cref="Quaternion"/>.
|
||||
/// </summary>
|
||||
/// <returns>A hash code for this quaternion.</returns>
|
||||
public override int GetHashCode()
|
||||
@ -672,7 +672,7 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts this <see cref="Quat"/> to a string.
|
||||
/// Converts this <see cref="Quaternion"/> to a string.
|
||||
/// </summary>
|
||||
/// <returns>A string representation of this quaternion.</returns>
|
||||
public override string ToString()
|
||||
@ -681,7 +681,7 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts this <see cref="Quat"/> to a string with the given <paramref name="format"/>.
|
||||
/// Converts this <see cref="Quaternion"/> to a string with the given <paramref name="format"/>.
|
||||
/// </summary>
|
||||
/// <returns>A string representation of this quaternion.</returns>
|
||||
public string ToString(string format)
|
@ -127,15 +127,15 @@ namespace Godot
|
||||
/* not sure if very "efficient" but good enough? */
|
||||
|
||||
Vector3 sourceScale = basis.Scale;
|
||||
Quat sourceRotation = basis.RotationQuat();
|
||||
Quaternion sourceRotation = basis.RotationQuaternion();
|
||||
Vector3 sourceLocation = origin;
|
||||
|
||||
Vector3 destinationScale = transform.basis.Scale;
|
||||
Quat destinationRotation = transform.basis.RotationQuat();
|
||||
Quaternion destinationRotation = transform.basis.RotationQuaternion();
|
||||
Vector3 destinationLocation = transform.origin;
|
||||
|
||||
var interpolated = new Transform();
|
||||
interpolated.basis.SetQuatScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.LinearInterpolate(destinationScale, weight));
|
||||
interpolated.basis.SetQuaternionScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.LinearInterpolate(destinationScale, weight));
|
||||
interpolated.origin = sourceLocation.LinearInterpolate(destinationLocation, weight);
|
||||
|
||||
return interpolated;
|
||||
@ -330,9 +330,9 @@ namespace Godot
|
||||
/// Constructs a transformation matrix from the given <paramref name="quaternion"/>
|
||||
/// and <paramref name="origin"/> vector.
|
||||
/// </summary>
|
||||
/// <param name="quaternion">The <see cref="Quat"/> to create the basis from.</param>
|
||||
/// <param name="quaternion">The <see cref="Quaternion"/> to create the basis from.</param>
|
||||
/// <param name="origin">The origin vector, or column index 3.</param>
|
||||
public Transform(Quat quaternion, Vector3 origin)
|
||||
public Transform(Quaternion quaternion, Vector3 origin)
|
||||
{
|
||||
basis = new Basis(quaternion);
|
||||
this.origin = origin;
|
||||
|
@ -44,7 +44,7 @@
|
||||
<Compile Include="Core\NodePath.cs" />
|
||||
<Compile Include="Core\Object.base.cs" />
|
||||
<Compile Include="Core\Plane.cs" />
|
||||
<Compile Include="Core\Quat.cs" />
|
||||
<Compile Include="Core\Quaternion.cs" />
|
||||
<Compile Include="Core\Rect2.cs" />
|
||||
<Compile Include="Core\RID.cs" />
|
||||
<Compile Include="Core\SignalAwaiter.cs" />
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#ifdef MONO_GLUE_ENABLED
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/object/reference.h"
|
||||
#include "core/string_name.h"
|
||||
|
||||
#include "../csharp_script.h"
|
||||
@ -68,7 +68,7 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
|
||||
void *data = p_ptr->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
|
||||
|
||||
if (data) {
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
if (script_binding.inited) {
|
||||
Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
|
||||
if (gchandle.is_valid()) {
|
||||
@ -115,7 +115,7 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
|
||||
void *data = ref->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
|
||||
|
||||
if (data) {
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
if (script_binding.inited) {
|
||||
Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
|
||||
if (gchandle.is_valid()) {
|
||||
|
@ -33,8 +33,8 @@
|
||||
|
||||
#ifdef MONO_GLUE_ENABLED
|
||||
|
||||
#include "core/class_db.h"
|
||||
#include "core/object.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/object.h"
|
||||
|
||||
#include "../mono_gd/gd_mono_marshal.h"
|
||||
|
||||
|
@ -35,8 +35,8 @@
|
||||
#include "core/array.h"
|
||||
#include "core/io/marshalls.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/variant.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
#include "core/variant_parser.h"
|
||||
|
||||
#include "../mono_gd/gd_mono_cache.h"
|
||||
|
@ -55,16 +55,16 @@ void godot_register_glue_header_icalls() {
|
||||
|
||||
// Used by the generated glue
|
||||
|
||||
#include "core/array.h"
|
||||
#include "core/class_db.h"
|
||||
#include "core/dictionary.h"
|
||||
#include "core/engine.h"
|
||||
#include "core/variant/array.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/variant/dictionary.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "core/method_bind.h"
|
||||
#include "core/node_path.h"
|
||||
#include "core/object.h"
|
||||
#include "core/reference.h"
|
||||
#include "core/string/node_path.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/object/reference.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "../mono_gd/gd_mono_class.h"
|
||||
#include "../mono_gd/gd_mono_internals.h"
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#ifdef MONO_GLUE_ENABLED
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
NodePath *godot_icall_NodePath_Ctor(MonoString *p_path) {
|
||||
return memnew(NodePath(GDMonoMarshal::mono_string_to_godot(p_path)));
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifdef MONO_GLUE_ENABLED
|
||||
|
||||
#include "core/object.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/rid.h"
|
||||
|
||||
#include "../mono_gd/gd_mono_marshal.h"
|
||||
|
@ -32,9 +32,9 @@
|
||||
|
||||
#ifdef MONO_GLUE_ENABLED
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/variant.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
#include "core/containers/vector.h"
|
||||
|
||||
MonoArray *godot_icall_String_md5_buffer(MonoString *p_str) {
|
||||
Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_buffer();
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "core/version.h"
|
||||
@ -75,7 +75,7 @@ String _get_mono_user_dir() {
|
||||
// contain yourself
|
||||
settings_path = exe_dir.plus_file("editor_data");
|
||||
} else {
|
||||
settings_path = OS::get_singleton()->get_data_path().plus_file(OS::get_singleton()->get_godot_dir_name());
|
||||
settings_path = OS::get_singleton()->get_data_path().plus_file(OS::get_singleton()->get_pandemonium_dir_name());
|
||||
}
|
||||
|
||||
return settings_path.plus_file("mono");
|
||||
|
@ -31,7 +31,7 @@
|
||||
#ifndef GODOTSHARP_DIRS_H
|
||||
#define GODOTSHARP_DIRS_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
namespace GodotSharpDirs {
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include <mono/jit/jit.h>
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/object/reference.h"
|
||||
|
||||
class MonoGCHandle : public Reference {
|
||||
GDCLASS(MonoGCHandle, Reference);
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
// This function is defined in an auto-generated source file
|
||||
String get_godot_android_mono_config();
|
||||
|
@ -41,7 +41,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"
|
||||
|
||||
#include "../csharp_script.h"
|
||||
#include "../godotsharp_dirs.h"
|
||||
|
@ -34,10 +34,10 @@
|
||||
#include <mono/metadata/tokentype.h>
|
||||
|
||||
#include "core/io/file_access_pack.h"
|
||||
#include "core/list.h"
|
||||
#include "core/containers/list.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#include "../godotsharp_dirs.h"
|
||||
#include "gd_mono_cache.h"
|
||||
@ -320,7 +320,7 @@ no_pdb:
|
||||
void GDMonoAssembly::unload() {
|
||||
ERR_FAIL_NULL(image); // Should not be called if already unloaded
|
||||
|
||||
for (Map<MonoClass *, GDMonoClass *>::Element *E = cached_raw.front(); E; E = E->next()) {
|
||||
for (RBMap<MonoClass *, GDMonoClass *>::Element *E = cached_raw.front(); E; E = E->next()) {
|
||||
memdelete(E->value());
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const Stri
|
||||
GDMonoClass *GDMonoAssembly::get_class(MonoClass *p_mono_class) {
|
||||
ERR_FAIL_NULL_V(image, NULL);
|
||||
|
||||
Map<MonoClass *, GDMonoClass *>::Element *match = cached_raw.find(p_mono_class);
|
||||
RBMap<MonoClass *, GDMonoClass *>::Element *match = cached_raw.find(p_mono_class);
|
||||
|
||||
if (match)
|
||||
return match->value();
|
||||
@ -381,7 +381,7 @@ GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class)
|
||||
GDMonoClass *match = NULL;
|
||||
|
||||
if (gdobject_class_cache_updated) {
|
||||
Map<StringName, GDMonoClass *>::Element *result = gdobject_class_cache.find(p_class);
|
||||
RBMap<StringName, GDMonoClass *>::Element *result = gdobject_class_cache.find(p_class);
|
||||
|
||||
if (result)
|
||||
match = result->get();
|
||||
|
@ -34,9 +34,9 @@
|
||||
#include <mono/jit/jit.h>
|
||||
#include <mono/metadata/assembly.h>
|
||||
|
||||
#include "core/hash_map.h"
|
||||
#include "core/map.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/containers/hash_map.h"
|
||||
#include "core/containers/rb_map.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "gd_mono_utils.h"
|
||||
|
||||
class GDMonoAssembly {
|
||||
@ -76,10 +76,10 @@ class GDMonoAssembly {
|
||||
#endif
|
||||
|
||||
bool gdobject_class_cache_updated;
|
||||
Map<StringName, GDMonoClass *> gdobject_class_cache;
|
||||
RBMap<StringName, GDMonoClass *> gdobject_class_cache;
|
||||
|
||||
HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes;
|
||||
Map<MonoClass *, GDMonoClass *> cached_raw;
|
||||
RBMap<MonoClass *, GDMonoClass *> cached_raw;
|
||||
|
||||
static Vector<String> search_dirs;
|
||||
|
||||
|
@ -106,7 +106,7 @@ void CachedData::clear_godot_api_cache() {
|
||||
class_Transform2D = NULL;
|
||||
class_Vector3 = NULL;
|
||||
class_Basis = NULL;
|
||||
class_Quat = NULL;
|
||||
class_Quaternion = NULL;
|
||||
class_Transform = NULL;
|
||||
class_AABB = NULL;
|
||||
class_Color = NULL;
|
||||
@ -222,7 +222,7 @@ void update_godot_api_cache() {
|
||||
CACHE_CLASS_AND_CHECK(Transform2D, GODOT_API_CLASS(Transform2D));
|
||||
CACHE_CLASS_AND_CHECK(Vector3, GODOT_API_CLASS(Vector3));
|
||||
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
|
||||
CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat));
|
||||
CACHE_CLASS_AND_CHECK(Quaternion, GODOT_API_CLASS(Quaternion));
|
||||
CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform));
|
||||
CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
|
||||
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
|
||||
|
@ -77,7 +77,7 @@ struct CachedData {
|
||||
GDMonoClass *class_Transform2D;
|
||||
GDMonoClass *class_Vector3;
|
||||
GDMonoClass *class_Basis;
|
||||
GDMonoClass *class_Quat;
|
||||
GDMonoClass *class_Quaternion;
|
||||
GDMonoClass *class_Transform;
|
||||
GDMonoClass *class_AABB;
|
||||
GDMonoClass *class_Color;
|
||||
|
@ -346,7 +346,7 @@ GDMonoMethod *GDMonoClass::get_method_with_desc(const String &p_description, boo
|
||||
}
|
||||
|
||||
GDMonoField *GDMonoClass::get_field(const StringName &p_name) {
|
||||
Map<StringName, GDMonoField *>::Element *result = fields.find(p_name);
|
||||
RBMap<StringName, GDMonoField *>::Element *result = fields.find(p_name);
|
||||
|
||||
if (result)
|
||||
return result->value();
|
||||
@ -375,7 +375,7 @@ const Vector<GDMonoField *> &GDMonoClass::get_all_fields() {
|
||||
while ((raw_field = mono_class_get_fields(mono_class, &iter)) != NULL) {
|
||||
StringName name = String::utf8(mono_field_get_name(raw_field));
|
||||
|
||||
Map<StringName, GDMonoField *>::Element *match = fields.find(name);
|
||||
RBMap<StringName, GDMonoField *>::Element *match = fields.find(name);
|
||||
|
||||
if (match) {
|
||||
fields_list.push_back(match->get());
|
||||
@ -392,7 +392,7 @@ const Vector<GDMonoField *> &GDMonoClass::get_all_fields() {
|
||||
}
|
||||
|
||||
GDMonoProperty *GDMonoClass::get_property(const StringName &p_name) {
|
||||
Map<StringName, GDMonoProperty *>::Element *result = properties.find(p_name);
|
||||
RBMap<StringName, GDMonoProperty *>::Element *result = properties.find(p_name);
|
||||
|
||||
if (result)
|
||||
return result->value();
|
||||
@ -421,7 +421,7 @@ const Vector<GDMonoProperty *> &GDMonoClass::get_all_properties() {
|
||||
while ((raw_property = mono_class_get_properties(mono_class, &iter)) != NULL) {
|
||||
StringName name = String::utf8(mono_property_get_name(raw_property));
|
||||
|
||||
Map<StringName, GDMonoProperty *>::Element *match = properties.find(name);
|
||||
RBMap<StringName, GDMonoProperty *>::Element *match = properties.find(name);
|
||||
|
||||
if (match) {
|
||||
properties_list.push_back(match->get());
|
||||
@ -457,7 +457,7 @@ const Vector<GDMonoClass *> &GDMonoClass::get_all_delegates() {
|
||||
if (mono_class_is_delegate(raw_class)) {
|
||||
StringName name = String::utf8(mono_class_get_name(raw_class));
|
||||
|
||||
Map<StringName, GDMonoClass *>::Element *match = delegates.find(name);
|
||||
RBMap<StringName, GDMonoClass *>::Element *match = delegates.find(name);
|
||||
|
||||
if (match) {
|
||||
delegates_list.push_back(match->get());
|
||||
@ -509,11 +509,11 @@ GDMonoClass::~GDMonoClass() {
|
||||
mono_custom_attrs_free(attributes);
|
||||
}
|
||||
|
||||
for (Map<StringName, GDMonoField *>::Element *E = fields.front(); E; E = E->next()) {
|
||||
for (RBMap<StringName, GDMonoField *>::Element *E = fields.front(); E; E = E->next()) {
|
||||
memdelete(E->value());
|
||||
}
|
||||
|
||||
for (Map<StringName, GDMonoProperty *>::Element *E = properties.front(); E; E = E->next()) {
|
||||
for (RBMap<StringName, GDMonoProperty *>::Element *E = properties.front(); E; E = E->next()) {
|
||||
memdelete(E->value());
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
#ifndef GD_MONO_CLASS_H
|
||||
#define GD_MONO_CLASS_H
|
||||
|
||||
#include "core/map.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/containers/rb_map.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "gd_mono_field.h"
|
||||
#include "gd_mono_header.h"
|
||||
@ -86,15 +86,15 @@ class GDMonoClass {
|
||||
Vector<GDMonoMethod *> method_list;
|
||||
|
||||
bool fields_fetched;
|
||||
Map<StringName, GDMonoField *> fields;
|
||||
RBMap<StringName, GDMonoField *> fields;
|
||||
Vector<GDMonoField *> fields_list;
|
||||
|
||||
bool properties_fetched;
|
||||
Map<StringName, GDMonoProperty *> properties;
|
||||
RBMap<StringName, GDMonoProperty *> properties;
|
||||
Vector<GDMonoProperty *> properties_list;
|
||||
|
||||
bool delegates_fetched;
|
||||
Map<StringName, GDMonoClass *> delegates;
|
||||
RBMap<StringName, GDMonoClass *> delegates;
|
||||
Vector<GDMonoClass *> delegates_list;
|
||||
|
||||
friend class GDMonoAssembly;
|
||||
|
@ -124,8 +124,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
|
||||
break;
|
||||
}
|
||||
|
||||
if (tclass == CACHED_CLASS(Quat)) {
|
||||
GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_value.operator ::Quat());
|
||||
if (tclass == CACHED_CLASS(Quaternion)) {
|
||||
GDMonoMarshal::M_Quaternion from = MARSHALLED_OUT(Quaternion, p_value.operator ::Quaternion());
|
||||
mono_field_set_value(p_object, mono_field, &from);
|
||||
break;
|
||||
}
|
||||
@ -290,8 +290,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
|
||||
GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_value.operator ::Plane());
|
||||
mono_field_set_value(p_object, mono_field, &from);
|
||||
} break;
|
||||
case Variant::QUAT: {
|
||||
GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_value.operator ::Quat());
|
||||
case Variant::QUATERNION: {
|
||||
GDMonoMarshal::M_Quaternion from = MARSHALLED_OUT(Quaternion, p_value.operator ::Quaternion());
|
||||
mono_field_set_value(p_object, mono_field, &from);
|
||||
} break;
|
||||
case Variant::AABB: {
|
||||
@ -314,8 +314,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
} break;
|
||||
case Variant::_RID: {
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
|
||||
case Variant::RID: {
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator ::RID());
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
} break;
|
||||
case Variant::OBJECT: {
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "../utils/macros.h"
|
||||
|
||||
#include "core/object.h"
|
||||
#include "core/object/object.h"
|
||||
|
||||
namespace GDMonoInternals {
|
||||
void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged);
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "../godotsharp_dirs.h"
|
||||
#include "../utils/string_utils.h"
|
||||
@ -120,18 +121,25 @@ void GDMonoLog::_delete_old_log_files(const String &p_logs_dir) {
|
||||
|
||||
ERR_FAIL_COND(da->list_dir_begin() != OK);
|
||||
|
||||
String current;
|
||||
while ((current = da->get_next()).length()) {
|
||||
if (da->current_is_dir())
|
||||
String current = da->get_next();
|
||||
while (current.length()) {
|
||||
if (da->current_is_dir()) {
|
||||
current = da->get_next();
|
||||
continue;
|
||||
if (!current.ends_with(".txt"))
|
||||
}
|
||||
|
||||
if (!current.ends_with(".txt")) {
|
||||
current = da->get_next();
|
||||
continue;
|
||||
}
|
||||
|
||||
uint64_t modified_time = FileAccess::get_modified_time(da->get_current_dir().plus_file(current));
|
||||
|
||||
if (OS::get_singleton()->get_unix_time() - modified_time > MAX_SECS) {
|
||||
da->remove(current);
|
||||
}
|
||||
|
||||
current = da->get_next();
|
||||
}
|
||||
|
||||
da->list_dir_end();
|
||||
|
@ -86,8 +86,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
|
||||
if (vtclass == CACHED_CLASS(Basis))
|
||||
return Variant::BASIS;
|
||||
|
||||
if (vtclass == CACHED_CLASS(Quat))
|
||||
return Variant::QUAT;
|
||||
if (vtclass == CACHED_CLASS(Quaternion))
|
||||
return Variant::QUATERNION;
|
||||
|
||||
if (vtclass == CACHED_CLASS(Transform))
|
||||
return Variant::TRANSFORM;
|
||||
@ -160,7 +160,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
|
||||
}
|
||||
|
||||
if (CACHED_CLASS(RID) == type_class) {
|
||||
return Variant::_RID;
|
||||
return Variant::RID;
|
||||
}
|
||||
|
||||
if (CACHED_CLASS(Dictionary) == type_class) {
|
||||
@ -506,9 +506,9 @@ MonoObject *variant_to_mono_object(const Variant &p_var) {
|
||||
GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_var.operator ::Plane());
|
||||
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Plane), &from);
|
||||
}
|
||||
case Variant::QUAT: {
|
||||
GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_var.operator ::Quat());
|
||||
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Quat), &from);
|
||||
case Variant::QUATERNION: {
|
||||
GDMonoMarshal::M_Quaternion from = MARSHALLED_OUT(Quaternion, p_var.operator ::Quaternion());
|
||||
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Quaternion), &from);
|
||||
}
|
||||
case Variant::AABB: {
|
||||
GDMonoMarshal::M_AABB from = MARSHALLED_OUT(AABB, p_var.operator ::AABB());
|
||||
@ -528,7 +528,7 @@ MonoObject *variant_to_mono_object(const Variant &p_var) {
|
||||
}
|
||||
case Variant::NODE_PATH:
|
||||
return GDMonoUtils::create_managed_from(p_var.operator NodePath());
|
||||
case Variant::_RID:
|
||||
case Variant::RID:
|
||||
return GDMonoUtils::create_managed_from(p_var.operator ::RID());
|
||||
case Variant::OBJECT:
|
||||
return GDMonoUtils::unmanaged_get_managed(p_var.operator Object *());
|
||||
@ -600,7 +600,7 @@ size_t variant_get_managed_unboxed_size(const ManagedType &p_type) {
|
||||
RETURN_CHECK_FOR_STRUCT(Transform2D);
|
||||
RETURN_CHECK_FOR_STRUCT(Vector3);
|
||||
RETURN_CHECK_FOR_STRUCT(Basis);
|
||||
RETURN_CHECK_FOR_STRUCT(Quat);
|
||||
RETURN_CHECK_FOR_STRUCT(Quaternion);
|
||||
RETURN_CHECK_FOR_STRUCT(Transform);
|
||||
RETURN_CHECK_FOR_STRUCT(AABB);
|
||||
RETURN_CHECK_FOR_STRUCT(Color);
|
||||
@ -700,7 +700,7 @@ void *variant_to_managed_unboxed(const Variant &p_var, const ManagedType &p_type
|
||||
RETURN_CHECK_FOR_STRUCT(Transform2D);
|
||||
RETURN_CHECK_FOR_STRUCT(Vector3);
|
||||
RETURN_CHECK_FOR_STRUCT(Basis);
|
||||
RETURN_CHECK_FOR_STRUCT(Quat);
|
||||
RETURN_CHECK_FOR_STRUCT(Quaternion);
|
||||
RETURN_CHECK_FOR_STRUCT(Transform);
|
||||
RETURN_CHECK_FOR_STRUCT(AABB);
|
||||
RETURN_CHECK_FOR_STRUCT(Color);
|
||||
@ -840,7 +840,7 @@ MonoObject *variant_to_mono_object(const Variant &p_var, const ManagedType &p_ty
|
||||
RETURN_CHECK_FOR_STRUCT(Transform2D);
|
||||
RETURN_CHECK_FOR_STRUCT(Vector3);
|
||||
RETURN_CHECK_FOR_STRUCT(Basis);
|
||||
RETURN_CHECK_FOR_STRUCT(Quat);
|
||||
RETURN_CHECK_FOR_STRUCT(Quaternion);
|
||||
RETURN_CHECK_FOR_STRUCT(Transform);
|
||||
RETURN_CHECK_FOR_STRUCT(AABB);
|
||||
RETURN_CHECK_FOR_STRUCT(Color);
|
||||
@ -966,8 +966,8 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
|
||||
if (vtclass == CACHED_CLASS(Basis))
|
||||
return MARSHALLED_IN(Basis, unbox_addr<GDMonoMarshal::M_Basis>(p_obj));
|
||||
|
||||
if (vtclass == CACHED_CLASS(Quat))
|
||||
return MARSHALLED_IN(Quat, unbox_addr<GDMonoMarshal::M_Quat>(p_obj));
|
||||
if (vtclass == CACHED_CLASS(Quaternion))
|
||||
return MARSHALLED_IN(Quaternion, unbox_addr<GDMonoMarshal::M_Quaternion>(p_obj));
|
||||
|
||||
if (vtclass == CACHED_CLASS(Transform))
|
||||
return MARSHALLED_IN(Transform, unbox_addr<GDMonoMarshal::M_Transform>(p_obj));
|
||||
|
@ -31,7 +31,7 @@
|
||||
#ifndef GD_MONO_MARSHAL_H
|
||||
#define GD_MONO_MARSHAL_H
|
||||
|
||||
#include "core/variant.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
#include "gd_mono.h"
|
||||
#include "gd_mono_utils.h"
|
||||
@ -91,7 +91,7 @@ _FORCE_INLINE_ MonoString *mono_from_utf8_string(const String &p_string) {
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ MonoString *mono_from_utf16_string(const String &p_string) {
|
||||
return mono_string_from_utf16((mono_unichar2 *)p_string.c_str());
|
||||
return mono_string_from_utf16((mono_unichar2 *)p_string.get_data());
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ MonoString *mono_string_from_godot(const String &p_string) {
|
||||
@ -228,11 +228,11 @@ enum {
|
||||
|
||||
MATCHES_Basis = (MATCHES_Vector3 && (sizeof(Basis) == (sizeof(Vector3) * 3))), // No field offset required, it stores an array
|
||||
|
||||
MATCHES_Quat = (MATCHES_real_t && (sizeof(Quat) == (sizeof(real_t) * 4)) &&
|
||||
offsetof(Quat, x) == (sizeof(real_t) * 0) &&
|
||||
offsetof(Quat, y) == (sizeof(real_t) * 1) &&
|
||||
offsetof(Quat, z) == (sizeof(real_t) * 2) &&
|
||||
offsetof(Quat, w) == (sizeof(real_t) * 3)),
|
||||
MATCHES_Quaternion = (MATCHES_real_t && (sizeof(Quaternion) == (sizeof(real_t) * 4)) &&
|
||||
offsetof(Quaternion, x) == (sizeof(real_t) * 0) &&
|
||||
offsetof(Quaternion, y) == (sizeof(real_t) * 1) &&
|
||||
offsetof(Quaternion, z) == (sizeof(real_t) * 2) &&
|
||||
offsetof(Quaternion, w) == (sizeof(real_t) * 3)),
|
||||
|
||||
MATCHES_Transform = (MATCHES_Basis && MATCHES_Vector3 && (sizeof(Transform) == (sizeof(Basis) + sizeof(Vector3))) &&
|
||||
offsetof(Transform, basis) == 0 &&
|
||||
@ -257,7 +257,7 @@ enum {
|
||||
#ifdef GD_MONO_FORCE_INTEROP_STRUCT_COPY
|
||||
/* clang-format off */
|
||||
GD_STATIC_ASSERT(MATCHES_Vector2 && MATCHES_Rect2 && MATCHES_Transform2D && MATCHES_Vector3 &&
|
||||
MATCHES_Basis && MATCHES_Quat && MATCHES_Transform && MATCHES_AABB && MATCHES_Color &&MATCHES_Plane);
|
||||
MATCHES_Basis && MATCHES_Quaternion && MATCHES_Transform && MATCHES_AABB && MATCHES_Color &&MATCHES_Plane);
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
@ -294,19 +294,19 @@ struct M_Rect2 {
|
||||
};
|
||||
|
||||
struct M_Transform2D {
|
||||
M_Vector2 elements[3];
|
||||
M_Vector2 columns[3];
|
||||
|
||||
static _FORCE_INLINE_ Transform2D convert_to(const M_Transform2D &p_from) {
|
||||
return Transform2D(p_from.elements[0].x, p_from.elements[0].y,
|
||||
p_from.elements[1].x, p_from.elements[1].y,
|
||||
p_from.elements[2].x, p_from.elements[2].y);
|
||||
return Transform2D(p_from.columns[0].x, p_from.columns[0].y,
|
||||
p_from.columns[1].x, p_from.columns[1].y,
|
||||
p_from.columns[2].x, p_from.columns[2].y);
|
||||
}
|
||||
|
||||
static _FORCE_INLINE_ M_Transform2D convert_from(const Transform2D &p_from) {
|
||||
M_Transform2D ret = {
|
||||
M_Vector2::convert_from(p_from.elements[0]),
|
||||
M_Vector2::convert_from(p_from.elements[1]),
|
||||
M_Vector2::convert_from(p_from.elements[2])
|
||||
M_Vector2::convert_from(p_from.columns[0]),
|
||||
M_Vector2::convert_from(p_from.columns[1]),
|
||||
M_Vector2::convert_from(p_from.columns[2])
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
@ -326,33 +326,33 @@ struct M_Vector3 {
|
||||
};
|
||||
|
||||
struct M_Basis {
|
||||
M_Vector3 elements[3];
|
||||
M_Vector3 rows[3];
|
||||
|
||||
static _FORCE_INLINE_ Basis convert_to(const M_Basis &p_from) {
|
||||
return Basis(M_Vector3::convert_to(p_from.elements[0]),
|
||||
M_Vector3::convert_to(p_from.elements[1]),
|
||||
M_Vector3::convert_to(p_from.elements[2]));
|
||||
return Basis(M_Vector3::convert_to(p_from.rows[0]),
|
||||
M_Vector3::convert_to(p_from.rows[1]),
|
||||
M_Vector3::convert_to(p_from.rows[2]));
|
||||
}
|
||||
|
||||
static _FORCE_INLINE_ M_Basis convert_from(const Basis &p_from) {
|
||||
M_Basis ret = {
|
||||
M_Vector3::convert_from(p_from.elements[0]),
|
||||
M_Vector3::convert_from(p_from.elements[1]),
|
||||
M_Vector3::convert_from(p_from.elements[2])
|
||||
M_Vector3::convert_from(p_from.rows[0]),
|
||||
M_Vector3::convert_from(p_from.rows[1]),
|
||||
M_Vector3::convert_from(p_from.rows[2])
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
struct M_Quat {
|
||||
struct M_Quaternion {
|
||||
real_t x, y, z, w;
|
||||
|
||||
static _FORCE_INLINE_ Quat convert_to(const M_Quat &p_from) {
|
||||
return Quat(p_from.x, p_from.y, p_from.z, p_from.w);
|
||||
static _FORCE_INLINE_ Quaternion convert_to(const M_Quaternion &p_from) {
|
||||
return Quaternion(p_from.x, p_from.y, p_from.z, p_from.w);
|
||||
}
|
||||
|
||||
static _FORCE_INLINE_ M_Quat convert_from(const Quat &p_from) {
|
||||
M_Quat ret = { p_from.x, p_from.y, p_from.z, p_from.w };
|
||||
static _FORCE_INLINE_ M_Quaternion convert_from(const Quaternion &p_from) {
|
||||
M_Quaternion ret = { p_from.x, p_from.y, p_from.z, p_from.w };
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
@ -454,7 +454,7 @@ DECL_TYPE_MARSHAL_TEMPLATES(Rect2)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Transform2D)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Vector3)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Basis)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Quat)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Quaternion)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Transform)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(AABB)
|
||||
DECL_TYPE_MARSHAL_TEMPLATES(Color)
|
||||
|
@ -35,8 +35,8 @@
|
||||
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/reference.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/reference.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/script_editor_debugger.h"
|
||||
@ -70,7 +70,7 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
|
||||
|
||||
ERR_FAIL_NULL_V(data, NULL);
|
||||
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->value();
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::Element *)data)->value();
|
||||
|
||||
if (!script_binding.inited) {
|
||||
MutexLock lock(CSharpLanguage::get_singleton()->get_language_bind_mutex());
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "gd_mono_wasm_m2n.h"
|
||||
#endif
|
||||
|
||||
#include "core/object.h"
|
||||
#include "core/reference.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/object/reference.h"
|
||||
|
||||
#define UNHANDLED_EXCEPTION(m_exc) \
|
||||
if (unlikely(m_exc != NULL)) { \
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
|
||||
#include "core/oa_hash_map.h"
|
||||
#include "core/containers/oa_hash_map.h"
|
||||
|
||||
typedef mono_bool (*GodotMonoM2nIcallTrampolineDispatch)(const char *cookie, void *target_func, Mono_InterpMethodArguments *margs);
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
|
||||
#include "core/typedefs.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include <mono/metadata/loader.h>
|
||||
#include <mono/utils/mono-publib.h>
|
||||
|
@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "platform/android/java_godot_wrapper.h"
|
||||
#include "platform/android/os_android.h"
|
||||
#include "platform/android/thread_jandroid.h"
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#if defined(ANDROID_ENABLED)
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
namespace gdmono {
|
||||
namespace android {
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#if defined(IPHONE_ENABLED)
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
namespace gdmono {
|
||||
namespace ios {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <os/log.h>
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "../gd_mono_marshal.h"
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "core/config/engine.h"
|
||||
|
||||
#include "csharp_script.h"
|
||||
|
||||
@ -40,37 +40,43 @@ Ref<ResourceFormatSaverCSharpScript> resource_saver_cs;
|
||||
|
||||
_GodotSharp *_godotsharp = NULL;
|
||||
|
||||
void register_mono_types() {
|
||||
ClassDB::register_class<CSharpScript>();
|
||||
void register_mono_types(ModuleRegistrationLevel p_level) {
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
|
||||
ClassDB::register_class<CSharpScript>();
|
||||
|
||||
_godotsharp = memnew(_GodotSharp);
|
||||
_godotsharp = memnew(_GodotSharp);
|
||||
|
||||
ClassDB::register_class<_GodotSharp>();
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("GodotSharp", _GodotSharp::get_singleton()));
|
||||
ClassDB::register_class<_GodotSharp>();
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("GodotSharp", _GodotSharp::get_singleton()));
|
||||
|
||||
script_language_cs = memnew(CSharpLanguage);
|
||||
script_language_cs->set_language_index(ScriptServer::get_language_count());
|
||||
ScriptServer::register_language(script_language_cs);
|
||||
script_language_cs = memnew(CSharpLanguage);
|
||||
script_language_cs->set_language_index(ScriptServer::get_language_count());
|
||||
ScriptServer::register_language(script_language_cs);
|
||||
|
||||
resource_loader_cs.instance();
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_cs);
|
||||
resource_loader_cs.instance();
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_cs);
|
||||
|
||||
resource_saver_cs.instance();
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_cs);
|
||||
resource_saver_cs.instance();
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_cs);
|
||||
}
|
||||
}
|
||||
|
||||
void unregister_mono_types() {
|
||||
ScriptServer::unregister_language(script_language_cs);
|
||||
void unregister_mono_types(ModuleRegistrationLevel p_level) {
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
|
||||
ScriptServer::unregister_language(script_language_cs);
|
||||
|
||||
if (script_language_cs)
|
||||
memdelete(script_language_cs);
|
||||
if (script_language_cs) {
|
||||
memdelete(script_language_cs);
|
||||
}
|
||||
|
||||
ResourceLoader::remove_resource_format_loader(resource_loader_cs);
|
||||
resource_loader_cs.unref();
|
||||
ResourceLoader::remove_resource_format_loader(resource_loader_cs);
|
||||
resource_loader_cs.unref();
|
||||
|
||||
ResourceSaver::remove_resource_format_saver(resource_saver_cs);
|
||||
resource_saver_cs.unref();
|
||||
ResourceSaver::remove_resource_format_saver(resource_saver_cs);
|
||||
resource_saver_cs.unref();
|
||||
|
||||
if (_godotsharp)
|
||||
memdelete(_godotsharp);
|
||||
if (_godotsharp) {
|
||||
memdelete(_godotsharp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef MONO_REGISTER_TYPES_H
|
||||
#define MONO_REGISTER_TYPES_H
|
||||
|
||||
/**************************************************************************/
|
||||
/* register_types.h */
|
||||
/**************************************************************************/
|
||||
@ -28,5 +31,9 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
void register_mono_types();
|
||||
void unregister_mono_types();
|
||||
#include "modules/register_module_types.h"
|
||||
|
||||
void register_mono_types(ModuleRegistrationLevel p_level);
|
||||
void unregister_mono_types(ModuleRegistrationLevel p_level);
|
||||
|
||||
#endif
|
@ -31,7 +31,7 @@
|
||||
#ifndef SIGNAL_AWAITER_UTILS_H
|
||||
#define SIGNAL_AWAITER_UTILS_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/object/reference.h"
|
||||
#include "mono_gc_handle.h"
|
||||
|
||||
namespace SignalAwaiterUtils {
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
struct MonoRegInfo {
|
||||
String version;
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#ifdef OSX_ENABLED
|
||||
|
||||
#include "core/print_string.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#ifndef MONO_OSX_UTILS_H
|
||||
#define MONO_OSX_UTILS_H
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#ifdef WINDOWS_ENABLED
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -31,8 +31,8 @@
|
||||
#ifndef MONO_PATH_UTILS_H
|
||||
#define MONO_PATH_UTILS_H
|
||||
|
||||
#include "core/string_builder.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/string/string_builder.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
namespace path {
|
||||
|
||||
|
@ -47,7 +47,7 @@ int sfind(const String &p_text, int p_from) {
|
||||
if (len == 0)
|
||||
return -1;
|
||||
|
||||
const CharType *src = p_text.c_str();
|
||||
const CharType *src = p_text.get_data();
|
||||
|
||||
for (int i = p_from; i <= (len - src_len); i++) {
|
||||
bool found = true;
|
||||
|
@ -31,8 +31,8 @@
|
||||
#ifndef MONO_STRING_UTILS_H
|
||||
#define MONO_STRING_UTILS_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/variant.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include "core/os/memory.h"
|
||||
#include "core/print_string.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
struct ThreadLocalStorage::Impl {
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
Loading…
Reference in New Issue
Block a user