class_classdb.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ClassDB.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ClassDB:
  6. ClassDB
  7. =======
  8. **Inherits:** :ref:`Object<class_Object>`
  9. Class information repository.
  10. Description
  11. -----------
  12. Provides access to metadata stored for every available class.
  13. Methods
  14. -------
  15. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`can_instance<class_ClassDB_method_can_instance>` **(** :ref:`String<class_String>` class **)** |const| |
  17. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`class_exists<class_ClassDB_method_class_exists>` **(** :ref:`String<class_String>` class **)** |const| |
  19. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_String>` | :ref:`class_get_category<class_ClassDB_method_class_get_category>` **(** :ref:`String<class_String>` class **)** |const| |
  21. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`class_get_enum_constants<class_ClassDB_method_class_get_enum_constants>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` enum, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  23. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`class_get_enum_list<class_ClassDB_method_class_get_enum_list>` **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  25. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`class_get_integer_constant<class_ClassDB_method_class_get_integer_constant>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name **)** |const| |
  27. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`String<class_String>` | :ref:`class_get_integer_constant_enum<class_ClassDB_method_class_get_integer_constant_enum>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  29. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`class_get_integer_constant_list<class_ClassDB_method_class_get_integer_constant_list>` **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  31. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Array<class_Array>` | :ref:`class_get_method_list<class_ClassDB_method_class_get_method_list>` **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  33. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Variant<class_Variant>` | :ref:`class_get_property<class_ClassDB_method_class_get_property>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` property **)** |const| |
  35. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Array<class_Array>` | :ref:`class_get_property_list<class_ClassDB_method_class_get_property_list>` **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  37. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Dictionary<class_Dictionary>` | :ref:`class_get_signal<class_ClassDB_method_class_get_signal>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` signal **)** |const| |
  39. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Array<class_Array>` | :ref:`class_get_signal_list<class_ClassDB_method_class_get_signal_list>` **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  41. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`class_has_enum<class_ClassDB_method_class_has_enum>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  43. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`bool<class_bool>` | :ref:`class_has_integer_constant<class_ClassDB_method_class_has_integer_constant>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name **)** |const| |
  45. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`bool<class_bool>` | :ref:`class_has_method<class_ClassDB_method_class_has_method>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` method, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  47. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`bool<class_bool>` | :ref:`class_has_signal<class_ClassDB_method_class_has_signal>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` signal **)** |const| |
  49. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`class_set_property<class_ClassDB_method_class_set_property>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)** |const| |
  51. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_class_list<class_ClassDB_method_get_class_list>` **(** **)** |const| |
  53. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_inheriters_from_class<class_ClassDB_method_get_inheriters_from_class>` **(** :ref:`String<class_String>` class **)** |const| |
  55. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`String<class_String>` | :ref:`get_parent_class<class_ClassDB_method_get_parent_class>` **(** :ref:`String<class_String>` class **)** |const| |
  57. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Variant<class_Variant>` | :ref:`instance<class_ClassDB_method_instance>` **(** :ref:`String<class_String>` class **)** |const| |
  59. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`is_class_enabled<class_ClassDB_method_is_class_enabled>` **(** :ref:`String<class_String>` class **)** |const| |
  61. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`bool<class_bool>` | :ref:`is_parent_class<class_ClassDB_method_is_parent_class>` **(** :ref:`String<class_String>` class, :ref:`String<class_String>` inherits **)** |const| |
  63. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. Method Descriptions
  65. -------------------
  66. .. _class_ClassDB_method_can_instance:
  67. - :ref:`bool<class_bool>` **can_instance** **(** :ref:`String<class_String>` class **)** |const|
  68. Returns ``true`` if you can instance objects from the specified ``class``, ``false`` in other case.
  69. ----
  70. .. _class_ClassDB_method_class_exists:
  71. - :ref:`bool<class_bool>` **class_exists** **(** :ref:`String<class_String>` class **)** |const|
  72. Returns whether the specified ``class`` is available or not.
  73. ----
  74. .. _class_ClassDB_method_class_get_category:
  75. - :ref:`String<class_String>` **class_get_category** **(** :ref:`String<class_String>` class **)** |const|
  76. Returns a category associated with the class for use in documentation and the Asset Library. Debug mode required.
  77. ----
  78. .. _class_ClassDB_method_class_get_enum_constants:
  79. - :ref:`PoolStringArray<class_PoolStringArray>` **class_get_enum_constants** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` enum, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  80. Returns an array with all the keys in ``enum`` of ``class`` or its ancestry.
  81. ----
  82. .. _class_ClassDB_method_class_get_enum_list:
  83. - :ref:`PoolStringArray<class_PoolStringArray>` **class_get_enum_list** **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  84. Returns an array with all the enums of ``class`` or its ancestry.
  85. ----
  86. .. _class_ClassDB_method_class_get_integer_constant:
  87. - :ref:`int<class_int>` **class_get_integer_constant** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name **)** |const|
  88. Returns the value of the integer constant ``name`` of ``class`` or its ancestry. Always returns 0 when the constant could not be found.
  89. ----
  90. .. _class_ClassDB_method_class_get_integer_constant_enum:
  91. - :ref:`String<class_String>` **class_get_integer_constant_enum** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  92. Returns which enum the integer constant ``name`` of ``class`` or its ancestry belongs to.
  93. ----
  94. .. _class_ClassDB_method_class_get_integer_constant_list:
  95. - :ref:`PoolStringArray<class_PoolStringArray>` **class_get_integer_constant_list** **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  96. Returns an array with the names all the integer constants of ``class`` or its ancestry.
  97. ----
  98. .. _class_ClassDB_method_class_get_method_list:
  99. - :ref:`Array<class_Array>` **class_get_method_list** **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  100. Returns an array with all the methods of ``class`` or its ancestry if ``no_inheritance`` is ``false``. Every element of the array is a :ref:`Dictionary<class_Dictionary>` with the following keys: ``args``, ``default_args``, ``flags``, ``id``, ``name``, ``return: (class_name, hint, hint_string, name, type, usage)``.
  101. **Note:** In exported release builds the debug info is not available, so the returned dictionaries will contain only method names.
  102. ----
  103. .. _class_ClassDB_method_class_get_property:
  104. - :ref:`Variant<class_Variant>` **class_get_property** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` property **)** |const|
  105. Returns the value of ``property`` of ``class`` or its ancestry.
  106. ----
  107. .. _class_ClassDB_method_class_get_property_list:
  108. - :ref:`Array<class_Array>` **class_get_property_list** **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  109. Returns an array with all the properties of ``class`` or its ancestry if ``no_inheritance`` is ``false``.
  110. ----
  111. .. _class_ClassDB_method_class_get_signal:
  112. - :ref:`Dictionary<class_Dictionary>` **class_get_signal** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` signal **)** |const|
  113. Returns the ``signal`` data of ``class`` or its ancestry. The returned value is a :ref:`Dictionary<class_Dictionary>` with the following keys: ``args``, ``default_args``, ``flags``, ``id``, ``name``, ``return: (class_name, hint, hint_string, name, type, usage)``.
  114. ----
  115. .. _class_ClassDB_method_class_get_signal_list:
  116. - :ref:`Array<class_Array>` **class_get_signal_list** **(** :ref:`String<class_String>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  117. Returns an array with all the signals of ``class`` or its ancestry if ``no_inheritance`` is ``false``. Every element of the array is a :ref:`Dictionary<class_Dictionary>` as described in :ref:`class_get_signal<class_ClassDB_method_class_get_signal>`.
  118. ----
  119. .. _class_ClassDB_method_class_has_enum:
  120. - :ref:`bool<class_bool>` **class_has_enum** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  121. Returns whether ``class`` or its ancestry has an enum called ``name`` or not.
  122. ----
  123. .. _class_ClassDB_method_class_has_integer_constant:
  124. - :ref:`bool<class_bool>` **class_has_integer_constant** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` name **)** |const|
  125. Returns whether ``class`` or its ancestry has an integer constant called ``name`` or not.
  126. ----
  127. .. _class_ClassDB_method_class_has_method:
  128. - :ref:`bool<class_bool>` **class_has_method** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` method, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  129. Returns whether ``class`` (or its ancestry if ``no_inheritance`` is ``false``) has a method called ``method`` or not.
  130. ----
  131. .. _class_ClassDB_method_class_has_signal:
  132. - :ref:`bool<class_bool>` **class_has_signal** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` signal **)** |const|
  133. Returns whether ``class`` or its ancestry has a signal called ``signal`` or not.
  134. ----
  135. .. _class_ClassDB_method_class_set_property:
  136. - :ref:`Error<enum_@GlobalScope_Error>` **class_set_property** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)** |const|
  137. Sets ``property`` value of ``class`` to ``value``.
  138. ----
  139. .. _class_ClassDB_method_get_class_list:
  140. - :ref:`PoolStringArray<class_PoolStringArray>` **get_class_list** **(** **)** |const|
  141. Returns the names of all the classes available.
  142. ----
  143. .. _class_ClassDB_method_get_inheriters_from_class:
  144. - :ref:`PoolStringArray<class_PoolStringArray>` **get_inheriters_from_class** **(** :ref:`String<class_String>` class **)** |const|
  145. Returns the names of all the classes that directly or indirectly inherit from ``class``.
  146. ----
  147. .. _class_ClassDB_method_get_parent_class:
  148. - :ref:`String<class_String>` **get_parent_class** **(** :ref:`String<class_String>` class **)** |const|
  149. Returns the parent class of ``class``.
  150. ----
  151. .. _class_ClassDB_method_instance:
  152. - :ref:`Variant<class_Variant>` **instance** **(** :ref:`String<class_String>` class **)** |const|
  153. Creates an instance of ``class``.
  154. ----
  155. .. _class_ClassDB_method_is_class_enabled:
  156. - :ref:`bool<class_bool>` **is_class_enabled** **(** :ref:`String<class_String>` class **)** |const|
  157. Returns whether this ``class`` is enabled or not.
  158. ----
  159. .. _class_ClassDB_method_is_parent_class:
  160. - :ref:`bool<class_bool>` **is_parent_class** **(** :ref:`String<class_String>` class, :ref:`String<class_String>` inherits **)** |const|
  161. Returns whether ``inherits`` is an ancestor of ``class`` or not.
  162. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  163. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  164. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`