Clarify API for top selected nodes in EditorSelection and make public

This commit is contained in:
Aaron Franke 2024-12-01 06:40:29 -08:00
parent 594d64ec24
commit 17db92b8b8
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
12 changed files with 119 additions and 102 deletions

View file

@ -286,10 +286,9 @@ class EditorSelection : public Object {
// Editor plugins which are related to selection.
List<Object *> editor_plugins;
List<Node *> selected_node_list;
List<Node *> top_selected_node_list;
void _update_node_list();
TypedArray<Node> _get_transformable_selected_nodes();
void _emit_change();
protected:
@ -314,13 +313,15 @@ public:
void update();
void clear();
// Returns all the selected nodes.
TypedArray<Node> get_selected_nodes();
// Returns only the top level selected nodes.
// That is, if the selection includes some node and a child of that node, only the parent is returned.
const List<Node *> &get_selected_node_list();
const List<Node *> &get_top_selected_node_list();
// Same as get_top_selected_node_list but returns a copy in a TypedArray for binding to scripts.
TypedArray<Node> get_top_selected_nodes();
// Returns all the selected nodes (list version of "get_selected_nodes").
List<Node *> get_full_selected_node_list();
// Same as get_full_selected_node_list but returns a copy in a TypedArray for binding to scripts.
TypedArray<Node> get_selected_nodes();
// Returns the map of selected objects and their metadata.
HashMap<Node *, Object *> &get_selection() { return selection; }