Fix "const" NativePtr binds.
parent
9bc489eb2a
commit
a8cd21ac07
|
@ -789,6 +789,8 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
|
||||||
if "arguments" in method:
|
if "arguments" in method:
|
||||||
for argument in method["arguments"]:
|
for argument in method["arguments"]:
|
||||||
type_name = argument["type"]
|
type_name = argument["type"]
|
||||||
|
if type_name.startswith("const "):
|
||||||
|
type_name = type_name[6:]
|
||||||
if type_name.endswith("*"):
|
if type_name.endswith("*"):
|
||||||
type_name = type_name[:-1]
|
type_name = type_name[:-1]
|
||||||
if is_included(type_name, class_name):
|
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")
|
fully_used_classes.add("Ref")
|
||||||
if "return_value" in method:
|
if "return_value" in method:
|
||||||
type_name = method["return_value"]["type"]
|
type_name = method["return_value"]["type"]
|
||||||
|
if type_name.startswith("const "):
|
||||||
|
type_name = type_name[6:]
|
||||||
if type_name.endswith("*"):
|
if type_name.endswith("*"):
|
||||||
type_name = type_name[:-1]
|
type_name = type_name[:-1]
|
||||||
if is_included(type_name, class_name):
|
if is_included(type_name, class_name):
|
||||||
|
|
|
@ -185,27 +185,27 @@ struct PtrToArg<const T *> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pointers.
|
// Pointers.
|
||||||
#define GDVIRTUAL_NATIVE_PTR(m_type) \
|
#define GDVIRTUAL_NATIVE_PTR(m_type) \
|
||||||
template <> \
|
template <> \
|
||||||
struct PtrToArg<m_type *> { \
|
struct PtrToArg<m_type *> { \
|
||||||
_FORCE_INLINE_ static m_type *convert(const void *p_ptr) { \
|
_FORCE_INLINE_ static m_type *convert(const void *p_ptr) { \
|
||||||
return (m_type *)(*(void **)p_ptr); \
|
return (m_type *)(*(void **)p_ptr); \
|
||||||
} \
|
} \
|
||||||
typedef m_type *EncodeT; \
|
typedef m_type *EncodeT; \
|
||||||
_FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \
|
_FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \
|
||||||
*((void **)p_ptr) = p_var; \
|
*((void **)p_ptr) = p_var; \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
template <> \
|
template <> \
|
||||||
struct PtrToArg<const m_type *> { \
|
struct PtrToArg<const m_type *> { \
|
||||||
_FORCE_INLINE_ static const m_type *convert(const void *p_ptr) { \
|
_FORCE_INLINE_ static const m_type *convert(const void *p_ptr) { \
|
||||||
return (const m_type *)(*(const void **)p_ptr); \
|
return (const m_type *)(*(const void **)p_ptr); \
|
||||||
} \
|
} \
|
||||||
typedef const m_type *EncodeT; \
|
typedef const m_type *EncodeT; \
|
||||||
_FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \
|
_FORCE_INLINE_ static void encode(const m_type *p_var, const void *p_ptr) { \
|
||||||
*((void **)p_ptr) = p_var; \
|
*((const void **)p_ptr) = p_var; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
GDVIRTUAL_NATIVE_PTR(bool);
|
GDVIRTUAL_NATIVE_PTR(bool);
|
||||||
|
|
Loading…
Reference in New Issue