Description
Godot version
4.3 stable
Plugin version
4.3
System information
Windows 10, 64 bit
Issue description
I have been wanting to add a new class to the WebRTC src stack. I wanted to expose a new class + its functionality and I did it by doing the following steps but godot still gives an error that the methods or class I created does not exist.
I created the following in the relevant files and folders
src:
WebRTCLibDataChannel.cpp
WebRTCLibDataChannel.hpp
WebRTCLibPeerConnection.cpp
WebRTCLibPeerConnection.hpp
NewClass.cpp
NewClass.hpp
src/net:
WebRTCDataChannelNative.cpp
WebRTCDataChannelNative.hpp
WebRTCPeerConnectionNative.cpp
WebRTCPeerConnectionNative.hpp
NewClassNative.cpp
NewClassNative.hpp
I also updated the build profile - the other classes (PeerConnection and DataChannel were included with the GDNative + Extension versions, I added the Native version of NewClass + extension. The build_profile-json looks like
{
"enabled_classes": [
"WebRTCDataChannelExtension",
"WebRTCPeerConnectionExtension",
"NewClassExtension",
"WebRTCDataChannelGDNative",
"WebRTCPeerConnectionGDNative",
"NewClassNative",
"NativeScript",
"GDNativeLibrary",
"Window"
]
}
Moreover, I also added the NewClass file to the SConstruct in sources.append.
The Issue:
I realise that the godot-cpp/gen/ has files generated by the binding_generator.py, which picks up json class and method definitions from the extension_api.json. The issue is that the main src files include gen files in their headers and right now I can not do that for the newclass classes as the extension_api.json does not have hashes for the new class and methods.
After a little study I realised that the hashes for a certain return type of a function are the same for e.g. all int return type methods seem to have the same hash. While I realise I can somehow get away with the hashes that already fulfill a few of my method return types, but for custom return types (like when a NewClass instance is returned for a function I created called create_newclass and create_from_newclass) I would need a proper hash to represent that for godot's understanding.
Now, I want to add my own custom class and hashes so my questions map down to:
- How do I create custom classes and methods?
- How do I add the hashes relevant to it that godot can read appropriately?
- How are hashes even generated?
- Am I missing something in the above steps in order to add my custom classes and functionality?
I will add more updates as I go.
Steps to reproduce
Minimal reproduction project
No response