Type Casting Godot GDExtension c++ - part 13
HTML-код
- Опубликовано: 15 сен 2024
- This video is about type casting for Object class and everything which inherit from object class in GDExtension in Godot
I saw a lot of comment which I saw a lot of people are confuse about this stuff and I hope this video will help, But if something is not clear you can ask me that in the comment section
Entire GDExtension video series:
• How to start code in G...
These videos are absolute gold. You've earned a subscriber.
Please MOAR.😄
Thanks, Sure
Awesome tutorial dude, I love this kind of content!!! for example didnt know about the TypedArray type. My suggestion for next tutorial is talking about the engine types that you dont have access while in gdscript, for example: Vector and LocalVector, TypedArray is one of them, but maybe theres more types? would love to know.
Thanks for suggestion
Yeah great Idea, I will make them as soon as I can
Normally these stuff are in "godot_cpp/template" Folder
In That folder there are a bunch of stuff which make you feel more the power of c++
Finally someone explained this
Glad I can help
Maybe you can help with this issue I'm having.
I've built a custom node and bound some methods as you've done in your videos 1-5 in this playlist.
What I need is to be able to pass structs from my GDExtension C++ code into GDScript. I've got getter methods that can send individual floats and ints. I need to be able to send more information than that.
I've tried declaring a struct in the same .h and .cpp file, and registering it in the register_types.cpp file. It doesn't compile when I do that.
Do you know the solution to this issue?
Anything you want to pass to GDScript should be a basic data type or inherit somehow from Object Class, and you should register that class, there is no way around that!
I suggest to create a small class which inherit from RefCount (Watch my video about that) and everything which you want to pass to Gd-script just put inside that! (instead of struct) - You should also register that like a normal class so you can access that inside GDSript
@@mohsenzare2511
I've registered the class and it doesn't compile. I tried inheriting from Object and from Refcount, neither one works.
@@thomasfrewer1328 You are making an error somewhere!!
what error that will give you when you want to compile?
@@mohsenzare2511
So I did manage to get it to compile but then the nodes stopped showing up in the Godot editor.
@@thomasfrewer1328 I believe your code has error somewhere!!
make sure you register your class in register.cpp
otherwise send me a github repo of a code which reproduce your problem, so I can tell what is the problem
Here I don't have any idea
Is it possible to make a custom Basic Data Type? I want to be able to create a struct in C++ and expose it to gd script
I don't think you can, basic dataType are part of the Godot core, you can add them by modifying the core, For example in this video I modify a basic dataType in core, Watch this video: ruclips.net/video/3dqFCQYykzw/видео.html
One thing that I don’t understand is how can we override methods made with gdextension.
Override a method in GDExtension, works exactly same as c++
Also it is much better if the parent class method register as virtual
But I don't know exactly what you want to do, So If you want to do something specific, let me know maybe I can help you more
@@mohsenzare2511 Im trying to override methods from gdextension in gdscript. Basically use gdextension as an interface and inherit in gdscript.