diff options
Diffstat (limited to 'include/godot_cpp/classes')
| -rw-r--r-- | include/godot_cpp/classes/ref.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/godot_cpp/classes/ref.hpp b/include/godot_cpp/classes/ref.hpp index b80227d..92a1e7f 100644 --- a/include/godot_cpp/classes/ref.hpp +++ b/include/godot_cpp/classes/ref.hpp @@ -229,9 +229,9 @@ public: template <class T> struct PtrToArg<Ref<T>> { _FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) { - // Important: p_ptr is T*, not Ref<T>*, since Object* is what engine gives to ptrcall. + GDExtensionRefPtr ref = (GDExtensionRefPtr)p_ptr; ERR_FAIL_NULL_V(p_ptr, Ref<T>()); - return Ref<T>(reinterpret_cast<T *>(godot::internal::get_object_instance_binding(reinterpret_cast<GDExtensionObjectPtr>(const_cast<void *>(p_ptr))))); + return Ref<T>(reinterpret_cast<T *>(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref)))); } typedef Ref<T> EncodeT; @@ -253,8 +253,9 @@ struct PtrToArg<const Ref<T> &> { typedef Ref<T> EncodeT; _FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) { + GDExtensionRefPtr ref = const_cast<GDExtensionRefPtr>(p_ptr); ERR_FAIL_NULL_V(p_ptr, Ref<T>()); - return Ref<T>(reinterpret_cast<T *>(godot::internal::get_object_instance_binding(reinterpret_cast<GDExtensionObjectPtr>(const_cast<void *>(p_ptr))))); + return Ref<T>(reinterpret_cast<T *>(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref)))); } }; |
