Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SceneState

Inherits: RefCounted < Object

提供对场景文件信息的访问。

Description

维护一个与场景相关的资源、节点、导出的和重写的属性以及内置脚本的列表。无法从 SceneState 修改,只能读取。可用于在不实例化 PackedScene 的前提下观察其中的内容。

这个类不能直接实例化,它是作为 PackedScene.get_state 的结果为一个给定的场景检索的。

Methods

Array

get_connection_binds ( int idx ) const

int

get_connection_count ( ) const

int

get_connection_flags ( int idx ) const

StringName

get_connection_method ( int idx ) const

StringName

get_connection_signal ( int idx ) const

NodePath

get_connection_source ( int idx ) const

NodePath

get_connection_target ( int idx ) const

int

get_connection_unbinds ( int idx ) const

int

get_node_count ( ) const

PackedStringArray

get_node_groups ( int idx ) const

int

get_node_index ( int idx ) const

PackedScene

get_node_instance ( int idx ) const

String

get_node_instance_placeholder ( int idx ) const

StringName

get_node_name ( int idx ) const

NodePath

get_node_owner_path ( int idx ) const

NodePath

get_node_path ( int idx, bool for_parent=false ) const

int

get_node_property_count ( int idx ) const

StringName

get_node_property_name ( int idx, int prop_idx ) const

Variant

get_node_property_value ( int idx, int prop_idx ) const

StringName

get_node_type ( int idx ) const

bool

is_node_instance_placeholder ( int idx ) const


Enumerations

enum GenEditState:

GenEditState GEN_EDIT_STATE_DISABLED = 0

如果传递给 PackedScene.instantiate,则会阻止对场景状态的编辑。

GenEditState GEN_EDIT_STATE_INSTANCE = 1

如果传递给 PackedScene.instantiate,则会把继承的场景资源提供给本地场景。

注意:仅在编辑器构建中可用。

GenEditState GEN_EDIT_STATE_MAIN = 2

如果传递给 PackedScene.instantiate,则会为本地场景提供本地场景资源。只有主场景应该接收主编辑状态。

注意:仅在编辑器构建中可用。

GenEditState GEN_EDIT_STATE_MAIN_INHERITED = 3

如果传递给 PackedScene.instantiate,则类似于 GEN_EDIT_STATE_MAIN,但适用于该场景被实例化为另一个场景的基类的情况。

注意:仅在编辑器构建中可用。


Method Descriptions

Array get_connection_binds ( int idx ) const

返回 idx 处信号的绑定参数列表。


int get_connection_count ( ) const

返回场景中的信号连接数。

用于查询其他 get_connection_* 方法中的连接元数据的 idx 参数,范围是 [0, get_connection_count() - 1]


int get_connection_flags ( int idx ) const

返回 idx 处的信号的连接标志。见 ConnectFlags 常量。


StringName get_connection_method ( int idx ) const

返回连接到 idx 处信号的方法。