niklas2902 / py4godot

Python scripting for Godot. This GDExtension plugin allows you to use Python like GDScript, accessing the Godot engine's features and benefiting from Python's vast ecosystem.
MIT License
64 stars 7 forks source link

Allow default values for core types and generated types #10

Closed niklas2902 closed 2 years ago

niklas2902 commented 2 years ago

Currently, only types like bool or string can be generated by the api. in the file generate_bindings. Core types like Vector3 or generated types like Object are currently set to None, becuase instanciating them would lead to segmentation fault. This probably happens because the api core gets set too late, as it is set in an external function

cdef set_core(godot_gdnative_core_api_struct* core):
    global api_core
    api_core = core

cdef set_native_script(godot_gdnative_ext_nativescript_1_1_api_struct* api):
    global nativescript_api_11
    nativescript_api_11 = api

(from generated.py, line32). This issue could be fixed by importing the api_core from classes.pyx