class_scenestate.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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/SceneState.xml.
  6. .. _class_SceneState:
  7. SceneState
  8. ==========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Provides access to a scene file's information.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Maintains a list of resources, nodes, exported and overridden properties, and built-in scripts associated with a scene. They cannot be modified from a **SceneState**, only accessed. Useful for peeking into what a :ref:`PackedScene<class_PackedScene>` contains without instantiating it.
  15. This class cannot be instantiated directly, it is retrieved for a given scene as the result of :ref:`PackedScene.get_state<class_PackedScene_method_get_state>`.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Array<class_Array>` | :ref:`get_connection_binds<class_SceneState_method_get_connection_binds>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  23. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_connection_count<class_SceneState_method_get_connection_count>`\ (\ ) |const| |
  25. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_connection_flags<class_SceneState_method_get_connection_flags>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  27. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`StringName<class_StringName>` | :ref:`get_connection_method<class_SceneState_method_get_connection_method>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  29. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`StringName<class_StringName>` | :ref:`get_connection_signal<class_SceneState_method_get_connection_signal>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  31. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_source<class_SceneState_method_get_connection_source>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  33. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_target<class_SceneState_method_get_connection_target>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  35. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_connection_unbinds<class_SceneState_method_get_connection_unbinds>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  37. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`get_node_count<class_SceneState_method_get_node_count>`\ (\ ) |const| |
  39. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_node_groups<class_SceneState_method_get_node_groups>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  41. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_node_index<class_SceneState_method_get_node_index>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  43. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`PackedScene<class_PackedScene>` | :ref:`get_node_instance<class_SceneState_method_get_node_instance>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  45. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`String<class_String>` | :ref:`get_node_instance_placeholder<class_SceneState_method_get_node_instance_placeholder>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  47. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`StringName<class_StringName>` | :ref:`get_node_name<class_SceneState_method_get_node_name>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  49. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`NodePath<class_NodePath>` | :ref:`get_node_owner_path<class_SceneState_method_get_node_owner_path>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  51. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`NodePath<class_NodePath>` | :ref:`get_node_path<class_SceneState_method_get_node_path>`\ (\ idx\: :ref:`int<class_int>`, for_parent\: :ref:`bool<class_bool>` = false\ ) |const| |
  53. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`int<class_int>` | :ref:`get_node_property_count<class_SceneState_method_get_node_property_count>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  55. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`StringName<class_StringName>` | :ref:`get_node_property_name<class_SceneState_method_get_node_property_name>`\ (\ idx\: :ref:`int<class_int>`, prop_idx\: :ref:`int<class_int>`\ ) |const| |
  57. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Variant<class_Variant>` | :ref:`get_node_property_value<class_SceneState_method_get_node_property_value>`\ (\ idx\: :ref:`int<class_int>`, prop_idx\: :ref:`int<class_int>`\ ) |const| |
  59. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`StringName<class_StringName>` | :ref:`get_node_type<class_SceneState_method_get_node_type>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  61. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`bool<class_bool>` | :ref:`is_node_instance_placeholder<class_SceneState_method_is_node_instance_placeholder>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  63. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. .. rst-class:: classref-section-separator
  65. ----
  66. .. rst-class:: classref-descriptions-group
  67. Enumerations
  68. ------------
  69. .. _enum_SceneState_GenEditState:
  70. .. rst-class:: classref-enumeration
  71. enum **GenEditState**: :ref:`🔗<enum_SceneState_GenEditState>`
  72. .. _class_SceneState_constant_GEN_EDIT_STATE_DISABLED:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_DISABLED** = ``0``
  75. If passed to :ref:`PackedScene.instantiate<class_PackedScene_method_instantiate>`, blocks edits to the scene state.
  76. .. _class_SceneState_constant_GEN_EDIT_STATE_INSTANCE:
  77. .. rst-class:: classref-enumeration-constant
  78. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_INSTANCE** = ``1``
  79. If passed to :ref:`PackedScene.instantiate<class_PackedScene_method_instantiate>`, provides inherited scene resources to the local scene.
  80. \ **Note:** Only available in editor builds.
  81. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_MAIN** = ``2``
  84. If passed to :ref:`PackedScene.instantiate<class_PackedScene_method_instantiate>`, provides local scene resources to the local scene. Only the main scene should receive the main edit state.
  85. \ **Note:** Only available in editor builds.
  86. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN_INHERITED:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_MAIN_INHERITED** = ``3``
  89. If passed to :ref:`PackedScene.instantiate<class_PackedScene_method_instantiate>`, it's similar to :ref:`GEN_EDIT_STATE_MAIN<class_SceneState_constant_GEN_EDIT_STATE_MAIN>`, but for the case where the scene is being instantiated to be the base of another one.
  90. \ **Note:** Only available in editor builds.
  91. .. rst-class:: classref-section-separator
  92. ----
  93. .. rst-class:: classref-descriptions-group
  94. Method Descriptions
  95. -------------------
  96. .. _class_SceneState_method_get_connection_binds:
  97. .. rst-class:: classref-method
  98. :ref:`Array<class_Array>` **get_connection_binds**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_binds>`
  99. Returns the list of bound parameters for the signal at ``idx``.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _class_SceneState_method_get_connection_count:
  103. .. rst-class:: classref-method
  104. :ref:`int<class_int>` **get_connection_count**\ (\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_count>`
  105. Returns the number of signal connections in the scene.
  106. The ``idx`` argument used to query connection metadata in other ``get_connection_*`` methods in the interval ``[0, get_connection_count() - 1]``.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_SceneState_method_get_connection_flags:
  110. .. rst-class:: classref-method
  111. :ref:`int<class_int>` **get_connection_flags**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_flags>`
  112. Returns the connection flags for the signal at ``idx``. See :ref:`ConnectFlags<enum_Object_ConnectFlags>` constants.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_SceneState_method_get_connection_method:
  116. .. rst-class:: classref-method
  117. :ref:`StringName<class_StringName>` **get_connection_method**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_method>`
  118. Returns the method connected to the signal at ``idx``.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_SceneState_method_get_connection_signal:
  122. .. rst-class:: classref-method
  123. :ref:`StringName<class_StringName>` **get_connection_signal**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_signal>`
  124. Returns the name of the signal at ``idx``.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_SceneState_method_get_connection_source:
  128. .. rst-class:: classref-method
  129. :ref:`NodePath<class_NodePath>` **get_connection_source**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_source>`
  130. Returns the path to the node that owns the signal at ``idx``, relative to the root node.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_SceneState_method_get_connection_target:
  134. .. rst-class:: classref-method
  135. :ref:`NodePath<class_NodePath>` **get_connection_target**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_target>`
  136. Returns the path to the node that owns the method connected to the signal at ``idx``, relative to the root node.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_SceneState_method_get_connection_unbinds:
  140. .. rst-class:: classref-method
  141. :ref:`int<class_int>` **get_connection_unbinds**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_unbinds>`
  142. Returns the number of unbound parameters for the signal at ``idx``.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_SceneState_method_get_node_count:
  146. .. rst-class:: classref-method
  147. :ref:`int<class_int>` **get_node_count**\ (\ ) |const| :ref:`🔗<class_SceneState_method_get_node_count>`
  148. Returns the number of nodes in the scene.
  149. The ``idx`` argument used to query node data in other ``get_node_*`` methods in the interval ``[0, get_node_count() - 1]``.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_SceneState_method_get_node_groups:
  153. .. rst-class:: classref-method
  154. :ref:`PackedStringArray<class_PackedStringArray>` **get_node_groups**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_groups>`
  155. Returns the list of group names associated with the node at ``idx``.
  156. .. rst-class:: classref-item-separator
  157. ----
  158. .. _class_SceneState_method_get_node_index:
  159. .. rst-class:: classref-method
  160. :ref:`int<class_int>` **get_node_index**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_index>`
  161. Returns the node's index, which is its position relative to its siblings. This is only relevant and saved in scenes for cases where new nodes are added to an instantiated or inherited scene among siblings from the base scene. Despite the name, this index is not related to the ``idx`` argument used here and in other methods.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_SceneState_method_get_node_instance:
  165. .. rst-class:: classref-method
  166. :ref:`PackedScene<class_PackedScene>` **get_node_instance**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_instance>`
  167. Returns a :ref:`PackedScene<class_PackedScene>` for the node at ``idx`` (i.e. the whole branch starting at this node, with its child nodes and resources), or ``null`` if the node is not an instance.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_SceneState_method_get_node_instance_placeholder:
  171. .. rst-class:: classref-method
  172. :ref:`String<class_String>` **get_node_instance_placeholder**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_instance_placeholder>`
  173. Returns the path to the represented scene file if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_SceneState_method_get_node_name:
  177. .. rst-class:: classref-method
  178. :ref:`StringName<class_StringName>` **get_node_name**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_name>`
  179. Returns the name of the node at ``idx``.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_SceneState_method_get_node_owner_path:
  183. .. rst-class:: classref-method
  184. :ref:`NodePath<class_NodePath>` **get_node_owner_path**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_owner_path>`
  185. Returns the path to the owner of the node at ``idx``, relative to the root node.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_SceneState_method_get_node_path:
  189. .. rst-class:: classref-method
  190. :ref:`NodePath<class_NodePath>` **get_node_path**\ (\ idx\: :ref:`int<class_int>`, for_parent\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_SceneState_method_get_node_path>`
  191. Returns the path to the node at ``idx``.
  192. If ``for_parent`` is ``true``, returns the path of the ``idx`` node's parent instead.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_SceneState_method_get_node_property_count:
  196. .. rst-class:: classref-method
  197. :ref:`int<class_int>` **get_node_property_count**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_property_count>`
  198. Returns the number of exported or overridden properties for the node at ``idx``.
  199. The ``prop_idx`` argument used to query node property data in other ``get_node_property_*`` methods in the interval ``[0, get_node_property_count() - 1]``.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_SceneState_method_get_node_property_name:
  203. .. rst-class:: classref-method
  204. :ref:`StringName<class_StringName>` **get_node_property_name**\ (\ idx\: :ref:`int<class_int>`, prop_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_property_name>`
  205. Returns the name of the property at ``prop_idx`` for the node at ``idx``.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_SceneState_method_get_node_property_value:
  209. .. rst-class:: classref-method
  210. :ref:`Variant<class_Variant>` **get_node_property_value**\ (\ idx\: :ref:`int<class_int>`, prop_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_property_value>`
  211. Returns the value of the property at ``prop_idx`` for the node at ``idx``.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_SceneState_method_get_node_type:
  215. .. rst-class:: classref-method
  216. :ref:`StringName<class_StringName>` **get_node_type**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_type>`
  217. Returns the type of the node at ``idx``.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_SceneState_method_is_node_instance_placeholder:
  221. .. rst-class:: classref-method
  222. :ref:`bool<class_bool>` **is_node_instance_placeholder**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_is_node_instance_placeholder>`
  223. Returns ``true`` if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  224. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  225. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  226. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  227. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  228. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  229. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  230. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  231. .. |void| replace:: :abbr:`void (No return value.)`