diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-10 13:34:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-10 13:34:38 +0200 |
commit | ad9e5ae9848c8baf6fe462cf22d7f5677f478174 (patch) | |
tree | 9276d2bde8238c5282bb7fb25351d8e2c5f1d8f6 /scene/gui | |
parent | dc856481ff6bbbddfa85779c39412bbaddc3c99a (diff) | |
parent | c1d5c7727cc9a537ec81f007be0b0987ccac91df (diff) |
Merge pull request #40228 from mrushyendra/multinode_selection_master
Emit signals for GraphEdit multi-node selection and unselection
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/graph_edit.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 1ea790fc4f..11b4c9e857 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -812,9 +812,20 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { bool in_box = r.intersects(box_selecting_rect); if (in_box) { + if (!gn->is_selected() && box_selection_mode_additive) { + emit_signal("node_selected", gn); + } else if (gn->is_selected() && !box_selection_mode_additive) { + emit_signal("node_unselected", gn); + } gn->set_selected(box_selection_mode_additive); } else { - gn->set_selected(previus_selected.find(gn) != nullptr); + bool select = (previus_selected.find(gn) != nullptr); + if (gn->is_selected() && !select) { + emit_signal("node_unselected", gn); + } else if (!gn->is_selected() && select) { + emit_signal("node_selected", gn); + } + gn->set_selected(select); } } @@ -832,7 +843,13 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { continue; } - gn->set_selected(previus_selected.find(gn) != nullptr); + bool select = (previus_selected.find(gn) != nullptr); + if (gn->is_selected() && !select) { + emit_signal("node_unselected", gn); + } else if (!gn->is_selected() && select) { + emit_signal("node_selected", gn); + } + gn->set_selected(select); } top_layer->update(); } else { @@ -855,6 +872,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { Rect2 r = gn->get_rect(); r.size *= zoom; if (r.has_point(b->get_position())) { + emit_signal("node_unselected", gn); gn->set_selected(false); } } |