func _ready() -> void:
# connecting signal and adding nodes as extra arguments so we can check if they are visible
var _ok = get_child(0).connect('visibility_changed', self, '_on_visibility_changed', [[get_child(0)]])
# child node connected as [ node, node.parent, parent.parent , ....]
_ok = get_child(0).get_child(0).connect('visibility_changed', self, '_on_visibility_changed', [[get_child(0).get_child(0), get_child(0),]])
func _on_visibility_changed(nodes : Array):
var visibility = true
# check nodes from child to parent and update visibility
for node in nodes:
# if any node is hidden it will stop and changes visibility to false
if node == null: return
if !node.visible:
visibility = node.visible
break
print( "%s visibility = %s" % [nodes[0].name, visibility])