summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/core/class_db.hpp
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-09-11 09:35:32 -0500
committerGitHub <noreply@github.com>2023-09-11 09:35:32 -0500
commit16ffb2795ae804cee84cc9939d542e4ffa9290db (patch)
tree89ecc3bc62bf01f047982e6d0d286b5a1b7a526e /include/godot_cpp/core/class_db.hpp
parentb488f009bd5dcecb48fe7c7840d5a5144a0c19ae (diff)
parent2d1f852baf0344145d838bbe92adfa8a3ee254b8 (diff)
downloadredot-cpp-16ffb2795ae804cee84cc9939d542e4ffa9290db.tar.gz
Merge pull request #970 from Daylily-Zeleen/daylily-zeleen/register_unexposed_class
Implement register unexposed classes
Diffstat (limited to 'include/godot_cpp/core/class_db.hpp')
-rw-r--r--include/godot_cpp/core/class_db.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp
index 2e568ea..6569445 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 <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:
template <class T>
@@ -112,6 +112,8 @@ public:
template <class T>
static void register_abstract_class();
template <class T>
+ static void register_internal_class();
+ template <class T>
static void register_engine_class();
template <class N, class M, typename... VarArgs>
@@ -157,7 +159,7 @@ public:
}
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;
// 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;
@@ -214,6 +217,11 @@ void ClassDB::register_abstract_class() {
}
template <class T>
+void ClassDB::register_internal_class() {
+ ClassDB::_register_class<T, false>(false, false);
+}
+
+template <class T>
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<m_class>();
#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_INTERNAL_CLASS(m_class) ClassDB::register_internal_class<m_class>();
} // namespace godot