1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Mono: Fix build after ObjectID and Texture2D changes

This commit is contained in:
Rémi Verschelde
2020-02-18 11:02:46 +01:00
parent a16be762ed
commit 702976cd7a
3 changed files with 5 additions and 14 deletions

View File

@@ -41,7 +41,7 @@ namespace GodotTools
public bool ErrorsVisible { get; set; } = true; public bool ErrorsVisible { get; set; } = true;
public bool WarningsVisible { get; set; } = true; public bool WarningsVisible { get; set; } = true;
public Texture IconTexture public Texture2D IconTexture
{ {
get get
{ {

View File

@@ -224,14 +224,9 @@ MonoString *godot_icall_Object_ToString(Object *p_ptr) {
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
// Cannot happen in C#; would get an ObjectDisposedException instead. // Cannot happen in C#; would get an ObjectDisposedException instead.
CRASH_COND(p_ptr == NULL); CRASH_COND(p_ptr == NULL);
if (ScriptDebugger::get_singleton() && !Object::cast_to<Reference>(p_ptr)) { // Only if debugging!
// Cannot happen either in C#; the handle is nullified when the object is destroyed
CRASH_COND(!ObjectDB::instance_validate(p_ptr));
}
#endif #endif
String result = "[" + p_ptr->get_class() + ":" + itos(p_ptr->get_instance_id()) + "]"; String result = p_ptr->to_string();
return GDMonoMarshal::mono_string_from_godot(result); return GDMonoMarshal::mono_string_from_godot(result);
} }

View File

@@ -45,8 +45,7 @@
MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) { MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) {
Variant ret; Variant ret;
PackedByteArray varr = GDMonoMarshal::mono_array_to_PackedByteArray(p_bytes); PackedByteArray varr = GDMonoMarshal::mono_array_to_PackedByteArray(p_bytes);
const uint8_t *r = varr.ptr(); Error err = decode_variant(ret, varr.ptr(), varr.size(), NULL, p_allow_objects);
Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, p_allow_objects);
if (err != OK) { if (err != OK) {
ret = RTR("Not enough bytes for decoding bytes, or invalid format."); ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
} }
@@ -67,7 +66,7 @@ int godot_icall_GD_hash(MonoObject *p_var) {
} }
MonoObject *godot_icall_GD_instance_from_id(uint64_t p_instance_id) { MonoObject *godot_icall_GD_instance_from_id(uint64_t p_instance_id) {
return GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(p_instance_id)); return GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(ObjectID(p_instance_id)));
} }
void godot_icall_GD_print(MonoArray *p_what) { void godot_icall_GD_print(MonoArray *p_what) {
@@ -263,10 +262,7 @@ MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var, MonoBoolean p_full_object
ERR_FAIL_COND_V_MSG(err != OK, NULL, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."); ERR_FAIL_COND_V_MSG(err != OK, NULL, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
barr.resize(len); barr.resize(len);
{ encode_variant(var, barr.ptrw(), len, p_full_objects);
uint8_t *w = barr.ptrw();
encode_variant(var, w.ptr(), len, p_full_objects);
}
return GDMonoMarshal::PackedByteArray_to_mono_array(barr); return GDMonoMarshal::PackedByteArray_to_mono_array(barr);
} }