@@ -110,7 +110,7 @@ class ClassDB {
110110 static void bind_method_godot (const StringName &p_class_name, MethodBind *p_method);
111111
112112 template <class T , bool is_abstract>
113- static void _register_class (bool p_virtual = false , bool p_exposed = true );
113+ static void _register_class (bool p_virtual = false , bool p_exposed = true , bool p_runtime = false );
114114
115115 template <class T >
116116 static GDExtensionObjectPtr _create_instance_func (void *data) {
@@ -146,6 +146,8 @@ class ClassDB {
146146 static void register_abstract_class ();
147147 template <class T >
148148 static void register_internal_class ();
149+ template <class T >
150+ static void register_runtime_class ();
149151
150152 _FORCE_INLINE_ static void _register_engine_class (const StringName &p_name, const GDExtensionInstanceBindingCallbacks *p_callbacks) {
151153 instance_binding_callbacks[p_name] = p_callbacks;
@@ -199,7 +201,7 @@ class ClassDB {
199201 }
200202
201203template <class T , bool is_abstract>
202- void ClassDB::_register_class (bool p_virtual, bool p_exposed) {
204+ void ClassDB::_register_class (bool p_virtual, bool p_exposed, bool p_runtime ) {
203205 static_assert (TypesAreSame<typename T::self_type, T>::value, " Class not declared properly, please use GDCLASS." );
204206 instance_binding_callbacks[T::get_class_static ()] = &T::_gde_binding_callbacks;
205207
@@ -217,10 +219,11 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed) {
217219 class_register_order.push_back (cl.name );
218220
219221 // Register this class with Godot
220- GDExtensionClassCreationInfo2 class_info = {
222+ GDExtensionClassCreationInfo3 class_info = {
221223 p_virtual, // GDExtensionBool is_virtual;
222224 is_abstract, // GDExtensionBool is_abstract;
223225 p_exposed, // GDExtensionBool is_exposed;
226+ p_runtime, // GDExtensionBool is_runtime;
224227 T::set_bind, // GDExtensionClassSet set_func;
225228 T::get_bind, // GDExtensionClassGet get_func;
226229 T::has_get_property_list () ? T::get_property_list_bind : nullptr , // GDExtensionClassGetPropertyList get_property_list_func;
@@ -242,7 +245,7 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed) {
242245 (void *)&T::get_class_static (), // void *class_userdata;
243246 };
244247
245- internal::gdextension_interface_classdb_register_extension_class2 (internal::library, cl.name ._native_ptr (), cl.parent_name ._native_ptr (), &class_info);
248+ internal::gdextension_interface_classdb_register_extension_class3 (internal::library, cl.name ._native_ptr (), cl.parent_name ._native_ptr (), &class_info);
246249
247250 // call bind_methods etc. to register all members of the class
248251 T::initialize_class ();
@@ -266,6 +269,11 @@ void ClassDB::register_internal_class() {
266269 ClassDB::_register_class<T, false >(false , false );
267270}
268271
272+ template <class T >
273+ void ClassDB::register_runtime_class () {
274+ ClassDB::_register_class<T, false >(false , true , true );
275+ }
276+
269277template <class N , class M , typename ... VarArgs>
270278MethodBind *ClassDB::bind_method (N p_method_name, M p_method, VarArgs... p_args) {
271279 Variant args[sizeof ...(p_args) + 1 ] = { p_args..., Variant () }; // +1 makes sure zero sized arrays are also supported.
@@ -325,6 +333,7 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p
325333#define GDREGISTER_VIRTUAL_CLASS (m_class ) ClassDB::register_class<m_class>(true );
326334#define GDREGISTER_ABSTRACT_CLASS (m_class ) ClassDB::register_abstract_class<m_class>();
327335#define GDREGISTER_INTERNAL_CLASS (m_class ) ClassDB::register_internal_class<m_class>();
336+ #define GDREGISTER_RUNTIME_CLASS (m_class ) ClassDB::register_runtime_class<m_class>();
328337
329338} // namespace godot
330339
0 commit comments