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.

EditorSelection

繼承: Object

管理編輯器中的 SceneTree 選擇。

說明

這個物件管理編輯器中的 SceneTree 選擇。

注意:這個類不應該直接產生實體。相反,使用EditorInterface.get_selection()存取單例。

方法

void

add_node(node: Node)

void

clear()

Array[Node]

get_selected_nodes()

Array[Node]

get_top_selected_nodes()

Array[Node]

get_transformable_selected_nodes()

void

remove_node(node: Node)


訊號

selection_changed() 🔗

更改選擇時發出。


方法說明

void add_node(node: Node) 🔗

將一個節點新增到選擇中。

注意:新選擇的節點不會在屬性檢視器中自動被編輯。如果你想編輯一個節點,請使用 EditorInterface.edit_node()


void clear() 🔗

清除選中項。


Array[Node] get_selected_nodes() 🔗

Returns the list of selected nodes.


Array[Node] get_top_selected_nodes() 🔗

Returns the list of top selected nodes only, excluding any children. This is useful for performing transform operations (moving them, rotating, etc.).

For example, if there is a node A with a child B and a sibling C, then selecting all three will cause this method to return only A and C. Changing the global transform of A will affect the global transform of B, so there is no need to change B separately.


Array[Node] get_transformable_selected_nodes() 🔗

已棄用: Use get_top_selected_nodes() instead.

Returns the list of top selected nodes only, excluding any children. This is useful for performing transform operations (moving them, rotating, etc.). See get_top_selected_nodes().


void remove_node(node: Node) 🔗

從選擇中刪除一個節點。