1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Update GraphNode selection logic if not visible

This commit is contained in:
Tibo
2025-07-31 18:38:03 +02:00
parent 0dd9178269
commit 2aa76439ce
2 changed files with 17 additions and 0 deletions

View File

@@ -587,6 +587,12 @@ void GraphEdit::_graph_element_deselected(Node *p_node) {
emit_signal(SNAME("node_deselected"), graph_element);
}
void GraphEdit::_graph_element_visibility_changed(GraphElement *p_graph_element) {
if (p_graph_element->is_selected() && !p_graph_element->is_visible()) {
p_graph_element->set_selected(false);
}
}
void GraphEdit::_graph_element_resize_request(const Vector2 &p_new_minsize, Node *p_node) {
GraphElement *graph_element = Object::cast_to<GraphElement>(p_node);
ERR_FAIL_NULL(graph_element);
@@ -700,6 +706,7 @@ void GraphEdit::add_child_notify(Node *p_child) {
graph_element->connect("position_offset_changed", callable_mp(this, &GraphEdit::_graph_element_moved).bind(graph_element));
graph_element->connect("node_selected", callable_mp(this, &GraphEdit::_graph_element_selected).bind(graph_element));
graph_element->connect("node_deselected", callable_mp(this, &GraphEdit::_graph_element_deselected).bind(graph_element));
graph_element->connect(SceneStringName(visibility_changed), callable_mp(this, &GraphEdit::_graph_element_visibility_changed).bind(graph_element));
GraphNode *graph_node = Object::cast_to<GraphNode>(graph_element);
if (graph_node) {
@@ -756,6 +763,7 @@ void GraphEdit::remove_child_notify(Node *p_child) {
graph_element->disconnect("position_offset_changed", callable_mp(this, &GraphEdit::_graph_element_moved));
graph_element->disconnect("node_selected", callable_mp(this, &GraphEdit::_graph_element_selected));
graph_element->disconnect("node_deselected", callable_mp(this, &GraphEdit::_graph_element_deselected));
graph_element->disconnect(SceneStringName(visibility_changed), callable_mp(this, &GraphEdit::_graph_element_visibility_changed));
GraphNode *graph_node = Object::cast_to<GraphNode>(graph_element);
if (graph_node) {
@@ -2041,6 +2049,10 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
continue;
}
if (!graph_element->is_visible()) {
continue;
}
// Only select frames when the box selection is fully enclosing them.
bool is_frame = Object::cast_to<GraphFrame>(graph_element);
Rect2 r = graph_element->get_rect();
@@ -2174,6 +2186,10 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
continue;
}
if (!selected_element->is_visible()) {
continue;
}
if (selected_element->is_resizing()) {
continue;
}