From 1bafc3c6cf442370a03b2ffa0383b6face6063c0 Mon Sep 17 00:00:00 2001 From: Matthias Hoelzl Date: Mon, 28 Aug 2017 16:04:19 +0200 Subject: [PATCH] Fix inconsistent toggle button behavior --- scene/gui/base_button.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 8fd19e86556..5713a35b7a8 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -87,14 +87,14 @@ void BaseButton::_gui_input(Ref p_event) { status.pressed = !status.pressed; pressed(); - if (get_script_instance()) { - Variant::CallError ce; - get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce); - } + emit_signal("pressed"); _unpress_group(); toggled(status.pressed); + if (get_script_instance()) { + get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, status.pressed); + } emit_signal("toggled", status.pressed); } @@ -143,10 +143,10 @@ void BaseButton::_gui_input(Ref p_event) { emit_signal("pressed"); toggled(status.pressed); - emit_signal("toggled", status.pressed); if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, status.pressed); } + emit_signal("toggled", status.pressed); } _unpress_group();