First attempt at making a more useful EditorPlugin API. Still undocumented, but feedback welcome!
This commit is contained in:
parent
7d8b7df19d
commit
2a7fdb23b3
12 changed files with 167 additions and 15 deletions
|
|
@ -791,6 +791,8 @@ void EditorSelection::_node_removed(Node *p_node) {
|
|||
|
||||
void EditorSelection::add_node(Node *p_node) {
|
||||
|
||||
ERR_FAIL_NULL(p_node);
|
||||
|
||||
if (selection.has(p_node))
|
||||
return;
|
||||
|
||||
|
|
@ -814,6 +816,8 @@ void EditorSelection::add_node(Node *p_node) {
|
|||
|
||||
void EditorSelection::remove_node(Node *p_node) {
|
||||
|
||||
ERR_FAIL_NULL(p_node);
|
||||
|
||||
if (!selection.has(p_node))
|
||||
return;
|
||||
|
||||
|
|
@ -832,12 +836,25 @@ bool EditorSelection::is_selected(Node * p_node) const {
|
|||
}
|
||||
|
||||
|
||||
Array EditorSelection::_get_selected_nodes() {
|
||||
|
||||
Array ret;
|
||||
|
||||
for (List<Node*>::Element *E=selected_node_list.front();E;E=E->next()) {
|
||||
|
||||
ret.push_back(E->get());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EditorSelection::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_node_removed"),&EditorSelection::_node_removed);
|
||||
ObjectTypeDB::bind_method(_MD("clear"),&EditorSelection::clear);
|
||||
ObjectTypeDB::bind_method(_MD("add_node"),&EditorSelection::add_node);
|
||||
ObjectTypeDB::bind_method(_MD("add_node","node"),&EditorSelection::add_node);
|
||||
ObjectTypeDB::bind_method(_MD("remove_node","node"),&EditorSelection::remove_node);
|
||||
ObjectTypeDB::bind_method(_MD("get_selected_nodes"),&EditorSelection::_get_selected_nodes);
|
||||
ADD_SIGNAL( MethodInfo("selection_changed") );
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue