2023-01-05 12:25:55 +00:00
/**************************************************************************/
/* class_db.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
2018-01-04 23:50:27 +00:00
2017-01-16 07:04:19 +00:00
# ifndef CLASS_DB_H
# define CLASS_DB_H
2014-02-10 01:10:30 +00:00
2020-11-07 22:33:38 +00:00
# include "core/object/method_bind.h"
# include "core/object/object.h"
# include "core/string/print_string.h"
2017-01-16 07:04:19 +00:00
2020-02-20 18:32:36 +00:00
// Makes callable_mp readily available in all classes connecting signals.
// Needs to come after method_bind and object have been included.
2020-11-07 22:33:38 +00:00
# include "core/object/callable_method_pointer.h"
2022-05-19 15:00:06 +00:00
# include "core/templates/hash_set.h"
2014-02-10 01:10:30 +00:00
2023-02-03 10:42:51 +00:00
# include <type_traits>
2020-02-20 18:32:36 +00:00
# define DEFVAL(m_defval) (m_defval)
2014-02-10 01:10:30 +00:00
2022-04-05 23:40:07 +00:00
# ifdef DEBUG_METHODS_ENABLED
2014-02-10 01:10:30 +00:00
struct MethodDefinition {
StringName name ;
Vector < StringName > args ;
2016-03-08 23:00:52 +00:00
MethodDefinition ( ) { }
2017-12-06 20:36:34 +00:00
MethodDefinition ( const char * p_name ) :
name ( p_name ) { }
MethodDefinition ( const StringName & p_name ) :
name ( p_name ) { }
2014-02-10 01:10:30 +00:00
} ;
2022-04-27 10:52:18 +00:00
MethodDefinition D_METHODP ( const char * p_name , const char * const * * p_args , uint32_t p_argcount ) ;
template < typename . . . VarArgs >
MethodDefinition D_METHOD ( const char * p_name , const VarArgs . . . p_args ) {
const char * args [ sizeof . . . ( p_args ) + 1 ] = { p_args . . . , nullptr } ; // +1 makes sure zero sized arrays are also supported.
const char * const * argptrs [ sizeof . . . ( p_args ) + 1 ] ;
for ( uint32_t i = 0 ; i < sizeof . . . ( p_args ) ; i + + ) {
argptrs [ i ] = & args [ i ] ;
}
return D_METHODP ( p_name , sizeof . . . ( p_args ) = = 0 ? nullptr : ( const char * const * * ) argptrs , sizeof . . . ( p_args ) ) ;
}
2014-02-10 01:10:30 +00:00
2022-04-05 23:40:07 +00:00
# else
// When DEBUG_METHODS_ENABLED is set this will let the engine know
// the argument names for easier debugging.
# define D_METHOD(m_c, ...) m_c
# endif
2017-01-03 02:03:46 +00:00
class ClassDB {
2016-09-14 22:37:37 +00:00
public :
enum APIType {
API_CORE ,
API_EDITOR ,
2021-06-04 17:33:48 +00:00
API_EXTENSION ,
API_EDITOR_EXTENSION ,
2016-09-14 22:37:37 +00:00
API_NONE
} ;
2017-03-05 15:44:50 +00:00
2016-09-14 22:37:37 +00:00
public :
2014-02-10 01:10:30 +00:00
struct PropertySetGet {
int index ;
StringName setter ;
StringName getter ;
2022-04-04 13:06:57 +00:00
MethodBind * _setptr = nullptr ;
MethodBind * _getptr = nullptr ;
2015-12-05 17:18:22 +00:00
Variant : : Type type ;
2014-02-10 01:10:30 +00:00
} ;
2017-01-03 02:03:46 +00:00
struct ClassInfo {
2020-05-12 15:01:17 +00:00
APIType api = API_NONE ;
ClassInfo * inherits_ptr = nullptr ;
void * class_ptr = nullptr ;
2022-12-07 11:11:28 +00:00
ObjectGDExtension * gdextension = nullptr ;
2021-06-04 17:33:48 +00:00
2018-07-02 18:08:35 +00:00
HashMap < StringName , MethodBind * > method_map ;
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
HashMap < StringName , LocalVector < MethodBind * > > method_map_compatibility ;
2022-05-09 09:47:10 +00:00
HashMap < StringName , int64_t > constant_map ;
2022-06-24 09:16:37 +00:00
struct EnumInfo {
List < StringName > constants ;
bool is_bitfield = false ;
} ;
HashMap < StringName , EnumInfo > enum_map ;
2018-07-02 18:08:35 +00:00
HashMap < StringName , MethodInfo > signal_map ;
2014-02-10 01:10:30 +00:00
List < PropertyInfo > property_list ;
2020-06-10 21:13:25 +00:00
HashMap < StringName , PropertyInfo > property_map ;
2014-02-10 01:10:30 +00:00
# ifdef DEBUG_METHODS_ENABLED
List < StringName > constant_order ;
List < StringName > method_order ;
2022-05-19 15:00:06 +00:00
HashSet < StringName > methods_in_properties ;
2014-02-10 01:10:30 +00:00
List < MethodInfo > virtual_methods ;
2022-05-13 13:04:37 +00:00
HashMap < StringName , MethodInfo > virtual_methods_map ;
HashMap < StringName , Vector < Error > > method_error_values ;
2022-07-20 23:18:14 +00:00
HashMap < StringName , List < StringName > > linked_properties ;
2014-02-10 01:10:30 +00:00
# endif
2018-07-02 18:08:35 +00:00
HashMap < StringName , PropertySetGet > property_setget ;
2014-02-10 01:10:30 +00:00
StringName inherits ;
StringName name ;
2020-05-12 15:01:17 +00:00
bool disabled = false ;
bool exposed = false ;
2022-03-10 07:17:38 +00:00
bool is_virtual = false ;
2020-05-12 15:01:17 +00:00
Object * ( * creation_func ) ( ) = nullptr ;
ClassInfo ( ) { }
~ ClassInfo ( ) { }
2014-02-10 01:10:30 +00:00
} ;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
template < class T >
static Object * creator ( ) {
return memnew ( T ) ;
}
2016-03-08 23:00:52 +00:00
2021-01-18 13:01:38 +00:00
static RWLock lock ;
2018-07-02 18:08:35 +00:00
static HashMap < StringName , ClassInfo > classes ;
static HashMap < StringName , StringName > resource_base_extensions ;
static HashMap < StringName , StringName > compat_classes ;
2014-02-10 01:10:30 +00:00
2022-04-05 23:40:07 +00:00
# ifdef DEBUG_METHODS_ENABLED
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
static MethodBind * bind_methodfi ( uint32_t p_flags , MethodBind * p_bind , bool p_compatibility , const MethodDefinition & method_name , const Variant * * p_defs , int p_defcount ) ;
2022-04-05 23:40:07 +00:00
# else
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
static MethodBind * bind_methodfi ( uint32_t p_flags , MethodBind * p_bind , bool p_compatibility , const char * method_name , const Variant * * p_defs , int p_defcount ) ;
2022-04-05 23:40:07 +00:00
# endif
2014-02-10 01:10:30 +00:00
2016-09-14 22:37:37 +00:00
static APIType current_api ;
2023-06-23 14:39:51 +00:00
static HashMap < APIType , uint32_t > api_hashes_cache ;
2014-02-10 01:10:30 +00:00
2017-01-03 02:03:46 +00:00
static void _add_class2 ( const StringName & p_class , const StringName & p_inherits ) ;
2016-03-08 23:00:52 +00:00
2020-03-17 06:33:00 +00:00
static HashMap < StringName , HashMap < StringName , Variant > > default_values ;
2022-05-19 15:00:06 +00:00
static HashSet < StringName > default_values_cached ;
2018-11-08 14:30:02 +00:00
2022-03-14 14:52:03 +00:00
// Native structs, used by binder
struct NativeStruct {
String ccode ; // C code to create the native struct, fields separated by ; Arrays accepted (even containing other structs), also function pointers. All types must be Godot types.
uint64_t struct_size ; // local size of struct, for comparison
} ;
2022-05-13 13:04:37 +00:00
static HashMap < StringName , NativeStruct > native_structs ;
2022-03-14 14:52:03 +00:00
2020-11-01 07:44:15 +00:00
private :
// Non-locking variants of get_parent_class and is_parent_class.
static StringName _get_parent_class ( const StringName & p_class ) ;
static bool _is_parent_class ( const StringName & p_class , const StringName & p_inherits ) ;
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
static void _bind_compatibility ( ClassInfo * type , MethodBind * p_method ) ;
static MethodBind * _bind_vararg_method ( MethodBind * p_bind , const StringName & p_name , const Vector < Variant > & p_default_args , bool p_compatibility ) ;
static void _bind_method_custom ( const StringName & p_class , MethodBind * p_method , bool p_compatibility ) ;
2020-11-01 07:44:15 +00:00
2017-03-05 15:44:50 +00:00
public :
2014-02-10 01:10:30 +00:00
// DO NOT USE THIS!!!!!! NEEDS TO BE PUBLIC BUT DO NOT USE NO MATTER WHAT!!!
template < class T >
2017-01-03 02:03:46 +00:00
static void _add_class ( ) {
_add_class2 ( T : : get_class_static ( ) , T : : get_parent_class_static ( ) ) ;
2014-02-10 01:10:30 +00:00
}
template < class T >
2022-03-10 07:17:38 +00:00
static void register_class ( bool p_virtual = false ) {
2014-02-10 01:10:30 +00:00
GLOBAL_LOCK_FUNCTION ;
2023-08-26 15:39:43 +00:00
static_assert ( TypesAreSame < typename T : : self_type , T > : : value , " Class not declared properly, please use GDCLASS. " ) ;
2017-01-03 02:03:46 +00:00
T : : initialize_class ( ) ;
ClassInfo * t = classes . getptr ( T : : get_class_static ( ) ) ;
2014-02-10 01:10:30 +00:00
ERR_FAIL_COND ( ! t ) ;
t - > creation_func = & creator < T > ;
2017-10-09 21:49:17 +00:00
t - > exposed = true ;
2022-03-10 07:17:38 +00:00
t - > is_virtual = p_virtual ;
2019-10-21 15:44:56 +00:00
t - > class_ptr = T : : get_class_ptr_static ( ) ;
2021-08-31 19:45:21 +00:00
t - > api = current_api ;
2014-02-10 01:10:30 +00:00
T : : register_custom_data_to_otdb ( ) ;
}
template < class T >
2022-03-10 07:17:38 +00:00
static void register_abstract_class ( ) {
2014-02-10 01:10:30 +00:00
GLOBAL_LOCK_FUNCTION ;
2023-08-26 15:39:43 +00:00
static_assert ( TypesAreSame < typename T : : self_type , T > : : value , " Class not declared properly, please use GDCLASS. " ) ;
2017-01-03 02:03:46 +00:00
T : : initialize_class ( ) ;
2017-10-09 21:49:17 +00:00
ClassInfo * t = classes . getptr ( T : : get_class_static ( ) ) ;
ERR_FAIL_COND ( ! t ) ;
t - > exposed = true ;
2019-10-21 15:44:56 +00:00
t - > class_ptr = T : : get_class_ptr_static ( ) ;
2021-08-31 19:45:21 +00:00
t - > api = current_api ;
2014-02-10 01:10:30 +00:00
//nothing
}
2022-12-07 11:11:28 +00:00
static void register_extension_class ( ObjectGDExtension * p_extension ) ;
2021-06-19 15:58:49 +00:00
static void unregister_extension_class ( const StringName & p_class ) ;
2021-06-04 17:33:48 +00:00
2014-02-13 21:03:28 +00:00
template < class T >
static Object * _create_ptr_func ( ) {
return T : : create ( ) ;
}
template < class T >
2017-01-03 02:03:46 +00:00
static void register_custom_instance_class ( ) {
2014-02-13 21:03:28 +00:00
GLOBAL_LOCK_FUNCTION ;
2023-08-26 15:39:43 +00:00
static_assert ( TypesAreSame < typename T : : self_type , T > : : value , " Class not declared properly, please use GDCLASS. " ) ;
2017-01-03 02:03:46 +00:00
T : : initialize_class ( ) ;
ClassInfo * t = classes . getptr ( T : : get_class_static ( ) ) ;
2014-02-13 21:03:28 +00:00
ERR_FAIL_COND ( ! t ) ;
t - > creation_func = & _create_ptr_func < T > ;
2017-10-09 21:49:17 +00:00
t - > exposed = true ;
2019-10-21 15:44:56 +00:00
t - > class_ptr = T : : get_class_ptr_static ( ) ;
2021-08-31 19:45:21 +00:00
t - > api = current_api ;
2014-02-13 21:03:28 +00:00
T : : register_custom_data_to_otdb ( ) ;
}
2017-01-03 02:03:46 +00:00
static void get_class_list ( List < StringName > * p_classes ) ;
static void get_inheriters_from_class ( const StringName & p_class , List < StringName > * p_classes ) ;
2019-04-08 22:18:03 +00:00
static void get_direct_inheriters_from_class ( const StringName & p_class , List < StringName > * p_classes ) ;
2017-01-11 21:29:59 +00:00
static StringName get_parent_class_nocheck ( const StringName & p_class ) ;
2017-01-03 02:03:46 +00:00
static StringName get_parent_class ( const StringName & p_class ) ;
2019-10-03 20:39:08 +00:00
static StringName get_compatibility_remapped_class ( const StringName & p_class ) ;
2017-01-03 02:03:46 +00:00
static bool class_exists ( const StringName & p_class ) ;
static bool is_parent_class ( const StringName & p_class , const StringName & p_inherits ) ;
2021-06-17 22:03:09 +00:00
static bool can_instantiate ( const StringName & p_class ) ;
2022-03-10 07:17:38 +00:00
static bool is_virtual ( const StringName & p_class ) ;
2021-06-17 22:03:09 +00:00
static Object * instantiate ( const StringName & p_class ) ;
2021-11-24 09:22:12 +00:00
static void set_object_extension_instance ( Object * p_object , const StringName & p_class , GDExtensionClassInstancePtr p_instance ) ;
2021-06-19 15:58:49 +00:00
2017-01-03 02:03:46 +00:00
static APIType get_api_type ( const StringName & p_class ) ;
2016-09-14 22:37:37 +00:00
2023-06-23 14:39:51 +00:00
static uint32_t get_api_hash ( APIType p_api ) ;
2014-02-10 01:10:30 +00:00
2023-02-03 10:42:51 +00:00
template < typename >
struct member_function_traits ;
template < typename R , typename T , typename . . . Args >
struct member_function_traits < R ( T : : * ) ( Args . . . ) > {
using return_type = R ;
} ;
template < typename R , typename T , typename . . . Args >
struct member_function_traits < R ( T : : * ) ( Args . . . ) const > {
using return_type = R ;
} ;
template < typename R , typename . . . Args >
struct member_function_traits < R ( * ) ( Args . . . ) > {
using return_type = R ;
} ;
2022-03-19 12:18:52 +00:00
template < class N , class M , typename . . . VarArgs >
static MethodBind * 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.
const Variant * argptrs [ sizeof . . . ( p_args ) + 1 ] ;
for ( uint32_t i = 0 ; i < sizeof . . . ( p_args ) ; i + + ) {
argptrs [ i ] = & args [ i ] ;
}
2014-02-10 01:10:30 +00:00
MethodBind * bind = create_method_bind ( p_method ) ;
2023-02-03 10:42:51 +00:00
if constexpr ( std : : is_same < typename member_function_traits < M > : : return_type , Object * > : : value ) {
bind - > set_return_type_is_raw_object_ptr ( true ) ;
}
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
return bind_methodfi ( METHOD_FLAGS_DEFAULT , bind , false , p_method_name , sizeof . . . ( p_args ) = = 0 ? nullptr : ( const Variant * * ) argptrs , sizeof . . . ( p_args ) ) ;
2014-02-10 01:10:30 +00:00
}
2022-03-19 12:18:52 +00:00
template < class N , class M , typename . . . VarArgs >
static MethodBind * bind_static_method ( const StringName & p_class , 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.
const Variant * argptrs [ sizeof . . . ( p_args ) + 1 ] ;
for ( uint32_t i = 0 ; i < sizeof . . . ( p_args ) ; i + + ) {
argptrs [ i ] = & args [ i ] ;
}
MethodBind * bind = create_static_method_bind ( p_method ) ;
bind - > set_instance_class ( p_class ) ;
2023-02-03 10:42:51 +00:00
if constexpr ( std : : is_same < typename member_function_traits < M > : : return_type , Object * > : : value ) {
bind - > set_return_type_is_raw_object_ptr ( true ) ;
}
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
return bind_methodfi ( METHOD_FLAGS_DEFAULT , bind , false , p_method_name , sizeof . . . ( p_args ) = = 0 ? nullptr : ( const Variant * * ) argptrs , sizeof . . . ( p_args ) ) ;
}
template < class N , class M , typename . . . VarArgs >
static MethodBind * bind_compatibility_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.
const Variant * argptrs [ sizeof . . . ( p_args ) + 1 ] ;
for ( uint32_t i = 0 ; i < sizeof . . . ( p_args ) ; i + + ) {
argptrs [ i ] = & args [ i ] ;
}
MethodBind * bind = create_method_bind ( p_method ) ;
if constexpr ( std : : is_same < typename member_function_traits < M > : : return_type , Object * > : : value ) {
bind - > set_return_type_is_raw_object_ptr ( true ) ;
}
return bind_methodfi ( METHOD_FLAGS_DEFAULT , bind , true , p_method_name , sizeof . . . ( p_args ) = = 0 ? nullptr : ( const Variant * * ) argptrs , sizeof . . . ( p_args ) ) ;
}
template < class N , class M , typename . . . VarArgs >
static MethodBind * bind_compatibility_static_method ( const StringName & p_class , 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.
const Variant * argptrs [ sizeof . . . ( p_args ) + 1 ] ;
for ( uint32_t i = 0 ; i < sizeof . . . ( p_args ) ; i + + ) {
argptrs [ i ] = & args [ i ] ;
}
MethodBind * bind = create_static_method_bind ( p_method ) ;
bind - > set_instance_class ( p_class ) ;
if constexpr ( std : : is_same < typename member_function_traits < M > : : return_type , Object * > : : value ) {
bind - > set_return_type_is_raw_object_ptr ( true ) ;
}
return bind_methodfi ( METHOD_FLAGS_DEFAULT , bind , true , p_method_name , sizeof . . . ( p_args ) = = 0 ? nullptr : ( const Variant * * ) argptrs , sizeof . . . ( p_args ) ) ;
2020-01-01 10:39:07 +00:00
}
2014-02-10 01:10:30 +00:00
template < class M >
2021-07-19 17:25:15 +00:00
static MethodBind * bind_vararg_method ( uint32_t p_flags , const StringName & p_name , M p_method , const MethodInfo & p_info = MethodInfo ( ) , const Vector < Variant > & p_default_args = Vector < Variant > ( ) , bool p_return_nil_is_variant = true ) {
2014-02-10 01:10:30 +00:00
GLOBAL_LOCK_FUNCTION ;
2020-01-02 08:31:43 +00:00
MethodBind * bind = create_vararg_method_bind ( p_method , p_info , p_return_nil_is_variant ) ;
2020-04-01 23:20:12 +00:00
ERR_FAIL_COND_V ( ! bind , nullptr ) ;
2016-08-06 00:20:59 +00:00
2023-02-03 10:42:51 +00:00
if constexpr ( std : : is_same < typename member_function_traits < M > : : return_type , Object * > : : value ) {
bind - > set_return_type_is_raw_object_ptr ( true ) ;
}
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
return _bind_vararg_method ( bind , p_name , p_default_args , false ) ;
}
2014-02-10 01:10:30 +00:00
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
template < class M >
static MethodBind * bind_compatibility_vararg_method ( uint32_t p_flags , const StringName & p_name , M p_method , const MethodInfo & p_info = MethodInfo ( ) , const Vector < Variant > & p_default_args = Vector < Variant > ( ) , bool p_return_nil_is_variant = true ) {
GLOBAL_LOCK_FUNCTION ;
2014-02-10 01:10:30 +00:00
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
MethodBind * bind = create_vararg_method_bind ( p_method , p_info , p_return_nil_is_variant ) ;
ERR_FAIL_COND_V ( ! bind , nullptr ) ;
2014-02-10 01:10:30 +00:00
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
if constexpr ( std : : is_same < typename member_function_traits < M > : : return_type , Object * > : : value ) {
bind - > set_return_type_is_raw_object_ptr ( true ) ;
2014-02-10 01:10:30 +00:00
}
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
return _bind_vararg_method ( bind , p_name , p_default_args , true ) ;
2014-02-10 01:10:30 +00:00
}
2021-06-04 17:33:48 +00:00
static void bind_method_custom ( const StringName & p_class , MethodBind * p_method ) ;
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
static void bind_compatibility_method_custom ( const StringName & p_class , MethodBind * p_method ) ;
2021-06-04 17:33:48 +00:00
2021-07-19 17:25:15 +00:00
static void add_signal ( const StringName & p_class , const MethodInfo & p_signal ) ;
static bool has_signal ( const StringName & p_class , const StringName & p_signal , bool p_no_inheritance = false ) ;
static bool get_signal ( const StringName & p_class , const StringName & p_signal , MethodInfo * r_signal ) ;
static void get_signal_list ( const StringName & p_class , List < MethodInfo > * p_signals , bool p_no_inheritance = false ) ;
2021-11-08 20:53:41 +00:00
static void add_property_group ( const StringName & p_class , const String & p_name , const String & p_prefix = " " , int p_indent_depth = 0 ) ;
static void add_property_subgroup ( const StringName & p_class , const String & p_name , const String & p_prefix = " " , int p_indent_depth = 0 ) ;
2021-10-27 16:29:44 +00:00
static void add_property_array_count ( const StringName & p_class , const String & p_label , const StringName & p_count_property , const StringName & p_count_setter , const StringName & p_count_getter , const String & p_array_element_prefix , uint32_t p_count_usage = PROPERTY_USAGE_DEFAULT ) ;
2021-08-31 08:48:45 +00:00
static void add_property_array ( const StringName & p_class , const StringName & p_path , const String & p_array_element_prefix ) ;
2021-07-19 17:25:15 +00:00
static void add_property ( const StringName & p_class , const PropertyInfo & p_pinfo , const StringName & p_setter , const StringName & p_getter , int p_index = - 1 ) ;
static void set_property_default_value ( const StringName & p_class , const StringName & p_name , const Variant & p_default ) ;
2021-08-12 18:26:47 +00:00
static void add_linked_property ( const StringName & p_class , const String & p_property , const String & p_linked_property ) ;
2021-07-19 17:25:15 +00:00
static void get_property_list ( const StringName & p_class , List < PropertyInfo > * p_list , bool p_no_inheritance = false , const Object * p_validator = nullptr ) ;
static bool get_property_info ( const StringName & p_class , const StringName & p_property , PropertyInfo * r_info , bool p_no_inheritance = false , const Object * p_validator = nullptr ) ;
2022-07-20 23:18:14 +00:00
static void get_linked_properties_info ( const StringName & p_class , const StringName & p_property , List < StringName > * r_properties , bool p_no_inheritance = false ) ;
2020-04-01 23:20:12 +00:00
static bool set_property ( Object * p_object , const StringName & p_property , const Variant & p_value , bool * r_valid = nullptr ) ;
2014-02-10 01:10:30 +00:00
static bool get_property ( Object * p_object , const StringName & p_property , Variant & r_value ) ;
2017-01-04 20:37:45 +00:00
static bool has_property ( const StringName & p_class , const StringName & p_property , bool p_no_inheritance = false ) ;
2020-04-01 23:20:12 +00:00
static int get_property_index ( const StringName & p_class , const StringName & p_property , bool * r_is_valid = nullptr ) ;
static Variant : : Type get_property_type ( const StringName & p_class , const StringName & p_property , bool * r_is_valid = nullptr ) ;
2021-07-19 17:25:15 +00:00
static StringName get_property_setter ( const StringName & p_class , const StringName & p_property ) ;
static StringName get_property_getter ( const StringName & p_class , const StringName & p_property ) ;
2017-03-05 15:44:50 +00:00
2021-07-19 17:25:15 +00:00
static bool has_method ( const StringName & p_class , const StringName & p_method , bool p_no_inheritance = false ) ;
static void set_method_flags ( const StringName & p_class , const StringName & p_method , int p_flags ) ;
2017-03-05 15:44:50 +00:00
2021-07-19 17:25:15 +00:00
static void get_method_list ( const StringName & p_class , List < MethodInfo > * p_methods , bool p_no_inheritance = false , bool p_exclude_from_properties = false ) ;
static bool get_method_info ( const StringName & p_class , const StringName & p_method , MethodInfo * r_info , bool p_no_inheritance = false , bool p_exclude_from_properties = false ) ;
static MethodBind * get_method ( const StringName & p_class , const StringName & p_name ) ;
Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.
```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```
**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.
**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.
**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-04-25 18:53:07 +00:00
static MethodBind * get_method_with_compatibility ( const StringName & p_class , const StringName & p_name , uint64_t p_hash , bool * r_method_exists = nullptr , bool * r_is_deprecated = nullptr ) ;
static Vector < uint32_t > get_method_compatibility_hashes ( const StringName & p_class , const StringName & p_name ) ;
2014-02-10 01:10:30 +00:00
2021-08-22 01:52:44 +00:00
static void add_virtual_method ( const StringName & p_class , const MethodInfo & p_method , bool p_virtual = true , const Vector < String > & p_arg_names = Vector < String > ( ) , bool p_object_core = false ) ;
2017-01-03 02:03:46 +00:00
static void get_virtual_methods ( const StringName & p_class , List < MethodInfo > * p_methods , bool p_no_inheritance = false ) ;
2016-03-08 23:00:52 +00:00
2022-06-24 09:16:37 +00:00
static void bind_integer_constant ( const StringName & p_class , const StringName & p_enum , const StringName & p_name , int64_t p_constant , bool p_is_bitfield = false ) ;
2017-01-03 02:03:46 +00:00
static void get_integer_constant_list ( const StringName & p_class , List < String > * p_constants , bool p_no_inheritance = false ) ;
2022-05-09 09:47:10 +00:00
static int64_t get_integer_constant ( const StringName & p_class , const StringName & p_name , bool * p_success = nullptr ) ;
2020-06-10 21:13:25 +00:00
static bool has_integer_constant ( const StringName & p_class , const StringName & p_name , bool p_no_inheritance = false ) ;
2017-08-20 15:45:01 +00:00
static StringName get_integer_constant_enum ( const StringName & p_class , const StringName & p_name , bool p_no_inheritance = false ) ;
2022-06-24 09:16:37 +00:00
static StringName get_integer_constant_bitfield ( const StringName & p_class , const StringName & p_name , bool p_no_inheritance = false ) ;
2017-08-20 15:45:01 +00:00
static void get_enum_list ( const StringName & p_class , List < StringName > * p_enums , bool p_no_inheritance = false ) ;
static void get_enum_constants ( const StringName & p_class , const StringName & p_enum , List < StringName > * p_constants , bool p_no_inheritance = false ) ;
2020-06-10 21:13:25 +00:00
static bool has_enum ( const StringName & p_class , const StringName & p_name , bool p_no_inheritance = false ) ;
2022-06-24 09:16:37 +00:00
static bool is_enum_bitfield ( const StringName & p_class , const StringName & p_name , bool p_no_inheritance = false ) ;
2017-08-20 15:45:01 +00:00
2021-08-24 18:16:25 +00:00
static void set_method_error_return_values ( const StringName & p_class , const StringName & p_method , const Vector < Error > & p_values ) ;
static Vector < Error > get_method_error_return_values ( const StringName & p_class , const StringName & p_method ) ;
2020-04-01 23:20:12 +00:00
static Variant class_get_default_property_value ( const StringName & p_class , const StringName & p_property , bool * r_valid = nullptr ) ;
2018-11-08 14:30:02 +00:00
2021-07-19 17:25:15 +00:00
static void set_class_enabled ( const StringName & p_class , bool p_enable ) ;
static bool is_class_enabled ( const StringName & p_class ) ;
2014-02-10 01:10:30 +00:00
2021-07-19 17:25:15 +00:00
static bool is_class_exposed ( const StringName & p_class ) ;
2017-10-09 21:49:17 +00:00
2017-01-03 02:03:46 +00:00
static void add_resource_base_extension ( const StringName & p_extension , const StringName & p_class ) ;
2014-02-10 01:10:30 +00:00
static void get_resource_base_extensions ( List < String > * p_extensions ) ;
2017-01-03 02:03:46 +00:00
static void get_extensions_for_type ( const StringName & p_class , List < String > * p_extensions ) ;
2021-07-23 19:01:18 +00:00
static bool is_resource_extension ( const StringName & p_extension ) ;
2014-02-10 01:10:30 +00:00
2017-01-03 02:03:46 +00:00
static void add_compatibility_class ( const StringName & p_class , const StringName & p_fallback ) ;
2022-07-14 12:18:18 +00:00
static StringName get_compatibility_class ( const StringName & p_class ) ;
2016-09-14 22:37:37 +00:00
static void set_current_api ( APIType p_api ) ;
2019-04-06 14:12:59 +00:00
static APIType get_current_api ( ) ;
2019-06-01 13:42:22 +00:00
static void cleanup_defaults ( ) ;
2014-02-10 01:10:30 +00:00
static void cleanup ( ) ;
2022-03-14 14:52:03 +00:00
static void register_native_struct ( const StringName & p_name , const String & p_code , uint64_t p_current_size ) ;
static void get_native_struct_list ( List < StringName > * r_names ) ;
static String get_native_struct_code ( const StringName & p_name ) ;
static uint64_t get_native_struct_size ( const StringName & p_name ) ; // Used for asserting
2014-02-10 01:10:30 +00:00
} ;
2017-08-20 15:45:01 +00:00
# define BIND_ENUM_CONSTANT(m_constant) \
2021-08-13 14:46:14 +00:00
: : ClassDB : : bind_integer_constant ( get_class_static ( ) , __constant_get_enum_name ( m_constant , # m_constant ) , # m_constant , m_constant ) ;
2017-08-20 15:45:01 +00:00
2022-06-24 09:16:37 +00:00
# define BIND_BITFIELD_FLAG(m_constant) \
: : ClassDB : : bind_integer_constant ( get_class_static ( ) , __constant_get_bitfield_name ( m_constant , # m_constant ) , # m_constant , m_constant , true ) ;
2022-12-29 15:30:18 +00:00
# define BIND_CONSTANT(m_constant) \
: : ClassDB : : bind_integer_constant ( get_class_static ( ) , StringName ( ) , # m_constant , m_constant ) ;
# ifdef DEBUG_METHODS_ENABLED
2021-08-24 18:16:25 +00:00
_FORCE_INLINE_ void errarray_add_str ( Vector < Error > & arr ) {
}
_FORCE_INLINE_ void errarray_add_str ( Vector < Error > & arr , const Error & p_err ) {
arr . push_back ( p_err ) ;
}
template < class . . . P >
_FORCE_INLINE_ void errarray_add_str ( Vector < Error > & arr , const Error & p_err , P . . . p_args ) {
arr . push_back ( p_err ) ;
errarray_add_str ( arr , p_args . . . ) ;
}
template < class . . . P >
_FORCE_INLINE_ Vector < Error > errarray ( P . . . p_args ) {
Vector < Error > arr ;
errarray_add_str ( arr , p_args . . . ) ;
return arr ;
}
# define BIND_METHOD_ERR_RETURN_DOC(m_method, ...) \
: : ClassDB : : set_method_error_return_values ( get_class_static ( ) , m_method , errarray ( __VA_ARGS__ ) ) ;
2017-08-20 15:45:01 +00:00
# else
2021-08-24 18:16:25 +00:00
# define BIND_METHOD_ERR_RETURN_DOC(m_method, ...)
2017-08-20 15:45:01 +00:00
# endif
2014-02-10 01:10:30 +00:00
2022-07-14 12:18:18 +00:00
# define GDREGISTER_CLASS(m_class) \
if ( m_class : : _class_is_enabled ) { \
: : ClassDB : : register_class < m_class > ( ) ; \
2021-07-11 22:30:33 +00:00
}
2022-07-14 12:18:18 +00:00
# define GDREGISTER_VIRTUAL_CLASS(m_class) \
if ( m_class : : _class_is_enabled ) { \
: : ClassDB : : register_class < m_class > ( true ) ; \
2022-03-10 07:17:38 +00:00
}
# define GDREGISTER_ABSTRACT_CLASS(m_class) \
2022-07-14 12:18:18 +00:00
if ( m_class : : _class_is_enabled ) { \
2022-03-10 07:17:38 +00:00
: : ClassDB : : register_abstract_class < m_class > ( ) ; \
2021-07-11 22:30:33 +00:00
}
2022-03-14 14:52:03 +00:00
# define GDREGISTER_NATIVE_STRUCT(m_class, m_code) ClassDB::register_native_struct(#m_class, m_code, sizeof(m_class))
2021-07-11 22:30:33 +00:00
# include "core/disabled_classes.gen.h"
2017-01-16 07:04:19 +00:00
# endif // CLASS_DB_H