Skip to content

SceneState

Inherits: RefCounted < Object

Provides access to a scene file’s information.

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

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

Returns Method
SceneState get_base_scene_state() const
Array get_connection_binds(idx: int) const
int get_connection_count() const
int get_connection_flags(idx: int) const
StringName get_connection_method(idx: int) const
StringName get_connection_signal(idx: int) const
EntityPath get_connection_source(idx: int) const
EntityPath get_connection_target(idx: int) const
int get_connection_unbinds(idx: int) const
int get_entity_count() const
PackedStringArray get_entity_groups(idx: int) const
int get_entity_index(idx: int) const
Prefab get_entity_instance(idx: int) const
String get_entity_instance_placeholder(idx: int) const
StringName get_entity_name(idx: int) const
EntityPath get_entity_owner_path(idx: int) const
EntityPath get_entity_path(idx: int, for_parent: bool = false) const
int get_entity_property_count(idx: int) const
StringName get_entity_property_name(idx: int, prop_idx: int) const
Variant get_entity_property_value(idx: int, prop_idx: int) const
StringName get_entity_type(idx: int) const
String get_path() const
bool is_entity_instance_placeholder(idx: int) const

GenEditState

enum GenEditState

GEN_EDIT_STATE_DISABLED = 0

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

GEN_EDIT_STATE_INSTANCE = 1

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

Note: Only available in editor builds.

GEN_EDIT_STATE_MAIN = 2

If passed to Prefab.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 Prefab.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.

get_base_scene_state

SceneState get_base_scene_state() const

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

get_connection_binds

Array get_connection_binds(idx: int) const

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

get_connection_count

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 get_connection_flags(idx: int) const

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

get_connection_method

StringName get_connection_method(idx: int) const

Returns the method connected to the signal at idx.

get_connection_signal

StringName get_connection_signal(idx: int) const

Returns the name of the signal at idx.

get_connection_source

EntityPath get_connection_source(idx: int) const

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

get_connection_target

EntityPath get_connection_target(idx: int) const

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

get_connection_unbinds

int get_connection_unbinds(idx: int) const

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

get_entity_count

int get_entity_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 [0, get_entity_count() - 1].

get_entity_groups

PackedStringArray get_entity_groups(idx: int) const

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

get_entity_index

int get_entity_index(idx: int) const

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.

get_entity_instance

Prefab get_entity_instance(idx: int) const

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

get_entity_instance_placeholder

String get_entity_instance_placeholder(idx: int) const

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

get_entity_name

StringName get_entity_name(idx: int) const

Returns the name of the node at idx.

get_entity_owner_path

EntityPath get_entity_owner_path(idx: int) const

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

get_entity_path

EntityPath get_entity_path(idx: int, for_parent: bool = false) const

Returns the path to the node at idx.

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

get_entity_property_count

int get_entity_property_count(idx: int) 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_entity_property_count() - 1].

get_entity_property_name

StringName get_entity_property_name(idx: int, prop_idx: int) const

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

get_entity_property_value

Variant get_entity_property_value(idx: int, prop_idx: int) const

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

get_entity_type

StringName get_entity_type(idx: int) const

Returns the type of the node at idx.

get_path

String get_path() const

Returns the resource path to the represented Prefab.

is_entity_instance_placeholder

bool is_entity_instance_placeholder(idx: int) const

Returns true if the node at idx is an InstancePlaceholder.