diff --git a/gdextension/gdextension_interface.h b/gdextension/gdextension_interface.h index 102220c0..ba0503d1 100644 --- a/gdextension/gdextension_interface.h +++ b/gdextension/gdextension_interface.h @@ -291,6 +291,7 @@ typedef struct { typedef struct { GDExtensionBool is_virtual; GDExtensionBool is_abstract; + GDExtensionBool is_exposed; GDExtensionClassSet set_func; GDExtensionClassGet get_func; GDExtensionClassGetPropertyList get_property_list_func; diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index 2e568ea0..65694453 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -104,7 +104,7 @@ private: static void bind_method_godot(const StringName &p_class_name, MethodBind *p_method); template - static void _register_class(bool p_virtual = false); + static void _register_class(bool p_virtual = false, bool p_exposed = true); public: template @@ -112,6 +112,8 @@ public: template static void register_abstract_class(); template + static void register_internal_class(); + template static void register_engine_class(); template @@ -157,7 +159,7 @@ public: } template -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; // Register this class within our plugin @@ -177,6 +179,7 @@ void ClassDB::_register_class(bool p_virtual) { GDExtensionClassCreationInfo2 class_info = { p_virtual, // GDExtensionBool is_virtual; is_abstract, // GDExtensionBool is_abstract; + p_exposed, // GDExtensionBool is_exposed; T::set_bind, // GDExtensionClassSet set_func; T::get_bind, // GDExtensionClassGet get_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(); } +template +void ClassDB::register_internal_class() { + ClassDB::_register_class(false, false); +} + template void ClassDB::register_engine_class() { 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(); #define GDREGISTER_VIRTUAL_CLASS(m_class) ClassDB::register_class(true); #define GDREGISTER_ABSTRACT_CLASS(m_class) ClassDB::register_abstract_class(); +#define GDREGISTER_INTERNAL_CLASS(m_class) ClassDB::register_internal_class(); } // namespace godot