From 5fe1ea73b3811562f0ac5ee38f68c48b5d61a4c0 Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 19 Oct 2024 23:35:41 -0400 Subject: [PATCH] fix: Fix C++ code using `Variant.fromObject` `Variant.fromObject` was removed. --- src/cpp/dart_bindings.cpp | 2 +- src/cpp/script/dart_script_instance.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/dart_bindings.cpp b/src/cpp/dart_bindings.cpp index 326ae61..676f0f3 100644 --- a/src/cpp/dart_bindings.cpp +++ b/src/cpp/dart_bindings.cpp @@ -530,7 +530,7 @@ void GodotDartBindings::bind_call(void *method_userdata, GDExtensionClassInstanc // the logic and type checking is easier in Dart. Dart_Handle variant_type = Dart_HandleFromPersistent(gde->_variant_type); Dart_Handle args[] = {result}; - Dart_Handle variant_result = Dart_New(variant_type, Dart_NewStringFromCString("fromObject"), 1, args); + Dart_Handle variant_result = Dart_New(variant_type, Dart_Null(), 1, args); if (Dart_IsError(variant_result)) { GD_PRINT_ERROR("GodotDart: Error converting return to variant: "); GD_PRINT_ERROR(Dart_GetError(variant_result)); diff --git a/src/cpp/script/dart_script_instance.cpp b/src/cpp/script/dart_script_instance.cpp index 9a9f9e4..8fd404f 100644 --- a/src/cpp/script/dart_script_instance.cpp +++ b/src/cpp/script/dart_script_instance.cpp @@ -99,7 +99,7 @@ bool DartScriptInstance::get(const godot::StringName &p_name, GDExtensionVariant DART_CHECK(dart_value, Dart_GetField(object, field_name), "Failed to get property"); Dart_Handle variant_type = Dart_HandleFromPersistent(gde->_variant_type); Dart_Handle args[] = {dart_value}; - DART_CHECK(variant_result, Dart_New(variant_type, Dart_NewStringFromCString("fromObject"), 1, args), + DART_CHECK(variant_result, Dart_New(variant_type, Dart_Null(), 1, args), "Failed to convert prop to variant"); void *variantDataPtr = get_object_address(variant_result); @@ -357,7 +357,7 @@ void DartScriptInstance::call(const godot::StringName *p_method, const GDExtensi DART_CHECK(dart_ret, Dart_Invoke(object, dart_method_name, arg_count, dart_args), "Failed to call method"); Dart_Handle variant_type = Dart_HandleFromPersistent(gde->_variant_type); Dart_Handle args[] = {dart_ret}; - Dart_Handle variant_result = Dart_New(variant_type, Dart_NewStringFromCString("fromObject"), 1, args); + Dart_Handle variant_result = Dart_New(variant_type, Dart_Null(), 1, args); if (Dart_IsError(variant_result)) { GD_PRINT_ERROR("GodotDart: Error converting return to variant: ");