class_scenestate.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/SceneState.xml.
  6. .. _class_SceneState:
  7. SceneState
  8. ==========
  9. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. A script interface to a scene file's data.
  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.
  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>` **(** :ref:`int<class_int>` idx **)** |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>` **(** :ref:`int<class_int>` idx **)** |const| |
  27. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`String<class_String>` | :ref:`get_connection_method<class_SceneState_method_get_connection_method>` **(** :ref:`int<class_int>` idx **)** |const| |
  29. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`String<class_String>` | :ref:`get_connection_signal<class_SceneState_method_get_connection_signal>` **(** :ref:`int<class_int>` idx **)** |const| |
  31. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_source<class_SceneState_method_get_connection_source>` **(** :ref:`int<class_int>` idx **)** |const| |
  33. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_target<class_SceneState_method_get_connection_target>` **(** :ref:`int<class_int>` idx **)** |const| |
  35. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_node_count<class_SceneState_method_get_node_count>` **(** **)** |const| |
  37. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_node_groups<class_SceneState_method_get_node_groups>` **(** :ref:`int<class_int>` idx **)** |const| |
  39. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_node_index<class_SceneState_method_get_node_index>` **(** :ref:`int<class_int>` idx **)** |const| |
  41. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`PackedScene<class_PackedScene>` | :ref:`get_node_instance<class_SceneState_method_get_node_instance>` **(** :ref:`int<class_int>` idx **)** |const| |
  43. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`String<class_String>` | :ref:`get_node_instance_placeholder<class_SceneState_method_get_node_instance_placeholder>` **(** :ref:`int<class_int>` idx **)** |const| |
  45. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`String<class_String>` | :ref:`get_node_name<class_SceneState_method_get_node_name>` **(** :ref:`int<class_int>` idx **)** |const| |
  47. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`NodePath<class_NodePath>` | :ref:`get_node_owner_path<class_SceneState_method_get_node_owner_path>` **(** :ref:`int<class_int>` idx **)** |const| |
  49. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`NodePath<class_NodePath>` | :ref:`get_node_path<class_SceneState_method_get_node_path>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` for_parent=false **)** |const| |
  51. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`get_node_property_count<class_SceneState_method_get_node_property_count>` **(** :ref:`int<class_int>` idx **)** |const| |
  53. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`String<class_String>` | :ref:`get_node_property_name<class_SceneState_method_get_node_property_name>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` prop_idx **)** |const| |
  55. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Variant<class_Variant>` | :ref:`get_node_property_value<class_SceneState_method_get_node_property_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` prop_idx **)** |const| |
  57. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`String<class_String>` | :ref:`get_node_type<class_SceneState_method_get_node_type>` **(** :ref:`int<class_int>` idx **)** |const| |
  59. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`is_node_instance_placeholder<class_SceneState_method_is_node_instance_placeholder>` **(** :ref:`int<class_int>` idx **)** |const| |
  61. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. .. rst-class:: classref-section-separator
  63. ----
  64. .. rst-class:: classref-descriptions-group
  65. Enumerations
  66. ------------
  67. .. _enum_SceneState_GenEditState:
  68. .. rst-class:: classref-enumeration
  69. enum **GenEditState**:
  70. .. _class_SceneState_constant_GEN_EDIT_STATE_DISABLED:
  71. .. rst-class:: classref-enumeration-constant
  72. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_DISABLED** = ``0``
  73. If passed to :ref:`PackedScene.instance<class_PackedScene_method_instance>`, blocks edits to the scene state.
  74. .. _class_SceneState_constant_GEN_EDIT_STATE_INSTANCE:
  75. .. rst-class:: classref-enumeration-constant
  76. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_INSTANCE** = ``1``
  77. If passed to :ref:`PackedScene.instance<class_PackedScene_method_instance>`, provides inherited scene resources to the local scene.
  78. \ **Note:** Only available in editor builds.
  79. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN:
  80. .. rst-class:: classref-enumeration-constant
  81. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_MAIN** = ``2``
  82. If passed to :ref:`PackedScene.instance<class_PackedScene_method_instance>`, provides local scene resources to the local scene. Only the main scene should receive the main edit state.
  83. \ **Note:** Only available in editor builds.
  84. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN_INHERITED:
  85. .. rst-class:: classref-enumeration-constant
  86. :ref:`GenEditState<enum_SceneState_GenEditState>` **GEN_EDIT_STATE_MAIN_INHERITED** = ``3``
  87. If passed to :ref:`PackedScene.instance<class_PackedScene_method_instance>`, 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.
  88. \ **Note:** Only available in editor builds.
  89. .. rst-class:: classref-section-separator
  90. ----
  91. .. rst-class:: classref-descriptions-group
  92. Method Descriptions
  93. -------------------
  94. .. _class_SceneState_method_get_connection_binds:
  95. .. rst-class:: classref-method
  96. :ref:`Array<class_Array>` **get_connection_binds** **(** :ref:`int<class_int>` idx **)** |const|
  97. Returns the list of bound parameters for the signal at ``idx``.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_SceneState_method_get_connection_count:
  101. .. rst-class:: classref-method
  102. :ref:`int<class_int>` **get_connection_count** **(** **)** |const|
  103. Returns the number of signal connections in the scene.
  104. The ``idx`` argument used to query connection metadata in other ``get_connection_*`` methods in the interval ``[0, get_connection_count() - 1]``.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_SceneState_method_get_connection_flags:
  108. .. rst-class:: classref-method
  109. :ref:`int<class_int>` **get_connection_flags** **(** :ref:`int<class_int>` idx **)** |const|
  110. Returns the connection flags for the signal at ``idx``. See :ref:`ConnectFlags<enum_Object_ConnectFlags>` constants.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_SceneState_method_get_connection_method:
  114. .. rst-class:: classref-method
  115. :ref:`String<class_String>` **get_connection_method** **(** :ref:`int<class_int>` idx **)** |const|
  116. Returns the method connected to the signal at ``idx``.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_SceneState_method_get_connection_signal:
  120. .. rst-class:: classref-method
  121. :ref:`String<class_String>` **get_connection_signal** **(** :ref:`int<class_int>` idx **)** |const|
  122. Returns the name of the signal at ``idx``.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_SceneState_method_get_connection_source:
  126. .. rst-class:: classref-method
  127. :ref:`NodePath<class_NodePath>` **get_connection_source** **(** :ref:`int<class_int>` idx **)** |const|
  128. Returns the path to the node that owns the signal at ``idx``, relative to the root node.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_SceneState_method_get_connection_target:
  132. .. rst-class:: classref-method
  133. :ref:`NodePath<class_NodePath>` **get_connection_target** **(** :ref:`int<class_int>` idx **)** |const|
  134. Returns the path to the node that owns the method connected to the signal at ``idx``, relative to the root node.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_SceneState_method_get_node_count:
  138. .. rst-class:: classref-method
  139. :ref:`int<class_int>` **get_node_count** **(** **)** |const|
  140. Returns the number of nodes in the scene.
  141. The ``idx`` argument used to query node data in other ``get_node_*`` methods in the interval ``[0, get_node_count() - 1]``.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_SceneState_method_get_node_groups:
  145. .. rst-class:: classref-method
  146. :ref:`PoolStringArray<class_PoolStringArray>` **get_node_groups** **(** :ref:`int<class_int>` idx **)** |const|
  147. Returns the list of group names associated with the node at ``idx``.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_SceneState_method_get_node_index:
  151. .. rst-class:: classref-method
  152. :ref:`int<class_int>` **get_node_index** **(** :ref:`int<class_int>` idx **)** |const|
  153. 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 instanced 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.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_SceneState_method_get_node_instance:
  157. .. rst-class:: classref-method
  158. :ref:`PackedScene<class_PackedScene>` **get_node_instance** **(** :ref:`int<class_int>` idx **)** |const|
  159. 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.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_SceneState_method_get_node_instance_placeholder:
  163. .. rst-class:: classref-method
  164. :ref:`String<class_String>` **get_node_instance_placeholder** **(** :ref:`int<class_int>` idx **)** |const|
  165. Returns the path to the represented scene file if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_SceneState_method_get_node_name:
  169. .. rst-class:: classref-method
  170. :ref:`String<class_String>` **get_node_name** **(** :ref:`int<class_int>` idx **)** |const|
  171. Returns the name of the node at ``idx``.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_SceneState_method_get_node_owner_path:
  175. .. rst-class:: classref-method
  176. :ref:`NodePath<class_NodePath>` **get_node_owner_path** **(** :ref:`int<class_int>` idx **)** |const|
  177. Returns the path to the owner of the node at ``idx``, relative to the root node.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_SceneState_method_get_node_path:
  181. .. rst-class:: classref-method
  182. :ref:`NodePath<class_NodePath>` **get_node_path** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` for_parent=false **)** |const|
  183. Returns the path to the node at ``idx``.
  184. If ``for_parent`` is ``true``, returns the path of the ``idx`` node's parent instead.
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_SceneState_method_get_node_property_count:
  188. .. rst-class:: classref-method
  189. :ref:`int<class_int>` **get_node_property_count** **(** :ref:`int<class_int>` idx **)** |const|
  190. Returns the number of exported or overridden properties for the node at ``idx``.
  191. 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]``.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_SceneState_method_get_node_property_name:
  195. .. rst-class:: classref-method
  196. :ref:`String<class_String>` **get_node_property_name** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` prop_idx **)** |const|
  197. Returns the name of the property at ``prop_idx`` for the node at ``idx``.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_SceneState_method_get_node_property_value:
  201. .. rst-class:: classref-method
  202. :ref:`Variant<class_Variant>` **get_node_property_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` prop_idx **)** |const|
  203. Returns the value of the property at ``prop_idx`` for the node at ``idx``.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_SceneState_method_get_node_type:
  207. .. rst-class:: classref-method
  208. :ref:`String<class_String>` **get_node_type** **(** :ref:`int<class_int>` idx **)** |const|
  209. Returns the type of the node at ``idx``.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_SceneState_method_is_node_instance_placeholder:
  213. .. rst-class:: classref-method
  214. :ref:`bool<class_bool>` **is_node_instance_placeholder** **(** :ref:`int<class_int>` idx **)** |const|
  215. Returns ``true`` if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  216. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  217. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  218. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  219. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`