class_db.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. /*************************************************************************/
  2. /* class_db.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef CLASS_DB_H
  31. #define CLASS_DB_H
  32. #include "core/object/method_bind.h"
  33. #include "core/object/object.h"
  34. #include "core/string/print_string.h"
  35. /** To bind more then 6 parameters include this:
  36. *
  37. */
  38. // Makes callable_mp readily available in all classes connecting signals.
  39. // Needs to come after method_bind and object have been included.
  40. #include "core/object/callable_method_pointer.h"
  41. #define DEFVAL(m_defval) (m_defval)
  42. struct MethodDefinition {
  43. StringName name;
  44. Vector<StringName> args;
  45. MethodDefinition() {}
  46. MethodDefinition(const char *p_name) :
  47. name(p_name) {}
  48. MethodDefinition(const StringName &p_name) :
  49. name(p_name) {}
  50. };
  51. MethodDefinition D_METHOD(const char *p_name);
  52. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1);
  53. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2);
  54. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3);
  55. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4);
  56. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5);
  57. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6);
  58. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7);
  59. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8);
  60. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9);
  61. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10);
  62. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11);
  63. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12);
  64. MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12, const char *p_arg13);
  65. class ClassDB {
  66. public:
  67. enum APIType {
  68. API_CORE,
  69. API_EDITOR,
  70. API_EXTENSION,
  71. API_EDITOR_EXTENSION,
  72. API_NONE
  73. };
  74. public:
  75. struct PropertySetGet {
  76. int index;
  77. StringName setter;
  78. StringName getter;
  79. MethodBind *_setptr;
  80. MethodBind *_getptr;
  81. Variant::Type type;
  82. };
  83. struct ClassInfo {
  84. APIType api = API_NONE;
  85. ClassInfo *inherits_ptr = nullptr;
  86. void *class_ptr = nullptr;
  87. ObjectNativeExtension *native_extension = nullptr;
  88. HashMap<StringName, MethodBind *> method_map;
  89. HashMap<StringName, int> constant_map;
  90. HashMap<StringName, List<StringName>> enum_map;
  91. HashMap<StringName, MethodInfo> signal_map;
  92. List<PropertyInfo> property_list;
  93. HashMap<StringName, PropertyInfo> property_map;
  94. #ifdef DEBUG_METHODS_ENABLED
  95. List<StringName> constant_order;
  96. List<StringName> method_order;
  97. Set<StringName> methods_in_properties;
  98. List<MethodInfo> virtual_methods;
  99. Map<StringName, MethodInfo> virtual_methods_map;
  100. StringName category;
  101. Map<StringName, Vector<Error>> method_error_values;
  102. #endif
  103. HashMap<StringName, PropertySetGet> property_setget;
  104. StringName inherits;
  105. StringName name;
  106. bool disabled = false;
  107. bool exposed = false;
  108. Object *(*creation_func)() = nullptr;
  109. ClassInfo() {}
  110. ~ClassInfo() {}
  111. };
  112. template <class T>
  113. static Object *creator() {
  114. return memnew(T);
  115. }
  116. static RWLock lock;
  117. static HashMap<StringName, ClassInfo> classes;
  118. static HashMap<StringName, StringName> resource_base_extensions;
  119. static HashMap<StringName, StringName> compat_classes;
  120. static MethodBind *bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const MethodDefinition &method_name, const Variant **p_defs, int p_defcount);
  121. static APIType current_api;
  122. static void _add_class2(const StringName &p_class, const StringName &p_inherits);
  123. static HashMap<StringName, HashMap<StringName, Variant>> default_values;
  124. static Set<StringName> default_values_cached;
  125. private:
  126. // Non-locking variants of get_parent_class and is_parent_class.
  127. static StringName _get_parent_class(const StringName &p_class);
  128. static bool _is_parent_class(const StringName &p_class, const StringName &p_inherits);
  129. public:
  130. // DO NOT USE THIS!!!!!! NEEDS TO BE PUBLIC BUT DO NOT USE NO MATTER WHAT!!!
  131. template <class T>
  132. static void _add_class() {
  133. _add_class2(T::get_class_static(), T::get_parent_class_static());
  134. }
  135. template <class T>
  136. static void register_class() {
  137. GLOBAL_LOCK_FUNCTION;
  138. T::initialize_class();
  139. ClassInfo *t = classes.getptr(T::get_class_static());
  140. ERR_FAIL_COND(!t);
  141. t->creation_func = &creator<T>;
  142. t->exposed = true;
  143. t->class_ptr = T::get_class_ptr_static();
  144. t->api = current_api;
  145. T::register_custom_data_to_otdb();
  146. }
  147. template <class T>
  148. static void register_virtual_class() {
  149. GLOBAL_LOCK_FUNCTION;
  150. T::initialize_class();
  151. ClassInfo *t = classes.getptr(T::get_class_static());
  152. ERR_FAIL_COND(!t);
  153. t->exposed = true;
  154. t->class_ptr = T::get_class_ptr_static();
  155. t->api = current_api;
  156. //nothing
  157. }
  158. static void register_extension_class(ObjectNativeExtension *p_extension);
  159. static void unregister_extension_class(const StringName &p_class);
  160. template <class T>
  161. static Object *_create_ptr_func() {
  162. return T::create();
  163. }
  164. template <class T>
  165. static void register_custom_instance_class() {
  166. GLOBAL_LOCK_FUNCTION;
  167. T::initialize_class();
  168. ClassInfo *t = classes.getptr(T::get_class_static());
  169. ERR_FAIL_COND(!t);
  170. t->creation_func = &_create_ptr_func<T>;
  171. t->exposed = true;
  172. t->class_ptr = T::get_class_ptr_static();
  173. t->api = current_api;
  174. T::register_custom_data_to_otdb();
  175. }
  176. static void get_class_list(List<StringName> *p_classes);
  177. static void get_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes);
  178. static void get_direct_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes);
  179. static StringName get_parent_class_nocheck(const StringName &p_class);
  180. static StringName get_parent_class(const StringName &p_class);
  181. static StringName get_compatibility_remapped_class(const StringName &p_class);
  182. static bool class_exists(const StringName &p_class);
  183. static bool is_parent_class(const StringName &p_class, const StringName &p_inherits);
  184. static bool can_instantiate(const StringName &p_class);
  185. static Object *instantiate(const StringName &p_class);
  186. static Object *construct_object(Object *(*p_create_func)(), ObjectNativeExtension *p_extension);
  187. static void instance_get_native_extension_data(ObjectNativeExtension **r_extension, GDExtensionClassInstancePtr *r_extension_instance, Object *p_base);
  188. static APIType get_api_type(const StringName &p_class);
  189. static uint64_t get_api_hash(APIType p_api);
  190. template <class N, class M>
  191. static MethodBind *bind_method(N p_method_name, M p_method) {
  192. MethodBind *bind = create_method_bind(p_method);
  193. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, nullptr, 0); //use static function, much smaller binary usage
  194. }
  195. template <class N, class M>
  196. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1) {
  197. MethodBind *bind = create_method_bind(p_method);
  198. const Variant *ptr[1] = { &p_def1 };
  199. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 1);
  200. }
  201. template <class N, class M>
  202. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2) {
  203. MethodBind *bind = create_method_bind(p_method);
  204. const Variant *ptr[2] = { &p_def1, &p_def2 };
  205. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 2);
  206. }
  207. template <class N, class M>
  208. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3) {
  209. MethodBind *bind = create_method_bind(p_method);
  210. const Variant *ptr[3] = { &p_def1, &p_def2, &p_def3 };
  211. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 3);
  212. }
  213. template <class N, class M>
  214. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4) {
  215. MethodBind *bind = create_method_bind(p_method);
  216. const Variant *ptr[4] = { &p_def1, &p_def2, &p_def3, &p_def4 };
  217. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 4);
  218. }
  219. template <class N, class M>
  220. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5) {
  221. MethodBind *bind = create_method_bind(p_method);
  222. const Variant *ptr[5] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5 };
  223. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 5);
  224. }
  225. template <class N, class M>
  226. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5, const Variant &p_def6) {
  227. MethodBind *bind = create_method_bind(p_method);
  228. const Variant *ptr[6] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5, &p_def6 };
  229. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 6);
  230. }
  231. template <class N, class M>
  232. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5, const Variant &p_def6, const Variant &p_def7) {
  233. MethodBind *bind = create_method_bind(p_method);
  234. const Variant *ptr[7] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5, &p_def6, &p_def7 };
  235. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 7);
  236. }
  237. template <class N, class M>
  238. static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5, const Variant &p_def6, const Variant &p_def7, const Variant &p_def8) {
  239. MethodBind *bind = create_method_bind(p_method);
  240. const Variant *ptr[8] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5, &p_def6, &p_def7, &p_def8 };
  241. return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, ptr, 8);
  242. }
  243. template <class M>
  244. 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) {
  245. GLOBAL_LOCK_FUNCTION;
  246. MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
  247. ERR_FAIL_COND_V(!bind, nullptr);
  248. bind->set_name(p_name);
  249. bind->set_default_arguments(p_default_args);
  250. String instance_type = bind->get_instance_class();
  251. ClassInfo *type = classes.getptr(instance_type);
  252. if (!type) {
  253. memdelete(bind);
  254. ERR_FAIL_COND_V(!type, nullptr);
  255. }
  256. if (type->method_map.has(p_name)) {
  257. memdelete(bind);
  258. // Overloading not supported
  259. ERR_FAIL_V_MSG(nullptr, "Method already bound: " + instance_type + "::" + p_name + ".");
  260. }
  261. type->method_map[p_name] = bind;
  262. #ifdef DEBUG_METHODS_ENABLED
  263. // FIXME: <reduz> set_return_type is no longer in MethodBind, so I guess it should be moved to vararg method bind
  264. //bind->set_return_type("Variant");
  265. type->method_order.push_back(p_name);
  266. #endif
  267. return bind;
  268. }
  269. static void bind_method_custom(const StringName &p_class, MethodBind *p_method);
  270. static void add_signal(const StringName &p_class, const MethodInfo &p_signal);
  271. static bool has_signal(const StringName &p_class, const StringName &p_signal, bool p_no_inheritance = false);
  272. static bool get_signal(const StringName &p_class, const StringName &p_signal, MethodInfo *r_signal);
  273. static void get_signal_list(const StringName &p_class, List<MethodInfo> *p_signals, bool p_no_inheritance = false);
  274. static void add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix = "");
  275. static void add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix = "");
  276. 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);
  277. static void add_property_array(const StringName &p_class, const StringName &p_path, const String &p_array_element_prefix);
  278. static void add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
  279. static void set_property_default_value(const StringName &p_class, const StringName &p_name, const Variant &p_default);
  280. static void add_linked_property(const StringName &p_class, const String &p_property, const String &p_linked_property);
  281. static void get_property_list(const StringName &p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr);
  282. 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);
  283. static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr);
  284. static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
  285. static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
  286. static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
  287. static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
  288. static StringName get_property_setter(const StringName &p_class, const StringName &p_property);
  289. static StringName get_property_getter(const StringName &p_class, const StringName &p_property);
  290. static bool has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance = false);
  291. static void set_method_flags(const StringName &p_class, const StringName &p_method, int p_flags);
  292. static void get_method_list(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false, bool p_exclude_from_properties = false);
  293. 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);
  294. static MethodBind *get_method(const StringName &p_class, const StringName &p_name);
  295. 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);
  296. static void get_virtual_methods(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false);
  297. static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant);
  298. static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false);
  299. static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = nullptr);
  300. static bool has_integer_constant(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
  301. static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
  302. static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false);
  303. static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false);
  304. static bool has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
  305. static void set_method_error_return_values(const StringName &p_class, const StringName &p_method, const Vector<Error> &p_values);
  306. static Vector<Error> get_method_error_return_values(const StringName &p_class, const StringName &p_method);
  307. static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = nullptr);
  308. static StringName get_category(const StringName &p_node);
  309. static void set_class_enabled(const StringName &p_class, bool p_enable);
  310. static bool is_class_enabled(const StringName &p_class);
  311. static bool is_class_exposed(const StringName &p_class);
  312. static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class);
  313. static void get_resource_base_extensions(List<String> *p_extensions);
  314. static void get_extensions_for_type(const StringName &p_class, List<String> *p_extensions);
  315. static bool is_resource_extension(const StringName &p_extension);
  316. static void add_compatibility_class(const StringName &p_class, const StringName &p_fallback);
  317. static void set_current_api(APIType p_api);
  318. static APIType get_current_api();
  319. static void cleanup_defaults();
  320. static void cleanup();
  321. };
  322. #ifdef DEBUG_METHODS_ENABLED
  323. #define BIND_CONSTANT(m_constant) \
  324. ::ClassDB::bind_integer_constant(get_class_static(), StringName(), #m_constant, m_constant);
  325. #define BIND_ENUM_CONSTANT(m_constant) \
  326. ::ClassDB::bind_integer_constant(get_class_static(), __constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant);
  327. _FORCE_INLINE_ void errarray_add_str(Vector<Error> &arr) {
  328. }
  329. _FORCE_INLINE_ void errarray_add_str(Vector<Error> &arr, const Error &p_err) {
  330. arr.push_back(p_err);
  331. }
  332. template <class... P>
  333. _FORCE_INLINE_ void errarray_add_str(Vector<Error> &arr, const Error &p_err, P... p_args) {
  334. arr.push_back(p_err);
  335. errarray_add_str(arr, p_args...);
  336. }
  337. template <class... P>
  338. _FORCE_INLINE_ Vector<Error> errarray(P... p_args) {
  339. Vector<Error> arr;
  340. errarray_add_str(arr, p_args...);
  341. return arr;
  342. }
  343. #define BIND_METHOD_ERR_RETURN_DOC(m_method, ...) \
  344. ::ClassDB::set_method_error_return_values(get_class_static(), m_method, errarray(__VA_ARGS__));
  345. #else
  346. #define BIND_CONSTANT(m_constant) \
  347. ::ClassDB::bind_integer_constant(get_class_static(), StringName(), #m_constant, m_constant);
  348. #define BIND_ENUM_CONSTANT(m_constant) \
  349. ::ClassDB::bind_integer_constant(get_class_static(), StringName(), #m_constant, m_constant);
  350. #define BIND_METHOD_ERR_RETURN_DOC(m_method, ...)
  351. #endif
  352. #define GDREGISTER_CLASS(m_class) \
  353. if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
  354. ::ClassDB::register_class<m_class>(); \
  355. }
  356. #define GDREGISTER_VIRTUAL_CLASS(m_class) \
  357. if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
  358. ::ClassDB::register_virtual_class<m_class>(); \
  359. }
  360. #include "core/disabled_classes.gen.h"
  361. #endif // CLASS_DB_H