Delsin-Yu / CSharp-Wrapper-Generator-for-GDExtension

This editor plugin generates C# wrappers for classes from the GDExtension plugins.
MIT License
11 stars 2 forks source link

Improved `Bind` Method Performance #22

Closed ZerxZ closed 2 months ago

GeorgeS2019 commented 2 months ago

@ZerxZ Thank you for trying.

GeorgeS2019 commented 2 months ago

@ZerxZ Can you explain what you have done to improve the Bind Performance?

Am I expected to see this in the generated code?

public Godot.Collections.Array FaceLandmarks
{
        get => (Godot.Collections.Array<MediaPipeNormalizedLandmarks>)Get("face_landmarks");
        set => Set("face_landmarks", Variant.From(value));
}
public static Godot.Collections.Array<GodotObject> ToGodotObjectArray(Godot.Collections.Array array)
                {
                    return (Godot.Collections.Array<GodotObject>)(Variant)array;
                }
GeorgeS2019 commented 2 months ago

@ZerxZ

This remains fails

    public Godot.Collections.Array<MediaPipeNormalizedLandmarks> FaceLandmarks
    {
        get => Get("face_landmarks").AsGodotArray<MediaPipeNormalizedLandmarks>();
Delsin-Yu commented 2 months ago

@ZerxZ

This remains fails

    public Godot.Collections.Array<MediaPipeNormalizedLandmarks> FaceLandmarks
    {
        get => Get("face_landmarks").AsGodotArray<MediaPipeNormalizedLandmarks>();

Based on your use case, you need to call ToBindArray.

GeorgeS2019 commented 2 months ago

@Delsin-Yu

where do I apply ToBindArray ?

GDExtensionHelper does not have ToBindArray

ZerxZ commented 2 months ago

@Delsin-Yu

where do I apply ToBindArray ?

GDExtensionHelper does not have ToBindArray

You should download this PR modification file, then overwrite the local file, and regenerate the code.

var bindarray =GDExtensionHelper.ToBindArray<TClass>(array);
ZerxZ commented 2 months ago

But these later changes might be deleted and won't be retained, they're just for reference.

GeorgeS2019 commented 2 months ago

@ZerxZ I tried out. The performance is definitely better. The video is smooth. Thank you