class_classdb.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ClassDB.xml.
  6. .. _class_ClassDB:
  7. ClassDB
  8. =======
  9. **Inherits:** :ref:`Object<class_Object>`
  10. A class information repository.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Provides access to metadata stored for every available class.
  15. .. rst-class:: classref-reftable-group
  16. Methods
  17. -------
  18. .. table::
  19. :widths: auto
  20. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`can_instantiate<class_ClassDB_method_can_instantiate>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  22. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`class_exists<class_ClassDB_method_class_exists>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  24. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`class_get_enum_constants<class_ClassDB_method_class_get_enum_constants>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` enum, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  26. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`class_get_enum_list<class_ClassDB_method_class_get_enum_list>` **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  28. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`class_get_integer_constant<class_ClassDB_method_class_get_integer_constant>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name **)** |const| |
  30. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`StringName<class_StringName>` | :ref:`class_get_integer_constant_enum<class_ClassDB_method_class_get_integer_constant_enum>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  32. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`class_get_integer_constant_list<class_ClassDB_method_class_get_integer_constant_list>` **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  34. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Dictionary[]<class_Dictionary>` | :ref:`class_get_method_list<class_ClassDB_method_class_get_method_list>` **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  36. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Variant<class_Variant>` | :ref:`class_get_property<class_ClassDB_method_class_get_property>` **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` property **)** |const| |
  38. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Dictionary[]<class_Dictionary>` | :ref:`class_get_property_list<class_ClassDB_method_class_get_property_list>` **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  40. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Dictionary<class_Dictionary>` | :ref:`class_get_signal<class_ClassDB_method_class_get_signal>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` signal **)** |const| |
  42. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Dictionary[]<class_Dictionary>` | :ref:`class_get_signal_list<class_ClassDB_method_class_get_signal_list>` **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  44. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`class_has_enum<class_ClassDB_method_class_has_enum>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  46. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`class_has_integer_constant<class_ClassDB_method_class_has_integer_constant>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name **)** |const| |
  48. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | :ref:`class_has_method<class_ClassDB_method_class_has_method>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` method, :ref:`bool<class_bool>` no_inheritance=false **)** |const| |
  50. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`class_has_signal<class_ClassDB_method_class_has_signal>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` signal **)** |const| |
  52. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`class_set_property<class_ClassDB_method_class_set_property>` **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` property, :ref:`Variant<class_Variant>` value **)** |const| |
  54. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_class_list<class_ClassDB_method_get_class_list>` **(** **)** |const| |
  56. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_inheriters_from_class<class_ClassDB_method_get_inheriters_from_class>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  58. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`StringName<class_StringName>` | :ref:`get_parent_class<class_ClassDB_method_get_parent_class>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  60. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Variant<class_Variant>` | :ref:`instantiate<class_ClassDB_method_instantiate>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  62. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`is_class_enabled<class_ClassDB_method_is_class_enabled>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  64. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`is_parent_class<class_ClassDB_method_is_parent_class>` **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` inherits **)** |const| |
  66. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. .. rst-class:: classref-section-separator
  68. ----
  69. .. rst-class:: classref-descriptions-group
  70. Method Descriptions
  71. -------------------
  72. .. _class_ClassDB_method_can_instantiate:
  73. .. rst-class:: classref-method
  74. :ref:`bool<class_bool>` **can_instantiate** **(** :ref:`StringName<class_StringName>` class **)** |const|
  75. Returns ``true`` if objects can be instantiated from the specified ``class``, otherwise returns ``false``.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_ClassDB_method_class_exists:
  79. .. rst-class:: classref-method
  80. :ref:`bool<class_bool>` **class_exists** **(** :ref:`StringName<class_StringName>` class **)** |const|
  81. Returns whether the specified ``class`` is available or not.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_ClassDB_method_class_get_enum_constants:
  85. .. rst-class:: classref-method
  86. :ref:`PackedStringArray<class_PackedStringArray>` **class_get_enum_constants** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` enum, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  87. Returns an array with all the keys in ``enum`` of ``class`` or its ancestry.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_ClassDB_method_class_get_enum_list:
  91. .. rst-class:: classref-method
  92. :ref:`PackedStringArray<class_PackedStringArray>` **class_get_enum_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  93. Returns an array with all the enums of ``class`` or its ancestry.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_ClassDB_method_class_get_integer_constant:
  97. .. rst-class:: classref-method
  98. :ref:`int<class_int>` **class_get_integer_constant** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name **)** |const|
  99. Returns the value of the integer constant ``name`` of ``class`` or its ancestry. Always returns 0 when the constant could not be found.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _class_ClassDB_method_class_get_integer_constant_enum:
  103. .. rst-class:: classref-method
  104. :ref:`StringName<class_StringName>` **class_get_integer_constant_enum** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  105. Returns which enum the integer constant ``name`` of ``class`` or its ancestry belongs to.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_ClassDB_method_class_get_integer_constant_list:
  109. .. rst-class:: classref-method
  110. :ref:`PackedStringArray<class_PackedStringArray>` **class_get_integer_constant_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  111. Returns an array with the names all the integer constants of ``class`` or its ancestry.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_ClassDB_method_class_get_method_list:
  115. .. rst-class:: classref-method
  116. :ref:`Dictionary[]<class_Dictionary>` **class_get_method_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  117. 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)``.
  118. \ **Note:** In exported release builds the debug info is not available, so the returned dictionaries will contain only method names.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_ClassDB_method_class_get_property:
  122. .. rst-class:: classref-method
  123. :ref:`Variant<class_Variant>` **class_get_property** **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` property **)** |const|
  124. Returns the value of ``property`` of ``object`` or its ancestry.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_ClassDB_method_class_get_property_list:
  128. .. rst-class:: classref-method
  129. :ref:`Dictionary[]<class_Dictionary>` **class_get_property_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  130. Returns an array with all the properties of ``class`` or its ancestry if ``no_inheritance`` is ``false``.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_ClassDB_method_class_get_signal:
  134. .. rst-class:: classref-method
  135. :ref:`Dictionary<class_Dictionary>` **class_get_signal** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` signal **)** |const|
  136. 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)``.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_ClassDB_method_class_get_signal_list:
  140. .. rst-class:: classref-method
  141. :ref:`Dictionary[]<class_Dictionary>` **class_get_signal_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  142. 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>`.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_ClassDB_method_class_has_enum:
  146. .. rst-class:: classref-method
  147. :ref:`bool<class_bool>` **class_has_enum** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  148. Returns whether ``class`` or its ancestry has an enum called ``name`` or not.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_ClassDB_method_class_has_integer_constant:
  152. .. rst-class:: classref-method
  153. :ref:`bool<class_bool>` **class_has_integer_constant** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name **)** |const|
  154. Returns whether ``class`` or its ancestry has an integer constant called ``name`` or not.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_ClassDB_method_class_has_method:
  158. .. rst-class:: classref-method
  159. :ref:`bool<class_bool>` **class_has_method** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` method, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  160. Returns whether ``class`` (or its ancestry if ``no_inheritance`` is ``false``) has a method called ``method`` or not.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_ClassDB_method_class_has_signal:
  164. .. rst-class:: classref-method
  165. :ref:`bool<class_bool>` **class_has_signal** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` signal **)** |const|
  166. Returns whether ``class`` or its ancestry has a signal called ``signal`` or not.
  167. .. rst-class:: classref-item-separator
  168. ----
  169. .. _class_ClassDB_method_class_set_property:
  170. .. rst-class:: classref-method
  171. :ref:`Error<enum_@GlobalScope_Error>` **class_set_property** **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` property, :ref:`Variant<class_Variant>` value **)** |const|
  172. Sets ``property`` value of ``object`` to ``value``.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_ClassDB_method_get_class_list:
  176. .. rst-class:: classref-method
  177. :ref:`PackedStringArray<class_PackedStringArray>` **get_class_list** **(** **)** |const|
  178. Returns the names of all the classes available.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_ClassDB_method_get_inheriters_from_class:
  182. .. rst-class:: classref-method
  183. :ref:`PackedStringArray<class_PackedStringArray>` **get_inheriters_from_class** **(** :ref:`StringName<class_StringName>` class **)** |const|
  184. Returns the names of all the classes that directly or indirectly inherit from ``class``.
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_ClassDB_method_get_parent_class:
  188. .. rst-class:: classref-method
  189. :ref:`StringName<class_StringName>` **get_parent_class** **(** :ref:`StringName<class_StringName>` class **)** |const|
  190. Returns the parent class of ``class``.
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_ClassDB_method_instantiate:
  194. .. rst-class:: classref-method
  195. :ref:`Variant<class_Variant>` **instantiate** **(** :ref:`StringName<class_StringName>` class **)** |const|
  196. Creates an instance of ``class``.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_ClassDB_method_is_class_enabled:
  200. .. rst-class:: classref-method
  201. :ref:`bool<class_bool>` **is_class_enabled** **(** :ref:`StringName<class_StringName>` class **)** |const|
  202. Returns whether this ``class`` is enabled or not.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_ClassDB_method_is_parent_class:
  206. .. rst-class:: classref-method
  207. :ref:`bool<class_bool>` **is_parent_class** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` inherits **)** |const|
  208. Returns whether ``inherits`` is an ancestor of ``class`` or not.
  209. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  210. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  211. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  212. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  213. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  214. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  215. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`