class_scenestate.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the SceneState.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_SceneState:
  6. SceneState
  7. ==========
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A script interface to a scene file's data.
  13. Methods
  14. -------
  15. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`Array<class_Array>` | :ref:`get_connection_binds<class_SceneState_method_get_connection_binds>` **(** :ref:`int<class_int>` idx **)** const |
  17. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`get_connection_count<class_SceneState_method_get_connection_count>` **(** **)** const |
  19. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_connection_flags<class_SceneState_method_get_connection_flags>` **(** :ref:`int<class_int>` idx **)** const |
  21. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`String<class_String>` | :ref:`get_connection_method<class_SceneState_method_get_connection_method>` **(** :ref:`int<class_int>` idx **)** const |
  23. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`String<class_String>` | :ref:`get_connection_signal<class_SceneState_method_get_connection_signal>` **(** :ref:`int<class_int>` idx **)** const |
  25. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_source<class_SceneState_method_get_connection_source>` **(** :ref:`int<class_int>` idx **)** const |
  27. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`NodePath<class_NodePath>` | :ref:`get_connection_target<class_SceneState_method_get_connection_target>` **(** :ref:`int<class_int>` idx **)** const |
  29. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_node_count<class_SceneState_method_get_node_count>` **(** **)** const |
  31. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_node_groups<class_SceneState_method_get_node_groups>` **(** :ref:`int<class_int>` idx **)** const |
  33. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`get_node_index<class_SceneState_method_get_node_index>` **(** :ref:`int<class_int>` idx **)** const |
  35. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`PackedScene<class_PackedScene>` | :ref:`get_node_instance<class_SceneState_method_get_node_instance>` **(** :ref:`int<class_int>` idx **)** const |
  37. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_String>` | :ref:`get_node_instance_placeholder<class_SceneState_method_get_node_instance_placeholder>` **(** :ref:`int<class_int>` idx **)** const |
  39. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`String<class_String>` | :ref:`get_node_name<class_SceneState_method_get_node_name>` **(** :ref:`int<class_int>` idx **)** const |
  41. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`NodePath<class_NodePath>` | :ref:`get_node_owner_path<class_SceneState_method_get_node_owner_path>` **(** :ref:`int<class_int>` idx **)** const |
  43. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :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 |
  45. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`get_node_property_count<class_SceneState_method_get_node_property_count>` **(** :ref:`int<class_int>` idx **)** const |
  47. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :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 |
  49. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :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 |
  51. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`String<class_String>` | :ref:`get_node_type<class_SceneState_method_get_node_type>` **(** :ref:`int<class_int>` idx **)** const |
  53. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`bool<class_bool>` | :ref:`is_node_instance_placeholder<class_SceneState_method_is_node_instance_placeholder>` **(** :ref:`int<class_int>` idx **)** const |
  55. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. Enumerations
  57. ------------
  58. .. _enum_SceneState_GenEditState:
  59. .. _class_SceneState_constant_GEN_EDIT_STATE_DISABLED:
  60. .. _class_SceneState_constant_GEN_EDIT_STATE_INSTANCE:
  61. .. _class_SceneState_constant_GEN_EDIT_STATE_MAIN:
  62. enum **GenEditState**:
  63. - **GEN_EDIT_STATE_DISABLED** = **0** --- If passed to :ref:`PackedScene.instance<class_PackedScene_method_instance>`, blocks edits to the scene state.
  64. - **GEN_EDIT_STATE_INSTANCE** = **1** --- If passed to :ref:`PackedScene.instance<class_PackedScene_method_instance>`, provides inherited scene resources to the local scene.
  65. **Note:** Only available in editor builds.
  66. - **GEN_EDIT_STATE_MAIN** = **2** --- 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.
  67. **Note:** Only available in editor builds.
  68. Description
  69. -----------
  70. Maintains a list of resources, nodes, exported, and overridden properties, and built-in scripts associated with a scene.
  71. 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>`.
  72. Method Descriptions
  73. -------------------
  74. .. _class_SceneState_method_get_connection_binds:
  75. - :ref:`Array<class_Array>` **get_connection_binds** **(** :ref:`int<class_int>` idx **)** const
  76. Returns the list of bound parameters for the signal at ``idx``.
  77. .. _class_SceneState_method_get_connection_count:
  78. - :ref:`int<class_int>` **get_connection_count** **(** **)** const
  79. Returns the number of signal connections in the scene.
  80. The ``idx`` argument used to query connection metadata in other ``get_connection_*`` methods in the interval ``[0, get_connection_count() - 1]``.
  81. .. _class_SceneState_method_get_connection_flags:
  82. - :ref:`int<class_int>` **get_connection_flags** **(** :ref:`int<class_int>` idx **)** const
  83. Returns the connection flags for the signal at ``idx``. See :ref:`ConnectFlags<enum_Object_ConnectFlags>` constants.
  84. .. _class_SceneState_method_get_connection_method:
  85. - :ref:`String<class_String>` **get_connection_method** **(** :ref:`int<class_int>` idx **)** const
  86. Returns the method connected to the signal at ``idx``.
  87. .. _class_SceneState_method_get_connection_signal:
  88. - :ref:`String<class_String>` **get_connection_signal** **(** :ref:`int<class_int>` idx **)** const
  89. Returns the name of the signal at ``idx``.
  90. .. _class_SceneState_method_get_connection_source:
  91. - :ref:`NodePath<class_NodePath>` **get_connection_source** **(** :ref:`int<class_int>` idx **)** const
  92. Returns the path to the node that owns the signal at ``idx``, relative to the root node.
  93. .. _class_SceneState_method_get_connection_target:
  94. - :ref:`NodePath<class_NodePath>` **get_connection_target** **(** :ref:`int<class_int>` idx **)** const
  95. Returns the path to the node that owns the method connected to the signal at ``idx``, relative to the root node.
  96. .. _class_SceneState_method_get_node_count:
  97. - :ref:`int<class_int>` **get_node_count** **(** **)** const
  98. Returns the number of nodes in the scene.
  99. The ``idx`` argument used to query node data in other ``get_node_*`` methods in the interval ``[0, get_node_count() - 1]``.
  100. .. _class_SceneState_method_get_node_groups:
  101. - :ref:`PoolStringArray<class_PoolStringArray>` **get_node_groups** **(** :ref:`int<class_int>` idx **)** const
  102. Returns the list of group names associated with the node at ``idx``.
  103. .. _class_SceneState_method_get_node_index:
  104. - :ref:`int<class_int>` **get_node_index** **(** :ref:`int<class_int>` idx **)** const
  105. 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.
  106. .. _class_SceneState_method_get_node_instance:
  107. - :ref:`PackedScene<class_PackedScene>` **get_node_instance** **(** :ref:`int<class_int>` idx **)** const
  108. 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.
  109. .. _class_SceneState_method_get_node_instance_placeholder:
  110. - :ref:`String<class_String>` **get_node_instance_placeholder** **(** :ref:`int<class_int>` idx **)** const
  111. Returns the path to the represented scene file if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  112. .. _class_SceneState_method_get_node_name:
  113. - :ref:`String<class_String>` **get_node_name** **(** :ref:`int<class_int>` idx **)** const
  114. Returns the name of the node at ``idx``.
  115. .. _class_SceneState_method_get_node_owner_path:
  116. - :ref:`NodePath<class_NodePath>` **get_node_owner_path** **(** :ref:`int<class_int>` idx **)** const
  117. Returns the path to the owner of the node at ``idx``, relative to the root node.
  118. .. _class_SceneState_method_get_node_path:
  119. - :ref:`NodePath<class_NodePath>` **get_node_path** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` for_parent=false **)** const
  120. Returns the path to the node at ``idx``.
  121. If ``for_parent`` is ``true``, returns the path of the ``idx`` node's parent instead.
  122. .. _class_SceneState_method_get_node_property_count:
  123. - :ref:`int<class_int>` **get_node_property_count** **(** :ref:`int<class_int>` idx **)** const
  124. Returns the number of exported or overridden properties for the node at ``idx``.
  125. 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]``.
  126. .. _class_SceneState_method_get_node_property_name:
  127. - :ref:`String<class_String>` **get_node_property_name** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` prop_idx **)** const
  128. Returns the name of the property at ``prop_idx`` for the node at ``idx``.
  129. .. _class_SceneState_method_get_node_property_value:
  130. - :ref:`Variant<class_Variant>` **get_node_property_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` prop_idx **)** const
  131. Returns the value of the property at ``prop_idx`` for the node at ``idx``.
  132. .. _class_SceneState_method_get_node_type:
  133. - :ref:`String<class_String>` **get_node_type** **(** :ref:`int<class_int>` idx **)** const
  134. Returns the type of the node at ``idx``.
  135. .. _class_SceneState_method_is_node_instance_placeholder:
  136. - :ref:`bool<class_bool>` **is_node_instance_placeholder** **(** :ref:`int<class_int>` idx **)** const
  137. Returns ``true`` if the node at ``idx`` is an :ref:`InstancePlaceholder<class_InstancePlaceholder>`.