diff --git a/binding_generator.py b/binding_generator.py index c78c48ce..9b510c65 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -790,6 +790,8 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): if "arguments" in method: for argument in method["arguments"]: type_name = argument["type"] + if type_name.startswith("const "): + type_name = type_name[6:] if type_name.endswith("*"): type_name = type_name[:-1] if is_included(type_name, class_name): @@ -803,6 +805,8 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): fully_used_classes.add("Ref") if "return_value" in method: type_name = method["return_value"]["type"] + if type_name.startswith("const "): + type_name = type_name[6:] if type_name.endswith("*"): type_name = type_name[:-1] if is_included(type_name, class_name): diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp index 3e6f060d..5752f7ee 100644 --- a/include/godot_cpp/core/method_ptrcall.hpp +++ b/include/godot_cpp/core/method_ptrcall.hpp @@ -185,27 +185,27 @@ struct PtrToArg { }; // Pointers. -#define GDVIRTUAL_NATIVE_PTR(m_type) \ - template <> \ - struct PtrToArg { \ - _FORCE_INLINE_ static m_type *convert(const void *p_ptr) { \ - return (m_type *)(*(void **)p_ptr); \ - } \ - typedef m_type *EncodeT; \ - _FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \ - *((void **)p_ptr) = p_var; \ - } \ - }; \ - \ - template <> \ - struct PtrToArg { \ - _FORCE_INLINE_ static const m_type *convert(const void *p_ptr) { \ - return (const m_type *)(*(const void **)p_ptr); \ - } \ - typedef const m_type *EncodeT; \ - _FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \ - *((void **)p_ptr) = p_var; \ - } \ +#define GDVIRTUAL_NATIVE_PTR(m_type) \ + template <> \ + struct PtrToArg { \ + _FORCE_INLINE_ static m_type *convert(const void *p_ptr) { \ + return (m_type *)(*(void **)p_ptr); \ + } \ + typedef m_type *EncodeT; \ + _FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \ + *((void **)p_ptr) = p_var; \ + } \ + }; \ + \ + template <> \ + struct PtrToArg { \ + _FORCE_INLINE_ static const m_type *convert(const void *p_ptr) { \ + return (const m_type *)(*(const void **)p_ptr); \ + } \ + typedef const m_type *EncodeT; \ + _FORCE_INLINE_ static void encode(const m_type *p_var, const void *p_ptr) { \ + *((const void **)p_ptr) = p_var; \ + } \ } GDVIRTUAL_NATIVE_PTR(bool);