You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
Refactored input, goes all via windows now.
Also renamed Input to InputFilter because all it does is filter events.
This commit is contained in:
committed by
Juan Linietsky
parent
9e08742de8
commit
8e6960a69e
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
#include "core/input/input.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/math/camera_matrix.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/print_string.h"
|
||||
@@ -298,10 +298,10 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) {
|
||||
float zoom_inertia = EDITOR_GET("editors/3d/navigation_feel/zoom_inertia");
|
||||
|
||||
//determine if being manipulated
|
||||
bool manipulated = Input::get_singleton()->get_mouse_button_mask() & (2 | 4);
|
||||
manipulated |= Input::get_singleton()->is_key_pressed(KEY_SHIFT);
|
||||
manipulated |= Input::get_singleton()->is_key_pressed(KEY_ALT);
|
||||
manipulated |= Input::get_singleton()->is_key_pressed(KEY_CONTROL);
|
||||
bool manipulated = InputFilter::get_singleton()->get_mouse_button_mask() & (2 | 4);
|
||||
manipulated |= InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT);
|
||||
manipulated |= InputFilter::get_singleton()->is_key_pressed(KEY_ALT);
|
||||
manipulated |= InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL);
|
||||
|
||||
float orbit_inertia = MAX(0.00001, manipulated ? manip_orbit_inertia : free_orbit_inertia);
|
||||
float translation_inertia = MAX(0.0001, manipulated ? manip_translation_inertia : free_translation_inertia);
|
||||
@@ -2260,7 +2260,7 @@ void SpatialEditorViewport::scale_freelook_speed(real_t scale) {
|
||||
Point2i SpatialEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const {
|
||||
Point2i relative;
|
||||
if (bool(EDITOR_DEF("editors/3d/navigation/warped_mouse_panning", false))) {
|
||||
relative = Input::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect());
|
||||
relative = InputFilter::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect());
|
||||
} else {
|
||||
relative = p_ev_mouse_motion->get_relative();
|
||||
}
|
||||
@@ -2276,7 +2276,7 @@ static bool is_shortcut_pressed(const String &p_path) {
|
||||
if (k == NULL) {
|
||||
return false;
|
||||
}
|
||||
const Input &input = *Input::get_singleton();
|
||||
const InputFilter &input = *InputFilter::get_singleton();
|
||||
int keycode = k->get_keycode();
|
||||
return input.is_key_pressed(keycode);
|
||||
}
|
||||
@@ -3771,7 +3771,7 @@ void SpatialEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p
|
||||
if (!can_drop_data_fw(p_point, p_data, p_from))
|
||||
return;
|
||||
|
||||
bool is_shift = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
|
||||
bool is_shift = InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT);
|
||||
|
||||
selected_files.clear();
|
||||
Dictionary d = p_data;
|
||||
@@ -5721,7 +5721,7 @@ void SpatialEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||
if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack())
|
||||
return;
|
||||
|
||||
snap_key_enabled = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
|
||||
snap_key_enabled = InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL);
|
||||
}
|
||||
void SpatialEditor::_notification(int p_what) {
|
||||
|
||||
@@ -6381,7 +6381,7 @@ Vector3 SpatialEditor::snap_point(Vector3 p_target, Vector3 p_start) const {
|
||||
|
||||
float SpatialEditor::get_translate_snap() const {
|
||||
float snap_value;
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
snap_value = snap_translate->get_text().to_double() / 10.0;
|
||||
} else {
|
||||
snap_value = snap_translate->get_text().to_double();
|
||||
@@ -6392,7 +6392,7 @@ float SpatialEditor::get_translate_snap() const {
|
||||
|
||||
float SpatialEditor::get_rotate_snap() const {
|
||||
float snap_value;
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
snap_value = snap_rotate->get_text().to_double() / 3.0;
|
||||
} else {
|
||||
snap_value = snap_rotate->get_text().to_double();
|
||||
@@ -6403,7 +6403,7 @@ float SpatialEditor::get_rotate_snap() const {
|
||||
|
||||
float SpatialEditor::get_scale_snap() const {
|
||||
float snap_value;
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
snap_value = snap_scale->get_text().to_double() / 2.0;
|
||||
} else {
|
||||
snap_value = snap_scale->get_text().to_double();
|
||||
|
||||
Reference in New Issue
Block a user