fix get_selected_nodes()

This commit is contained in:
Juan Linietsky 2016-09-10 17:50:20 -03:00
parent 65b93d177e
commit 2a003d7b4e
3 changed files with 36 additions and 15 deletions

View file

@ -12065,6 +12065,13 @@
Get the list of selectes nodes.
</description>
</method>
<method name="get_transformable_selected_nodes">
<return type="Array">
</return>
<description>
Get the list of selected nodes, optimized for transform operations (ie, moving them, rotating, etc). This list avoids situations where a node is selected and also chid/grandchild.
</description>
</method>
<method name="remove_node">
<argument index="0" name="node" type="Node">
</argument>

View file

@ -877,8 +877,7 @@ bool EditorSelection::is_selected(Node * p_node) const {
return selection.has(p_node);
}
Array EditorSelection::_get_selected_nodes() {
Array EditorSelection::_get_transformable_selected_nodes() {
Array ret;
@ -890,6 +889,18 @@ Array EditorSelection::_get_selected_nodes() {
return ret;
}
Array EditorSelection::_get_selected_nodes() {
Array ret;
for (Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
ret.push_back(E->key());
}
return ret;
}
void EditorSelection::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_node_removed"),&EditorSelection::_node_removed);
@ -897,6 +908,7 @@ void EditorSelection::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_node","node:Node"),&EditorSelection::add_node);
ObjectTypeDB::bind_method(_MD("remove_node","node:Node"),&EditorSelection::remove_node);
ObjectTypeDB::bind_method(_MD("get_selected_nodes"),&EditorSelection::_get_selected_nodes);
ObjectTypeDB::bind_method(_MD("get_transformable_selected_nodes"),&EditorSelection::_get_transformable_selected_nodes);
ADD_SIGNAL( MethodInfo("selection_changed") );
}

View file

@ -233,6 +233,8 @@ public:
void _update_nl();
Array _get_selected_nodes();
Array _get_transformable_selected_nodes();
protected:
static void _bind_methods();