Fix GDVIRTUAL_NATIVE_PTR
This commit fixes the usage of GDExtensionPtr and GDExtensionConstPtr in GDExtension by introducing the required VariantInternalAccessor specializations. Sponsored by Migeran (https://migeran.com)
This commit is contained in:
parent
46424488ed
commit
a2ede8c4da
1 changed files with 40 additions and 30 deletions
|
@ -70,6 +70,11 @@ struct GDExtensionPtr {
|
|||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct VariantInternalAccessor<GDExtensionConstPtr<const m_type>> { \
|
||||
static _FORCE_INLINE_ const GDExtensionConstPtr<const m_type> &get(const Variant *v) { return *reinterpret_cast<const GDExtensionConstPtr<const m_type> *>(VariantInternal::get_int(v)); } \
|
||||
static _FORCE_INLINE_ void set(Variant *v, const GDExtensionConstPtr<const m_type> &p_value) { *VariantInternal::get_int(v) = uint64_t(p_value.data); } \
|
||||
}; \
|
||||
template <> \
|
||||
struct GDExtensionPtr<m_type> { \
|
||||
m_type *data = nullptr; \
|
||||
GDExtensionPtr() {} \
|
||||
|
@ -83,6 +88,11 @@ struct GDExtensionPtr {
|
|||
static _FORCE_INLINE_ GDExtensionPtr<m_type> cast(const Variant &p_variant) { \
|
||||
return GDExtensionPtr<m_type>((m_type *)p_variant.operator uint64_t()); \
|
||||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct VariantInternalAccessor<GDExtensionPtr<m_type>> { \
|
||||
static _FORCE_INLINE_ const GDExtensionPtr<m_type> &get(const Variant *v) { return *reinterpret_cast<const GDExtensionPtr<m_type> *>(VariantInternal::get_int(v)); } \
|
||||
static _FORCE_INLINE_ void set(Variant *v, const GDExtensionPtr<m_type> &p_value) { *VariantInternal::get_int(v) = uint64_t(p_value.data); } \
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
|
Loading…
Reference in a new issue