class_classdb.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. Class information repository.
  11. Description
  12. -----------
  13. Provides access to metadata stored for every available class.
  14. Methods
  15. -------
  16. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`can_instantiate<class_ClassDB_method_can_instantiate>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  18. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`class_exists<class_ClassDB_method_class_exists>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  20. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :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| |
  22. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :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| |
  24. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :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| |
  26. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :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| |
  28. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :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| |
  30. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Array<class_Array>` | :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| |
  32. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :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| |
  34. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Array<class_Array>` | :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| |
  36. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :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| |
  38. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Array<class_Array>` | :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| |
  40. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :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| |
  42. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :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| |
  44. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :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| |
  46. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :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| |
  48. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :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| |
  50. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_class_list<class_ClassDB_method_get_class_list>` **(** **)** |const| |
  52. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_inheriters_from_class<class_ClassDB_method_get_inheriters_from_class>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  54. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`StringName<class_StringName>` | :ref:`get_parent_class<class_ClassDB_method_get_parent_class>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  56. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Variant<class_Variant>` | :ref:`instantiate<class_ClassDB_method_instantiate>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  58. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`is_class_enabled<class_ClassDB_method_is_class_enabled>` **(** :ref:`StringName<class_StringName>` class **)** |const| |
  60. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :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| |
  62. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. Method Descriptions
  64. -------------------
  65. .. _class_ClassDB_method_can_instantiate:
  66. - :ref:`bool<class_bool>` **can_instantiate** **(** :ref:`StringName<class_StringName>` class **)** |const|
  67. Returns ``true`` if you can instance objects from the specified ``class``, ``false`` in other case.
  68. ----
  69. .. _class_ClassDB_method_class_exists:
  70. - :ref:`bool<class_bool>` **class_exists** **(** :ref:`StringName<class_StringName>` class **)** |const|
  71. Returns whether the specified ``class`` is available or not.
  72. ----
  73. .. _class_ClassDB_method_class_get_enum_constants:
  74. - :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|
  75. Returns an array with all the keys in ``enum`` of ``class`` or its ancestry.
  76. ----
  77. .. _class_ClassDB_method_class_get_enum_list:
  78. - :ref:`PackedStringArray<class_PackedStringArray>` **class_get_enum_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  79. Returns an array with all the enums of ``class`` or its ancestry.
  80. ----
  81. .. _class_ClassDB_method_class_get_integer_constant:
  82. - :ref:`int<class_int>` **class_get_integer_constant** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name **)** |const|
  83. Returns the value of the integer constant ``name`` of ``class`` or its ancestry. Always returns 0 when the constant could not be found.
  84. ----
  85. .. _class_ClassDB_method_class_get_integer_constant_enum:
  86. - :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|
  87. Returns which enum the integer constant ``name`` of ``class`` or its ancestry belongs to.
  88. ----
  89. .. _class_ClassDB_method_class_get_integer_constant_list:
  90. - :ref:`PackedStringArray<class_PackedStringArray>` **class_get_integer_constant_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  91. Returns an array with the names all the integer constants of ``class`` or its ancestry.
  92. ----
  93. .. _class_ClassDB_method_class_get_method_list:
  94. - :ref:`Array<class_Array>` **class_get_method_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  95. 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)``.
  96. \ **Note:** In exported release builds the debug info is not available, so the returned dictionaries will contain only method names.
  97. ----
  98. .. _class_ClassDB_method_class_get_property:
  99. - :ref:`Variant<class_Variant>` **class_get_property** **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` property **)** |const|
  100. Returns the value of ``property`` of ``class`` or its ancestry.
  101. ----
  102. .. _class_ClassDB_method_class_get_property_list:
  103. - :ref:`Array<class_Array>` **class_get_property_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  104. Returns an array with all the properties of ``class`` or its ancestry if ``no_inheritance`` is ``false``.
  105. ----
  106. .. _class_ClassDB_method_class_get_signal:
  107. - :ref:`Dictionary<class_Dictionary>` **class_get_signal** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` signal **)** |const|
  108. 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)``.
  109. ----
  110. .. _class_ClassDB_method_class_get_signal_list:
  111. - :ref:`Array<class_Array>` **class_get_signal_list** **(** :ref:`StringName<class_StringName>` class, :ref:`bool<class_bool>` no_inheritance=false **)** |const|
  112. 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>`.
  113. ----
  114. .. _class_ClassDB_method_class_has_enum:
  115. - :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|
  116. Returns whether ``class`` or its ancestry has an enum called ``name`` or not.
  117. ----
  118. .. _class_ClassDB_method_class_has_integer_constant:
  119. - :ref:`bool<class_bool>` **class_has_integer_constant** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` name **)** |const|
  120. Returns whether ``class`` or its ancestry has an integer constant called ``name`` or not.
  121. ----
  122. .. _class_ClassDB_method_class_has_method:
  123. - :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|
  124. Returns whether ``class`` (or its ancestry if ``no_inheritance`` is ``false``) has a method called ``method`` or not.
  125. ----
  126. .. _class_ClassDB_method_class_has_signal:
  127. - :ref:`bool<class_bool>` **class_has_signal** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` signal **)** |const|
  128. Returns whether ``class`` or its ancestry has a signal called ``signal`` or not.
  129. ----
  130. .. _class_ClassDB_method_class_set_property:
  131. - :ref:`Error<enum_@GlobalScope_Error>` **class_set_property** **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` property, :ref:`Variant<class_Variant>` value **)** |const|
  132. Sets ``property`` value of ``class`` to ``value``.
  133. ----
  134. .. _class_ClassDB_method_get_class_list:
  135. - :ref:`PackedStringArray<class_PackedStringArray>` **get_class_list** **(** **)** |const|
  136. Returns the names of all the classes available.
  137. ----
  138. .. _class_ClassDB_method_get_inheriters_from_class:
  139. - :ref:`PackedStringArray<class_PackedStringArray>` **get_inheriters_from_class** **(** :ref:`StringName<class_StringName>` class **)** |const|
  140. Returns the names of all the classes that directly or indirectly inherit from ``class``.
  141. ----
  142. .. _class_ClassDB_method_get_parent_class:
  143. - :ref:`StringName<class_StringName>` **get_parent_class** **(** :ref:`StringName<class_StringName>` class **)** |const|
  144. Returns the parent class of ``class``.
  145. ----
  146. .. _class_ClassDB_method_instantiate:
  147. - :ref:`Variant<class_Variant>` **instantiate** **(** :ref:`StringName<class_StringName>` class **)** |const|
  148. Creates an instance of ``class``.
  149. ----
  150. .. _class_ClassDB_method_is_class_enabled:
  151. - :ref:`bool<class_bool>` **is_class_enabled** **(** :ref:`StringName<class_StringName>` class **)** |const|
  152. Returns whether this ``class`` is enabled or not.
  153. ----
  154. .. _class_ClassDB_method_is_parent_class:
  155. - :ref:`bool<class_bool>` **is_parent_class** **(** :ref:`StringName<class_StringName>` class, :ref:`StringName<class_StringName>` inherits **)** |const|
  156. Returns whether ``inherits`` is an ancestor of ``class`` or not.
  157. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  158. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  159. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  160. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  161. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  162. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`