class_scenestate.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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:`SceneState<class_SceneState>` | :ref:`get_base_scene_state<class_SceneState_method_get_base_scene_state>`\ (\ ) |const| |
  23. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Array<class_Array>` | :ref:`get_connection_binds<class_SceneState_method_get_connection_binds>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  25. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_connection_count<class_SceneState_method_get_connection_count>`\ (\ ) |const| |
  27. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`get_connection_flags<class_SceneState_method_get_connection_flags>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  29. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`StringName<class_StringName>` | :ref:`get_connection_method<class_SceneState_method_get_connection_method>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  31. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`StringName<class_StringName>` | :ref:`get_connection_signal<class_SceneState_method_get_connection_signal>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  33. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_source<class_SceneState_method_get_connection_source>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  35. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_target<class_SceneState_method_get_connection_target>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  37. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`get_connection_unbinds<class_SceneState_method_get_connection_unbinds>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  39. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_node_count<class_SceneState_method_get_node_count>`\ (\ ) |const| |
  41. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_node_groups<class_SceneState_method_get_node_groups>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  43. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`get_node_index<class_SceneState_method_get_node_index>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  45. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`PackedScene<class_PackedScene>` | :ref:`get_node_instance<class_SceneState_method_get_node_instance>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  47. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`String<class_String>` | :ref:`get_node_instance_placeholder<class_SceneState_method_get_node_instance_placeholder>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  49. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`StringName<class_StringName>` | :ref:`get_node_name<class_SceneState_method_get_node_name>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  51. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`NodePath<class_NodePath>` | :ref:`get_node_owner_path<class_SceneState_method_get_node_owner_path>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  53. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :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| |
  55. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`int<class_int>` | :ref:`get_node_property_count<class_SceneState_method_get_node_property_count>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  57. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :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| |
  59. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :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| |
  61. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`StringName<class_StringName>` | :ref:`get_node_type<class_SceneState_method_get_node_type>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  63. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`String<class_String>` | :ref:`get_path<class_SceneState_method_get_path>`\ (\ ) |const| |
  65. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`is_node_instance_placeholder<class_SceneState_method_is_node_instance_placeholder>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  67. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. .. rst-class:: classref-section-separator
  69. ----
  70. .. rst-class:: classref-descriptions-group
  71. Enumerations
  72. ------------
  73. .. _enum_SceneState_GenEditState:
  74. .. rst-class:: classref-enumeration
  75. enum **GenEditState**: :ref:`🔗<enum_SceneState_GenEditState>`
  76. .. _class_SceneState_constant_GEN_EDIT_STATE_DISABLED:
  77. .. rst-class:: classref-enumeration-constant
  78. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_DISABLED** = ``0``
  79. If passed to :ref:`PackedScene.instantiate()<class_PackedScene_method_instantiate>`, blocks edits to the scene state.
  80. .. _class_SceneState_constant_GEN_EDIT_STATE_INSTANCE:
  81. .. rst-class:: classref-enumeration-constant
  82. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_INSTANCE** = ``1``
  83. If passed to :ref:`PackedScene.instantiate()<class_PackedScene_method_instantiate>`, provides inherited scene resources to the local scene.
  84. \ **Note:** Only available in editor builds.
  85. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_MAIN** = ``2``
  88. 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.
  89. \ **Note:** Only available in editor builds.
  90. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN_INHERITED:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_MAIN_INHERITED** = ``3``
  93. 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.
  94. \ **Note:** Only available in editor builds.
  95. .. rst-class:: classref-section-separator
  96. ----
  97. .. rst-class:: classref-descriptions-group
  98. Method Descriptions
  99. -------------------
  100. .. _class_SceneState_method_get_base_scene_state:
  101. .. rst-class:: classref-method
  102. :ref:`SceneState<class_SceneState>` **get_base_scene_state**\ (\ ) |const| :ref:`🔗<class_SceneState_method_get_base_scene_state>`
  103. Returns the **SceneState** of the scene that this scene inherits from, or ``null`` if it doesn't inherit from any scene.
  104. .. rst-class:: classref-item-separator
  105. ----
  106. .. _class_SceneState_method_get_connection_binds:
  107. .. rst-class:: classref-method
  108. :ref:`Array<class_Array>` **get_connection_binds**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_binds>`
  109. Returns the list of bound parameters for the signal at ``idx``.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_SceneState_method_get_connection_count:
  113. .. rst-class:: classref-method
  114. :ref:`int<class_int>` **get_connection_count**\ (\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_count>`
  115. Returns the number of signal connections in the scene.
  116. The ``idx`` argument used to query connection metadata in other ``get_connection_*`` methods in the interval ``[0, get_connection_count() - 1]``.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_SceneState_method_get_connection_flags:
  120. .. rst-class:: classref-method
  121. :ref:`int<class_int>` **get_connection_flags**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_flags>`
  122. Returns the connection flags for the signal at ``idx``. See :ref:`ConnectFlags<enum_Object_ConnectFlags>` constants.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_SceneState_method_get_connection_method:
  126. .. rst-class:: classref-method
  127. :ref:`StringName<class_StringName>` **get_connection_method**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_method>`
  128. Returns the method connected to the signal at ``idx``.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_SceneState_method_get_connection_signal:
  132. .. rst-class:: classref-method
  133. :ref:`StringName<class_StringName>` **get_connection_signal**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_signal>`
  134. Returns the name of the signal at ``idx``.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_SceneState_method_get_connection_source:
  138. .. rst-class:: classref-method
  139. :ref:`NodePath<class_NodePath>` **get_connection_source**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_source>`
  140. Returns the path to the node that owns the signal at ``idx``, relative to the root node.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_SceneState_method_get_connection_target:
  144. .. rst-class:: classref-method
  145. :ref:`NodePath<class_NodePath>` **get_connection_target**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_target>`
  146. Returns the path to the node that owns the method connected to the signal at ``idx``, relative to the root node.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_SceneState_method_get_connection_unbinds:
  150. .. rst-class:: classref-method
  151. :ref:`int<class_int>` **get_connection_unbinds**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_connection_unbinds>`
  152. Returns the number of unbound parameters for the signal at ``idx``.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_SceneState_method_get_node_count:
  156. .. rst-class:: classref-method
  157. :ref:`int<class_int>` **get_node_count**\ (\ ) |const| :ref:`🔗<class_SceneState_method_get_node_count>`
  158. Returns the number of nodes in the scene.
  159. The ``idx`` argument used to query node data in other ``get_node_*`` methods in the interval ``[0, get_node_count() - 1]``.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_SceneState_method_get_node_groups:
  163. .. rst-class:: classref-method
  164. :ref:`PackedStringArray<class_PackedStringArray>` **get_node_groups**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_groups>`
  165. Returns the list of group names associated with the node at ``idx``.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_SceneState_method_get_node_index:
  169. .. rst-class:: classref-method
  170. :ref:`int<class_int>` **get_node_index**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_index>`
  171. 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.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_SceneState_method_get_node_instance:
  175. .. rst-class:: classref-method
  176. :ref:`PackedScene<class_PackedScene>` **get_node_instance**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_instance>`
  177. 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.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_SceneState_method_get_node_instance_placeholder:
  181. .. rst-class:: classref-method
  182. :ref:`String<class_String>` **get_node_instance_placeholder**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_instance_placeholder>`
  183. Returns the path to the represented scene file if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_SceneState_method_get_node_name:
  187. .. rst-class:: classref-method
  188. :ref:`StringName<class_StringName>` **get_node_name**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_name>`
  189. Returns the name of the node at ``idx``.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_SceneState_method_get_node_owner_path:
  193. .. rst-class:: classref-method
  194. :ref:`NodePath<class_NodePath>` **get_node_owner_path**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_owner_path>`
  195. Returns the path to the owner of the node at ``idx``, relative to the root node.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_SceneState_method_get_node_path:
  199. .. rst-class:: classref-method
  200. :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>`
  201. Returns the path to the node at ``idx``.
  202. If ``for_parent`` is ``true``, returns the path of the ``idx`` node's parent instead.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_SceneState_method_get_node_property_count:
  206. .. rst-class:: classref-method
  207. :ref:`int<class_int>` **get_node_property_count**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_property_count>`
  208. Returns the number of exported or overridden properties for the node at ``idx``.
  209. 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]``.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_SceneState_method_get_node_property_name:
  213. .. rst-class:: classref-method
  214. :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>`
  215. Returns the name of the property at ``prop_idx`` for the node at ``idx``.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_SceneState_method_get_node_property_value:
  219. .. rst-class:: classref-method
  220. :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>`
  221. Returns the value of the property at ``prop_idx`` for the node at ``idx``.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_SceneState_method_get_node_type:
  225. .. rst-class:: classref-method
  226. :ref:`StringName<class_StringName>` **get_node_type**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_get_node_type>`
  227. Returns the type of the node at ``idx``.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_SceneState_method_get_path:
  231. .. rst-class:: classref-method
  232. :ref:`String<class_String>` **get_path**\ (\ ) |const| :ref:`🔗<class_SceneState_method_get_path>`
  233. Returns the resource path to the represented :ref:`PackedScene<class_PackedScene>`.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_SceneState_method_is_node_instance_placeholder:
  237. .. rst-class:: classref-method
  238. :ref:`bool<class_bool>` **is_node_instance_placeholder**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_SceneState_method_is_node_instance_placeholder>`
  239. Returns ``true`` if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  240. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  241. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  242. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  243. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  244. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  245. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  246. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  247. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  248. .. |void| replace:: :abbr:`void (No return value.)`