Merge pull request #970 from Daylily-Zeleen/daylily-zeleen/register_unexposed_class
Implement register unexposed classespull/1241/head
commit
16ffb2795a
|
@ -291,6 +291,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GDExtensionBool is_virtual;
|
GDExtensionBool is_virtual;
|
||||||
GDExtensionBool is_abstract;
|
GDExtensionBool is_abstract;
|
||||||
|
GDExtensionBool is_exposed;
|
||||||
GDExtensionClassSet set_func;
|
GDExtensionClassSet set_func;
|
||||||
GDExtensionClassGet get_func;
|
GDExtensionClassGet get_func;
|
||||||
GDExtensionClassGetPropertyList get_property_list_func;
|
GDExtensionClassGetPropertyList get_property_list_func;
|
||||||
|
|
|
@ -104,7 +104,7 @@ private:
|
||||||
static void bind_method_godot(const StringName &p_class_name, MethodBind *p_method);
|
static void bind_method_godot(const StringName &p_class_name, MethodBind *p_method);
|
||||||
|
|
||||||
template <class T, bool is_abstract>
|
template <class T, bool is_abstract>
|
||||||
static void _register_class(bool p_virtual = false);
|
static void _register_class(bool p_virtual = false, bool p_exposed = true);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -112,6 +112,8 @@ public:
|
||||||
template <class T>
|
template <class T>
|
||||||
static void register_abstract_class();
|
static void register_abstract_class();
|
||||||
template <class T>
|
template <class T>
|
||||||
|
static void register_internal_class();
|
||||||
|
template <class T>
|
||||||
static void register_engine_class();
|
static void register_engine_class();
|
||||||
|
|
||||||
template <class N, class M, typename... VarArgs>
|
template <class N, class M, typename... VarArgs>
|
||||||
|
@ -157,7 +159,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, bool is_abstract>
|
template <class T, bool is_abstract>
|
||||||
void ClassDB::_register_class(bool p_virtual) {
|
void ClassDB::_register_class(bool p_virtual, bool p_exposed) {
|
||||||
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
|
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
|
||||||
|
|
||||||
// Register this class within our plugin
|
// Register this class within our plugin
|
||||||
|
@ -177,6 +179,7 @@ void ClassDB::_register_class(bool p_virtual) {
|
||||||
GDExtensionClassCreationInfo2 class_info = {
|
GDExtensionClassCreationInfo2 class_info = {
|
||||||
p_virtual, // GDExtensionBool is_virtual;
|
p_virtual, // GDExtensionBool is_virtual;
|
||||||
is_abstract, // GDExtensionBool is_abstract;
|
is_abstract, // GDExtensionBool is_abstract;
|
||||||
|
p_exposed, // GDExtensionBool is_exposed;
|
||||||
T::set_bind, // GDExtensionClassSet set_func;
|
T::set_bind, // GDExtensionClassSet set_func;
|
||||||
T::get_bind, // GDExtensionClassGet get_func;
|
T::get_bind, // GDExtensionClassGet get_func;
|
||||||
T::has_get_property_list() ? T::get_property_list_bind : nullptr, // GDExtensionClassGetPropertyList get_property_list_func;
|
T::has_get_property_list() ? T::get_property_list_bind : nullptr, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||||
|
@ -213,6 +216,11 @@ void ClassDB::register_abstract_class() {
|
||||||
ClassDB::_register_class<T, true>();
|
ClassDB::_register_class<T, true>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void ClassDB::register_internal_class() {
|
||||||
|
ClassDB::_register_class<T, false>(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void ClassDB::register_engine_class() {
|
void ClassDB::register_engine_class() {
|
||||||
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
|
instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
|
||||||
|
@ -276,6 +284,7 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p
|
||||||
#define GDREGISTER_CLASS(m_class) ClassDB::register_class<m_class>();
|
#define GDREGISTER_CLASS(m_class) ClassDB::register_class<m_class>();
|
||||||
#define GDREGISTER_VIRTUAL_CLASS(m_class) ClassDB::register_class<m_class>(true);
|
#define GDREGISTER_VIRTUAL_CLASS(m_class) ClassDB::register_class<m_class>(true);
|
||||||
#define GDREGISTER_ABSTRACT_CLASS(m_class) ClassDB::register_abstract_class<m_class>();
|
#define GDREGISTER_ABSTRACT_CLASS(m_class) ClassDB::register_abstract_class<m_class>();
|
||||||
|
#define GDREGISTER_INTERNAL_CLASS(m_class) ClassDB::register_internal_class<m_class>();
|
||||||
|
|
||||||
} // namespace godot
|
} // namespace godot
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue