@@ -587,6 +587,12 @@ void GraphEdit::_graph_element_deselected(Node *p_node) {
587587 emit_signal (SNAME (" node_deselected" ), graph_element);
588588}
589589
590+ void GraphEdit::_graph_element_visibility_changed (GraphElement *p_graph_element) {
591+ if (p_graph_element->is_selected () && !p_graph_element->is_visible ()) {
592+ p_graph_element->set_selected (false );
593+ }
594+ }
595+
590596void GraphEdit::_graph_element_resize_request (const Vector2 &p_new_minsize, Node *p_node) {
591597 GraphElement *graph_element = Object::cast_to<GraphElement>(p_node);
592598 ERR_FAIL_NULL (graph_element);
@@ -700,6 +706,7 @@ void GraphEdit::add_child_notify(Node *p_child) {
700706 graph_element->connect (" position_offset_changed" , callable_mp (this , &GraphEdit::_graph_element_moved).bind (graph_element));
701707 graph_element->connect (" node_selected" , callable_mp (this , &GraphEdit::_graph_element_selected).bind (graph_element));
702708 graph_element->connect (" node_deselected" , callable_mp (this , &GraphEdit::_graph_element_deselected).bind (graph_element));
709+ graph_element->connect (SceneStringName (visibility_changed), callable_mp (this , &GraphEdit::_graph_element_visibility_changed).bind (graph_element));
703710
704711 GraphNode *graph_node = Object::cast_to<GraphNode>(graph_element);
705712 if (graph_node) {
@@ -756,6 +763,7 @@ void GraphEdit::remove_child_notify(Node *p_child) {
756763 graph_element->disconnect (" position_offset_changed" , callable_mp (this , &GraphEdit::_graph_element_moved));
757764 graph_element->disconnect (" node_selected" , callable_mp (this , &GraphEdit::_graph_element_selected));
758765 graph_element->disconnect (" node_deselected" , callable_mp (this , &GraphEdit::_graph_element_deselected));
766+ graph_element->disconnect (SceneStringName (visibility_changed), callable_mp (this , &GraphEdit::_graph_element_visibility_changed));
759767
760768 GraphNode *graph_node = Object::cast_to<GraphNode>(graph_element);
761769 if (graph_node) {
@@ -2041,6 +2049,10 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
20412049 continue ;
20422050 }
20432051
2052+ if (!graph_element->is_visible ()) {
2053+ continue ;
2054+ }
2055+
20442056 // Only select frames when the box selection is fully enclosing them.
20452057 bool is_frame = Object::cast_to<GraphFrame>(graph_element);
20462058 Rect2 r = graph_element->get_rect ();
@@ -2174,6 +2186,10 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
21742186 continue ;
21752187 }
21762188
2189+ if (!selected_element->is_visible ()) {
2190+ continue ;
2191+ }
2192+
21772193 if (selected_element->is_resizing ()) {
21782194 continue ;
21792195 }
0 commit comments