From 04c749a1f034c0b2256fdca0ca2675f696b490e8 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 13 Jan 2017 10:45:50 -0300 Subject: New API for visibility in both CanvasItem and Spatial visible (property) - access set_visible(bool) is_visible() is_visible_in_tree() - true when visible and parents visible show() hide() - for convenience --- scene/gui/base_button.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scene/gui/base_button.cpp') diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 45c491cd74..e161906775 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -297,7 +297,7 @@ void BaseButton::_notification(int p_what) { } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible()) { + if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree()) { if (!toggle_mode) { status.pressed = false; @@ -453,7 +453,7 @@ Ref BaseButton:: get_shortcut() const { void BaseButton::_unhandled_input(InputEvent p_event) { - if (!is_disabled() && is_visible() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { + if (!is_disabled() && is_visible_in_tree() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) return; //ignore because of modal window -- cgit v1.2.3