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...

Комментарии • 17

  • @DylanCalaf
    @DylanCalaf 11 месяцев назад +1

    These videos are absolute gold. You've earned a subscriber.
    Please MOAR.😄

  • @NonUnknownDev
    @NonUnknownDev Год назад +2

    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.

    • @mohsenzare2511
      @mohsenzare2511  Год назад +2

      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++

  • @inculetbogdan
    @inculetbogdan Год назад +4

    Finally someone explained this

  • @thomasfrewer1328
    @thomasfrewer1328 7 месяцев назад +1

    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?

    • @mohsenzare2511
      @mohsenzare2511  7 месяцев назад

      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

    • @thomasfrewer1328
      @thomasfrewer1328 7 месяцев назад +1

      @@mohsenzare2511
      I've registered the class and it doesn't compile. I tried inheriting from Object and from Refcount, neither one works.

    • @mohsenzare2511
      @mohsenzare2511  7 месяцев назад

      @@thomasfrewer1328 You are making an error somewhere!!
      what error that will give you when you want to compile?

    • @thomasfrewer1328
      @thomasfrewer1328 7 месяцев назад +1

      @@mohsenzare2511
      So I did manage to get it to compile but then the nodes stopped showing up in the Godot editor.

    • @mohsenzare2511
      @mohsenzare2511  7 месяцев назад

      @@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

  • @tommaxwellmans3
    @tommaxwellmans3 11 месяцев назад +1

    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

    • @mohsenzare2511
      @mohsenzare2511  11 месяцев назад +1

      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

  • @inculetbogdan
    @inculetbogdan Год назад +1

    One thing that I don’t understand is how can we override methods made with gdextension.

    • @mohsenzare2511
      @mohsenzare2511  Год назад +1

      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

    • @inculetbogdan
      @inculetbogdan Год назад

      @@mohsenzare2511 Im trying to override methods from gdextension in gdscript. Basically use gdextension as an interface and inherit in gdscript.