Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Input::VelocityTrack::VelocityTrack() {
bool Input::is_anything_pressed() const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -294,7 +294,7 @@ bool Input::is_anything_pressed() const {
bool Input::is_anything_pressed_except_mouse() const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -314,7 +314,7 @@ bool Input::is_anything_pressed_except_mouse() const {
bool Input::is_key_pressed(Key p_keycode) const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -324,7 +324,7 @@ bool Input::is_key_pressed(Key p_keycode) const {
bool Input::is_physical_key_pressed(Key p_keycode) const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -334,7 +334,7 @@ bool Input::is_physical_key_pressed(Key p_keycode) const {
bool Input::is_key_label_pressed(Key p_keycode) const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -344,7 +344,7 @@ bool Input::is_key_label_pressed(Key p_keycode) const {
bool Input::is_mouse_button_pressed(MouseButton p_button) const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -362,7 +362,7 @@ static JoyButton _combine_device(JoyButton p_value, int p_device) {
bool Input::is_joy_button_pressed(int p_device, JoyButton p_button) const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -372,7 +372,7 @@ bool Input::is_joy_button_pressed(int p_device, JoyButton p_button) const {
bool Input::is_action_pressed(const StringName &p_action, bool p_exact) const {
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -387,7 +387,7 @@ bool Input::is_action_pressed(const StringName &p_action, bool p_exact) const {
bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) const {
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -413,7 +413,7 @@ bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) con
bool Input::is_action_just_released(const StringName &p_action, bool p_exact) const {
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));

if (disable_input) {
if (input_disabled) {
return false;
}

Expand All @@ -439,7 +439,7 @@ bool Input::is_action_just_released(const StringName &p_action, bool p_exact) co
float Input::get_action_strength(const StringName &p_action, bool p_exact) const {
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), 0.0, InputMap::get_singleton()->suggest_actions(p_action));

if (disable_input) {
if (input_disabled) {
return 0.0f;
}

Expand All @@ -458,7 +458,7 @@ float Input::get_action_strength(const StringName &p_action, bool p_exact) const
float Input::get_action_raw_strength(const StringName &p_action, bool p_exact) const {
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), 0.0, InputMap::get_singleton()->suggest_actions(p_action));

if (disable_input) {
if (input_disabled) {
return 0.0f;
}

Expand Down Expand Up @@ -507,7 +507,7 @@ Vector2 Input::get_vector(const StringName &p_negative_x, const StringName &p_po
float Input::get_joy_axis(int p_device, JoyAxis p_axis) const {
_THREAD_SAFE_METHOD_

if (disable_input) {
if (input_disabled) {
return 0;
}

Expand Down Expand Up @@ -1829,12 +1829,12 @@ int Input::get_unused_joy_id() {
return -1;
}

void Input::set_disable_input(bool p_disable) {
disable_input = p_disable;
void Input::set_input_disabled(bool p_disable) {
input_disabled = p_disable;
}

bool Input::is_input_disabled() const {
return disable_input;
return input_disabled;
}

Input::Input() {
Expand Down
4 changes: 2 additions & 2 deletions core/input/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Input : public Object {
Vector2 mouse_pos;
int64_t mouse_window = 0;
bool legacy_just_pressed_behavior = false;
bool disable_input = false;
bool input_disabled = false;

struct ActionState {
uint64_t pressed_physics_frame = UINT64_MAX;
Expand Down Expand Up @@ -393,7 +393,7 @@ class Input : public Object {

void set_event_dispatch_function(EventDispatchFunc p_function);

void set_disable_input(bool p_disable);
void set_input_disabled(bool p_disable);
bool is_input_disabled() const;

Input();
Expand Down
12 changes: 6 additions & 6 deletions scene/debugger/scene_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1504,10 +1504,10 @@ void RuntimeNodeSelect::_update_input_state() {
return;
}

bool disable_input = scene_tree->is_suspended() || node_select_type != RuntimeNodeSelect::NODE_TYPE_NONE;
Input::get_singleton()->set_disable_input(disable_input);
Input::get_singleton()->set_mouse_mode_override_enabled(disable_input);
scene_tree->get_root()->set_disable_input_override(disable_input);
bool should_disable_input = scene_tree->is_suspended() || node_select_type != RuntimeNodeSelect::NODE_TYPE_NONE;
Input::get_singleton()->set_input_disabled(should_disable_input);
Input::get_singleton()->set_mouse_mode_override_enabled(should_disable_input);
scene_tree->get_root()->set_disable_input_override(should_disable_input);
Copy link
Author

@Lexyth Lexyth Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fairly certain the name should be changed to set_input_disabled_override, too, but changing anything public about Window seems like a rabbit hole I'd rather avoid.

}

void RuntimeNodeSelect::_process_frame() {
Expand All @@ -1523,7 +1523,7 @@ void RuntimeNodeSelect::_process_frame() {
Input *input = Input::get_singleton();
bool was_input_disabled = input->is_input_disabled();
if (was_input_disabled) {
input->set_disable_input(false);
input->set_input_disabled(false);
}

if (input->is_physical_key_pressed(Key::A)) {
Expand Down Expand Up @@ -1554,7 +1554,7 @@ void RuntimeNodeSelect::_process_frame() {
}

if (was_input_disabled) {
input->set_disable_input(true);
input->set_input_disabled(true);
}

if (direction != Vector3()) {
Expand Down