You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add set_pressed_no_signal method to BaseButton
(cherry picked from commit 50c63bdc4c)
This commit is contained in:
@@ -231,6 +231,18 @@ void BaseButton::set_pressed(bool p_pressed) {
|
||||
update();
|
||||
}
|
||||
|
||||
void BaseButton::set_pressed_no_signal(bool p_pressed) {
|
||||
if (!toggle_mode) {
|
||||
return;
|
||||
}
|
||||
if (status.pressed == p_pressed) {
|
||||
return;
|
||||
}
|
||||
status.pressed = p_pressed;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
bool BaseButton::is_pressing() const {
|
||||
return status.press_attempt;
|
||||
}
|
||||
@@ -385,6 +397,7 @@ void BaseButton::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_unhandled_input"), &BaseButton::_unhandled_input);
|
||||
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_pressed"), &BaseButton::is_pressed);
|
||||
ClassDB::bind_method(D_METHOD("set_pressed_no_signal", "pressed"), &BaseButton::set_pressed_no_signal);
|
||||
ClassDB::bind_method(D_METHOD("is_hovered"), &BaseButton::is_hovered);
|
||||
ClassDB::bind_method(D_METHOD("set_toggle_mode", "enabled"), &BaseButton::set_toggle_mode);
|
||||
ClassDB::bind_method(D_METHOD("is_toggle_mode"), &BaseButton::is_toggle_mode);
|
||||
|
||||
Reference in New Issue
Block a user