diff options
author | David Snopek <dsnopek@gmail.com> | 2024-01-19 07:27:06 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 07:27:06 -0600 |
commit | 6c04514039a34c646c7e30aa25f48fdd04e13daf (patch) | |
tree | 10206b7c76576ab33fe0abe1bfa0c14f70fd436f /include/godot_cpp/classes/wrapped.hpp | |
parent | 480a0f8c069576050e192b202248e66976982456 (diff) | |
parent | 5f350e257214c490639682d0b601be859a3b4332 (diff) | |
download | redot-cpp-6c04514039a34c646c7e30aa25f48fdd04e13daf.tar.gz |
Merge pull request #1359 from Naros/GH-1287
Rework GDCLASS macro to allow abstract classes
Diffstat (limited to 'include/godot_cpp/classes/wrapped.hpp')
-rw-r--r-- | include/godot_cpp/classes/wrapped.hpp | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp index f8f921b..32caf39 100644 --- a/include/godot_cpp/classes/wrapped.hpp +++ b/include/godot_cpp/classes/wrapped.hpp @@ -48,6 +48,7 @@ typedef void GodotObject; // Base for all engine classes, to contain the pointer to the engine instance. class Wrapped { friend class GDExtensionBinding; + friend class ClassDB; friend void postinitialize_handler(Wrapped *); protected: @@ -131,17 +132,6 @@ struct EngineClassRegistration { } // namespace godot -#ifdef HOT_RELOAD_ENABLED -#define _GDCLASS_RECREATE(m_class, m_inherits) \ - m_class *new_instance = (m_class *)memalloc(sizeof(m_class)); \ - Wrapped::RecreateInstance recreate_data = { new_instance, obj, Wrapped::recreate_instance }; \ - Wrapped::recreate_instance = &recreate_data; \ - memnew_placement(new_instance, m_class); \ - return new_instance; -#else -#define _GDCLASS_RECREATE(m_class, m_inherits) return nullptr; -#endif - // Use this on top of your own classes. // Note: the trail of `***` is to keep sane diffs in PRs, because clang-format otherwise moves every `\` which makes // every line of the macro different @@ -226,15 +216,6 @@ public: return m_inherits::get_class_static(); \ } \ \ - static GDExtensionObjectPtr create(void *data) { \ - m_class *new_object = memnew(m_class); \ - return new_object->_owner; \ - } \ - \ - static GDExtensionClassInstancePtr recreate(void *data, GDExtensionObjectPtr obj) { \ - _GDCLASS_RECREATE(m_class, m_inherits); \ - } \ - \ static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed) { \ if (p_instance && m_class::_get_notification()) { \ if (m_class::_get_notification() != m_inherits::_get_notification()) { \ @@ -437,14 +418,6 @@ public: return m_inherits::get_class_static(); \ } \ \ - static GDExtensionObjectPtr create(void *data) { \ - return nullptr; \ - } \ - \ - static GDExtensionClassInstancePtr recreate(void *data, GDExtensionObjectPtr obj) { \ - return nullptr; \ - } \ - \ static void free(void *data, GDExtensionClassInstancePtr ptr) { \ } \ \ |