godot icon indicating copy to clipboard operation
godot copied to clipboard

C#: Fix marshaling generic Godot collections

Open raulsntos opened this issue 3 years ago • 3 comments

Add support for generic Godot collections to ConvertManagedObjectToVariant.

  • Fixes https://github.com/godotengine/godot/issues/65883

raulsntos avatar Sep 16 '22 14:09 raulsntos

This was removed on purpose. I've thought of a way to add it back, though, including for type parameters of Godot generic collections and delegate invocations. Let's leave this unmerged for now, until I make these changes, then I can decide whether this is the proper solution for ConvertManagedObjectToVariant (if this method even remains).

neikeq avatar Sep 16 '22 22:09 neikeq

This change is only about the default value, right? If that's the case, I can change GetGodotPropertyDefaultValues to return Variant. That would be one usage less of ConvertManagedObjectToVariant. The last usage would be in DelegateUtils, which I have an idea how to replace too.

neikeq avatar Nov 28 '22 17:11 neikeq

Yes, it's only about the default value. The error is printed from GetGodotPropertyDefaultValues calling ConvertManagedObjectToVariant.

raulsntos avatar Nov 28 '22 18:11 raulsntos

The DelegateUtils usage seems complicated to replace. It uses System.Object because it needs reflection to access the fields of compiler generated classes (<>c__DisplayClass) for closures (needed by the editor during assembly reloading). I'll accept this PR, as we can't fully get rid of ConvertManagedObjectToVariant yet.

neikeq avatar Nov 30 '22 00:11 neikeq