Skip to content

Commit

Permalink
fix: Fix C++ code using Variant.fromObject
Browse files Browse the repository at this point in the history
`Variant.fromObject` was removed.
  • Loading branch information
fuzzybinary committed Oct 20, 2024
1 parent 4c0b07f commit 5fe1ea7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cpp/dart_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/script/dart_script_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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: ");
Expand Down

0 comments on commit 5fe1ea7

Please sign in to comment.