DmitriySalnikov / godot_debug_draw_3d

Draw 3D debug graphics and 2D overlays with this add-on.
https://dd3d.dmitriysalnikov.ru/
Other
451 stars 23 forks source link

[Bug]: No bindings for C# #10

Closed DmitriySalnikov closed 1 year ago

DmitriySalnikov commented 1 year ago

Godot version

4.x

DebugDraw3D version

179ad806d520069e10ab6309cbb8799afc84d8c5

On which operating systems the error occurs

No response

Using which renderers the error occurs

No response

Issue description

Due to differences in the work of GDExtension and the new versions of .NET in Godot, C# support was temporarily removed during porting. To solve this, I need to either write a new API generator, or someone needs to extend the generator in the engine itself.

Steps to reproduce

N/A

Minimal reproduction project

N/A

DmitriySalnikov commented 1 year ago

Following this article, API generation for C# is planned in future versions.

Consuming APIs provided by a GDExtension is also currently unsupported. We’ll keep working on bridging the gap between GDExtension and C# in future 4.x releases.

GeorgeS2019 commented 1 year ago

Possible to create C# binding for GDExtension?

wp2000x commented 1 year ago

Are C# bindings now possible in GD 4.1?

DmitriySalnikov commented 1 year ago

Officially, there is no such possibility, but I haven't tried to make my own bindings yet. I heard that there were problems when trying to use classes from GDExtension in C#. I do not know whether it was fixed or not.

GeorgeS2019 commented 1 year ago

@DmitriySalnikov I have done further GDExtension c# Binding. Not writing further to avoid Spanning impression

DmitriySalnikov commented 1 year ago

I have done further GDExtension c# Binding

@GeorgeS2019 have you thought about starting to do PR for Godot with an API generator for GDExtension? Godot itself has this generator for a long time and it is used only when running with the --generate-mono-glue argument. All that is needed, it seems to me, is to run this generator for GDExtension through the editor, put the generated sources in a separate folder, compile them into a separate DLL and add this DLL as "friendly" (so that it can use internal classes) to the core of the Godot Mono library.

But, most likely, you need to create a godot-proposal first and discuss how best to do it with the Godot core team.

GeorgeS2019 commented 1 year ago

@DmitriySalnikov Thx for your encouragement

GeorgeS2019 commented 1 year ago

@DmitriySalnikov I saw u resume this recently.

Are there still open issues?

DmitriySalnikov commented 1 year ago

I replied to a PR that allows me to reload libraries without having to restart the editor. With it, I could run the editor 1 time and rebuild the library several times. Unfortunately this has nothing to do with C#.

DmitriySalnikov commented 1 year ago

@GeorgeS2019 image

Everything works again via GodotObject.Call, no native pointers, as in bindings for the engine. Therefore, I cannot guarantee high performance. Bindings are generated manually by my generator. The commit will be later (still no default values for the arguments).

GeorgeS2019 commented 1 year ago

@DmitriySalnikov Native structures and pointers in c#

https://github.com/godotengine/godot-proposals/discussions/7024#discussioncomment-6851198

DmitriySalnikov commented 1 year ago

Isn't it about adding support for NativeStucts that were originally registered for GDExtension? Like AudioFrame

GeorgeS2019 commented 1 year ago

I will speak to him again

He understands very in depth what are missing now but beyond my understanding

We are getting closer to the goal!

DmitriySalnikov commented 1 year ago

Nothing else is needed for my binding generator at the moment. After its release, I will wait for the official generator for GDExtension <=> C#. I'm not really interested in participating in adding an official feature right now.

DmitriySalnikov commented 1 year ago

I added a generator and updated the binaries. You can download the update here: https://github.com/DmitriySalnikov/godot_debug_draw_3d/archive/3c76608fd2409830bdbdd97a775d15ce5bef2202.zip

Also here the name DebugDraw was changed to DebugDraw3D and DebugDraw2D.

GeorgeS2019 commented 1 year ago

Which Godot 4 version is used to open. It crashes using 4.2 Dev 4

DmitriySalnikov commented 1 year ago

What do you mean? The library is built for 4.1+

Godot_v4 2-dev4_mono_win64_ZhATopaTlf

GeorgeS2019 commented 1 year ago

Still trying to understand why the editor crashes using Godot4.2 Dev4

image

DmitriySalnikov commented 1 year ago

image

Well, after this line, the generation of bindings should happen


I think I know what the problem is, I'll fix it now

DmitriySalnikov commented 1 year ago

updated libraries will be here https://github.com/DmitriySalnikov/godot_debug_draw_3d/actions/runs/6177991021