GDCLASS synced by ending with "private:"
• Matches implementation used by modules and godot itself
• Apply same to GDEXTENSION_CLASS, setup with same diff-friendly spacers as GDCLASS
(cherry picked from commit 6eb5d450bd
)
pull/1306/head
parent
29335d8f5c
commit
805cdde0b7
|
@ -325,97 +325,105 @@ public:
|
||||||
_gde_binding_create_callback, \
|
_gde_binding_create_callback, \
|
||||||
_gde_binding_free_callback, \
|
_gde_binding_free_callback, \
|
||||||
_gde_binding_reference_callback, \
|
_gde_binding_reference_callback, \
|
||||||
};
|
}; \
|
||||||
|
\
|
||||||
|
private:
|
||||||
|
|
||||||
// Don't use this for your classes, use GDCLASS() instead.
|
// Don't use this for your classes, use GDCLASS() instead.
|
||||||
#define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) \
|
#define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) /******************************************************************************************************************/ \
|
||||||
private: \
|
private: \
|
||||||
inline static ::godot::internal::EngineClassRegistration<m_class> _gde_engine_class_registration_helper; \
|
inline static ::godot::internal::EngineClassRegistration<m_class> _gde_engine_class_registration_helper; \
|
||||||
void operator=(const m_class &p_rval) {} \
|
void operator=(const m_class &p_rval) {} \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
|
virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
|
||||||
return &_gde_binding_callbacks; \
|
return &_gde_binding_callbacks; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
m_class(const char *p_godot_class) : m_inherits(p_godot_class) {} \
|
m_class(const char *p_godot_class) : m_inherits(p_godot_class) {} \
|
||||||
m_class(GodotObject *p_godot_object) : m_inherits(p_godot_object) {} \
|
m_class(GodotObject *p_godot_object) : m_inherits(p_godot_object) {} \
|
||||||
\
|
\
|
||||||
static void (*_get_bind_methods())() { \
|
static void (*_get_bind_methods())() { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static void (Wrapped::*_get_notification())(int) { \
|
static void (Wrapped::*_get_notification())(int) { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static bool (Wrapped::*_get_set())(const ::godot::StringName &p_name, const Variant &p_property) { \
|
static bool (Wrapped::*_get_set())(const ::godot::StringName &p_name, const Variant &p_property) { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static bool (Wrapped::*_get_get())(const ::godot::StringName &p_name, Variant &r_ret) const { \
|
static bool (Wrapped::*_get_get())(const ::godot::StringName &p_name, Variant &r_ret) const { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static void (Wrapped::*_get_get_property_list())(List<PropertyInfo> * p_list) const { \
|
static inline bool has_get_property_list() { \
|
||||||
return nullptr; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static bool (Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
|
static void (Wrapped::*_get_get_property_list())(List<PropertyInfo> * p_list) const { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static bool (Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, Variant &) const { \
|
static bool (Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static String (Wrapped::*_get_to_string())() const { \
|
static bool (Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, Variant &) const { \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
public: \
|
static void (Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
|
||||||
typedef m_class self_type; \
|
return nullptr; \
|
||||||
\
|
} \
|
||||||
static void initialize_class() {} \
|
\
|
||||||
\
|
static String (Wrapped::*_get_to_string())() const { \
|
||||||
static ::godot::StringName &get_class_static() { \
|
return nullptr; \
|
||||||
static ::godot::StringName string_name = ::godot::StringName(#m_alias_for); \
|
} \
|
||||||
return string_name; \
|
\
|
||||||
} \
|
public: \
|
||||||
\
|
typedef m_class self_type; \
|
||||||
static ::godot::StringName &get_parent_class_static() { \
|
\
|
||||||
return m_inherits::get_class_static(); \
|
static void initialize_class() {} \
|
||||||
} \
|
\
|
||||||
\
|
static ::godot::StringName &get_class_static() { \
|
||||||
static GDExtensionObjectPtr create(void *data) { \
|
static ::godot::StringName string_name = ::godot::StringName(#m_alias_for); \
|
||||||
return nullptr; \
|
return string_name; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static GDExtensionClassInstancePtr recreate(void *data, GDExtensionObjectPtr obj) { \
|
static ::godot::StringName &get_parent_class_static() { \
|
||||||
return nullptr; \
|
return m_inherits::get_class_static(); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static void free(void *data, GDExtensionClassInstancePtr ptr) { \
|
static GDExtensionObjectPtr create(void *data) { \
|
||||||
} \
|
return nullptr; \
|
||||||
\
|
} \
|
||||||
static void *_gde_binding_create_callback(void *p_token, void *p_instance) { \
|
\
|
||||||
/* Do not call memnew here, we don't want the post-initializer to be called */ \
|
static void free(void *data, GDExtensionClassInstancePtr ptr) { \
|
||||||
return new ("") m_class((GodotObject *)p_instance); \
|
} \
|
||||||
} \
|
\
|
||||||
static void _gde_binding_free_callback(void *p_token, void *p_instance, void *p_binding) { \
|
static void *_gde_binding_create_callback(void *p_token, void *p_instance) { \
|
||||||
/* Explicitly call the deconstructor to ensure proper lifecycle for non-trivial members */ \
|
/* Do not call memnew here, we don't want the post-initializer to be called */ \
|
||||||
reinterpret_cast<m_class *>(p_binding)->~m_class(); \
|
return new ("") m_class((GodotObject *)p_instance); \
|
||||||
Memory::free_static(reinterpret_cast<m_class *>(p_binding)); \
|
} \
|
||||||
} \
|
static void _gde_binding_free_callback(void *p_token, void *p_instance, void *p_binding) { \
|
||||||
static GDExtensionBool _gde_binding_reference_callback(void *p_token, void *p_instance, GDExtensionBool p_reference) { \
|
/* Explicitly call the deconstructor to ensure proper lifecycle for non-trivial members */ \
|
||||||
return true; \
|
reinterpret_cast<m_class *>(p_binding)->~m_class(); \
|
||||||
} \
|
Memory::free_static(reinterpret_cast<m_class *>(p_binding)); \
|
||||||
static constexpr GDExtensionInstanceBindingCallbacks _gde_binding_callbacks = { \
|
} \
|
||||||
_gde_binding_create_callback, \
|
static GDExtensionBool _gde_binding_reference_callback(void *p_token, void *p_instance, GDExtensionBool p_reference) { \
|
||||||
_gde_binding_free_callback, \
|
return true; \
|
||||||
_gde_binding_reference_callback, \
|
} \
|
||||||
}; \
|
static constexpr GDExtensionInstanceBindingCallbacks _gde_binding_callbacks = { \
|
||||||
m_class() : m_class(#m_alias_for) {}
|
_gde_binding_create_callback, \
|
||||||
|
_gde_binding_free_callback, \
|
||||||
|
_gde_binding_reference_callback, \
|
||||||
|
}; \
|
||||||
|
m_class() : m_class(#m_alias_for) {} \
|
||||||
|
\
|
||||||
|
private:
|
||||||
|
|
||||||
// Don't use this for your classes, use GDCLASS() instead.
|
// Don't use this for your classes, use GDCLASS() instead.
|
||||||
#define GDEXTENSION_CLASS(m_class, m_inherits) GDEXTENSION_CLASS_ALIAS(m_class, m_class, m_inherits)
|
#define GDEXTENSION_CLASS(m_class, m_inherits) GDEXTENSION_CLASS_ALIAS(m_class, m_class, m_inherits)
|
||||||
|
|
Loading…
Reference in New Issue