EditorSelection
Inherits: Object
Description
Section titled “Description”Manages the Stage selection in the editor.
This object manages the Stage selection in the editor.
Note: This class shouldn’t be instantiated directly. Instead, access the singleton using EditorInterface.get_selection().
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| void | add_entity(node: Entity) |
| void | clear() |
| Array[Entity] | get_selected_entities() |
| Array[Entity] | get_top_selected_entities() |
| void | remove_entity(node: Entity) |
Signals
Section titled “Signals”selection_changed
selection_changed()
Emitted when the selection changes.
Method descriptions
Section titled “Method descriptions”add_entity
void add_entity(node: Entity)
Adds a node to the selection.
Note: The newly selected node will not be automatically edited in the inspector. If you want to edit a node, use EditorInterface.edit_entity().
clear
void clear()
Clear the selection.
get_selected_entities
Array[Entity] get_selected_entities()
Returns the list of selected nodes.
get_top_selected_entities
Array[Entity] get_top_selected_entities()
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.
remove_entity
void remove_entity(node: Entity)
Removes a node from the selection.
