Add protections against registering classes that didn't use GDCLASS()
(cherry picked from commit a61cdc8860
)
pull/1281/head
parent
ef8a499eac
commit
9d813310bb
|
@ -170,6 +170,8 @@ protected:
|
|||
} \
|
||||
\
|
||||
public: \
|
||||
typedef m_class self_type; \
|
||||
\
|
||||
static void initialize_class() { \
|
||||
static bool initialized = false; \
|
||||
if (initialized) { \
|
||||
|
@ -372,6 +374,8 @@ protected:
|
|||
} \
|
||||
\
|
||||
public: \
|
||||
typedef m_class self_type; \
|
||||
\
|
||||
static void initialize_class() {} \
|
||||
\
|
||||
static ::godot::StringName &get_class_static() { \
|
||||
|
@ -381,6 +385,17 @@ public:
|
|||
\
|
||||
static ::godot::StringName &get_parent_class_static() { \
|
||||
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) { \
|
||||
} \
|
||||
\
|
||||
static void *_gde_binding_create_callback(void *p_token, void *p_instance) { \
|
||||
|
|
|
@ -173,6 +173,7 @@ public:
|
|||
|
||||
template <class T, bool is_abstract>
|
||||
void ClassDB::_register_class(bool p_virtual) {
|
||||
static_assert(TypesAreSame<typename T::self_type, T>::value, "Class not declared properly, please use GDCLASS.");
|
||||
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
|
||||
|
||||
// Register this class within our plugin
|
||||
|
|
Loading…
Reference in New Issue