Index · Object → RefCounted → SceneState

SceneState

Provides access to a scene file's information.

Class Description

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 PackedScene contains without instantiating it.

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

Methods

func get_base_scene_state() -> SceneState

Returns the SceneState of the scene that this scene inherits from, or null if it doesn't inherit from any scene.

func get_connection_binds(idx: int) -> Array

Returns the list of bound parameters for the signal at idx.

func get_connection_count() -> int

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

func get_connection_flags(idx: int) -> int

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

func get_connection_method(idx: int) -> StringName

Returns the method connected to the signal at idx.

func get_connection_signal(idx: int) -> StringName

Returns the name of the signal at idx.

func get_connection_source(idx: int) -> NodePath

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

func get_connection_target(idx: int) -> NodePath

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

func get_connection_unbinds(idx: int) -> int

Returns the number of unbound parameters for the signal at idx.

func get_node_count() -> int

Returns the number of nodes in the scene.

The idx argument used to query node data in other get_node_* methods in the interval [0, get_node_count() - 1].

func get_node_groups(idx: int) -> PackedStringArray

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

func get_node_index(idx: int) -> int

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.

func get_node_instance(idx: int) -> PackedScene

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

func get_node_instance_placeholder(idx: int) -> String

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

func get_node_name(idx: int) -> StringName

Returns the name of the node at idx.

func get_node_owner_path(idx: int) -> NodePath

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

func get_node_path(idx: int, for_parent: bool = false) -> NodePath

Returns the path to the node at idx.

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

func get_node_property_count(idx: int) -> int

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

func get_node_property_name(idx: int, prop_idx: int) -> StringName

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

func get_node_property_value(idx: int, prop_idx: int) -> Variant

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

func get_node_type(idx: int) -> StringName

Returns the type of the node at idx.

func get_path() -> String

Returns the resource path to the represented PackedScene.

func is_node_instance_placeholder(idx: int) -> bool

Returns true if the node at idx is an InstancePlaceholder.

Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)

Enums & Constants

enum GenEditState
GEN_EDIT_STATE_DISABLED = 0

If passed to PackedScene.instantiate(), blocks edits to the scene state.

GEN_EDIT_STATE_INSTANCE = 1

If passed to PackedScene.instantiate(), provides inherited scene resources to the local scene.

Note: Only available in editor builds.

GEN_EDIT_STATE_MAIN = 2

If passed to PackedScene.instantiate(), provides local scene resources to the local scene. Only the main scene should receive the main edit state.

Note: Only available in editor builds.

GEN_EDIT_STATE_MAIN_INHERITED = 3

If passed to PackedScene.instantiate(), 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.