SceneState

    A script interface to a scene file’s data.

    Maintains a list of resources, nodes, exported, and overridden properties, and built-in scripts associated with a scene.

    This class cannot be instantiated directly, it is retrieved for a given scene as the result of .

    enum GenEditState:

    • GEN_EDIT_STATE_DISABLED = 0 —- If passed to PackedScene.instance, blocks edits to the scene state.

    • GEN_EDIT_STATE_INSTANCE = 1 —- If passed to , provides inherited scene resources to the local scene.

    Note: Only available in editor builds.

    • GEN_EDIT_STATE_MAIN = 2 —- If passed to PackedScene.instance, provides local scene resources to the local scene. Only the main scene should receive the main edit state.
    • GEN_EDIT_STATE_MAIN_INHERITED = 3 —- If passed to , it’s similar to GEN_EDIT_STATE_MAIN, but for the case where the scene is being instantiated to be the base of another one.

    Note: Only available in editor builds.

    Returns the list of bound parameters for the signal at .


    • int get_connection_count ( ) const

    Returns the number of signal connections in the scene.

    The idx argument used to query connection metadata in other get_connection_* methods in the interval [0, get_connection_count() - 1].


    • get_connection_flags ( int idx ) const

    Returns the connection flags for the signal at idx. See constants.


    • String get_connection_method ( idx ) const

    Returns the method connected to the signal at idx.


    • String get_connection_signal ( idx ) const

    Returns the name of the signal at idx.


    • NodePath get_connection_source ( idx ) const

    Returns the path to the node that owns the signal at idx, relative to the root node.


    • NodePath get_connection_target ( idx ) const

    Returns the path to the node that owns the method connected to the signal at idx, relative to the root node.


    • int get_node_count ( ) const

    Returns the number of nodes in the scene.

    The idx argument used to query node data in other get_node_* methods in the interval .


    • get_node_groups ( int idx ) const

    Returns the list of group names associated with the node at idx.


    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.


    • get_node_instance ( int idx ) const

    Returns a 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.


    • String get_node_instance_placeholder ( idx ) const

    Returns the path to the represented scene file if the node at idx is an InstancePlaceholder.


    • get_node_name ( int idx ) const

    Returns the name of the node at idx.


    • get_node_owner_path ( int idx ) const

    Returns the path to the owner of the node at idx, relative to the root node.


    • get_node_path ( int idx, for_parent=false ) const

    Returns the path to the node at idx.

    If for_parent is true, returns the path of the node’s parent instead.


    • int get_node_property_count ( idx ) const

    Returns the number of exported or overridden properties for the node at idx.

    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].


    • String get_node_property_name ( idx, int prop_idx ) const

    Returns the name of the property at prop_idx for the node at idx.


    • get_node_property_value ( int idx, prop_idx ) const

    Returns the value of the property at prop_idx for the node at idx.



    • bool is_node_instance_placeholder ( idx ) const

    Returns true if the node at is an InstancePlaceholder.