Fix "const" NativePtr binds.

pull/704/head
bruvzg 2022-02-16 11:35:13 +02:00
parent 9bc489eb2a
commit a8cd21ac07
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
2 changed files with 25 additions and 21 deletions

View File

@ -789,6 +789,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):
@ -802,6 +804,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):

View File

@ -203,8 +203,8 @@ struct PtrToArg<const T *> {
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; \
_FORCE_INLINE_ static void encode(const m_type *p_var, const void *p_ptr) { \
*((const void **)p_ptr) = p_var; \
} \
}