diff options
author | David Snopek <dsnopek@gmail.com> | 2023-10-16 10:47:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-16 10:47:06 -0500 |
commit | 64eac01d04cd6ced10ad72dece92fdc971161d89 (patch) | |
tree | cca8ce7e3e4192b61427c21c81dccdcd08e064f9 /include/godot_cpp/core/class_db.hpp | |
parent | 4320c62c76879ae9ab3e5ff198d82896d9985af3 (diff) | |
parent | b507b3e5913344a97e90ba27b221e28924f555ab (diff) | |
download | redot-cpp-64eac01d04cd6ced10ad72dece92fdc971161d89.tar.gz |
Merge pull request #1266 from dsnopek/automatic-engine-class-registration
Automatically register only engine classes whose header has been included
Diffstat (limited to 'include/godot_cpp/core/class_db.hpp')
-rw-r--r-- | include/godot_cpp/core/class_db.hpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index ef18c6e..17e093a 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -119,8 +119,10 @@ public: static void register_abstract_class(); template <class T> static void register_internal_class(); - template <class T> - static void register_engine_class(); + + _FORCE_INLINE_ static void _register_engine_class(const StringName &p_name, const GDExtensionInstanceBindingCallbacks *p_callbacks) { + instance_binding_callbacks[p_name] = p_callbacks; + } template <class N, class M, typename... VarArgs> static MethodBind *bind_method(N p_method_name, M p_method, VarArgs... p_args); @@ -233,11 +235,6 @@ 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; -} - template <class N, class M, typename... VarArgs> MethodBind *ClassDB::bind_method(N p_method_name, M p_method, VarArgs... p_args) { Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. |