You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #40228 from mrushyendra/multinode_selection_master
Emit signals for GraphEdit multi-node selection and unselection
This commit is contained in:
@@ -812,9 +812,20 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
|||||||
bool in_box = r.intersects(box_selecting_rect);
|
bool in_box = r.intersects(box_selecting_rect);
|
||||||
|
|
||||||
if (in_box) {
|
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);
|
gn->set_selected(box_selection_mode_additive);
|
||||||
} else {
|
} 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;
|
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();
|
top_layer->update();
|
||||||
} else {
|
} else {
|
||||||
@@ -855,6 +872,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
|||||||
Rect2 r = gn->get_rect();
|
Rect2 r = gn->get_rect();
|
||||||
r.size *= zoom;
|
r.size *= zoom;
|
||||||
if (r.has_point(b->get_position())) {
|
if (r.has_point(b->get_position())) {
|
||||||
|
emit_signal("node_unselected", gn);
|
||||||
gn->set_selected(false);
|
gn->set_selected(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user