You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Rename ButtonList enum and members to MouseButton
This commit is contained in:
@@ -186,7 +186,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
|
||||
|
||||
void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) {
|
||||
const Ref<InputEventMouseButton> mb = p_event;
|
||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
||||
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||
Vector2 pos = mb->get_position();
|
||||
if (mb->is_pressed()) {
|
||||
if (pos.distance_to(get_size() / 2.0) < get_size().x / 2.0) {
|
||||
@@ -1123,23 +1123,21 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
|
||||
float zoom_factor = 1 + (ZOOM_FREELOOK_MULTIPLIER - 1) * b->get_factor();
|
||||
switch (b->get_button_index()) {
|
||||
case BUTTON_WHEEL_UP: {
|
||||
case MOUSE_BUTTON_WHEEL_UP: {
|
||||
if (is_freelook_active()) {
|
||||
scale_freelook_speed(zoom_factor);
|
||||
} else {
|
||||
scale_cursor_distance(1.0 / zoom_factor);
|
||||
}
|
||||
} break;
|
||||
|
||||
case BUTTON_WHEEL_DOWN: {
|
||||
case MOUSE_BUTTON_WHEEL_DOWN: {
|
||||
if (is_freelook_active()) {
|
||||
scale_freelook_speed(1.0 / zoom_factor);
|
||||
} else {
|
||||
scale_cursor_distance(zoom_factor);
|
||||
}
|
||||
} break;
|
||||
|
||||
case BUTTON_RIGHT: {
|
||||
case MOUSE_BUTTON_RIGHT: {
|
||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
||||
|
||||
if (b->is_pressed() && _edit.gizmo.is_valid()) {
|
||||
@@ -1200,7 +1198,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
} break;
|
||||
case BUTTON_MIDDLE: {
|
||||
case MOUSE_BUTTON_MIDDLE: {
|
||||
if (b->is_pressed() && _edit.mode != TRANSFORM_NONE) {
|
||||
switch (_edit.plane) {
|
||||
case TRANSFORM_VIEW: {
|
||||
@@ -1231,7 +1229,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case BUTTON_LEFT: {
|
||||
case MOUSE_BUTTON_LEFT: {
|
||||
if (b->is_pressed()) {
|
||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
||||
if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) {
|
||||
@@ -1440,7 +1438,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
|
||||
set_message(n + ": " + String(v));
|
||||
|
||||
} else if (m->get_button_mask() & BUTTON_MASK_LEFT) {
|
||||
} else if (m->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
|
||||
nav_mode = NAVIGATION_ORBIT;
|
||||
} else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_shift()) {
|
||||
@@ -1830,8 +1828,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if ((m->get_button_mask() & BUTTON_MASK_RIGHT) || freelook_active) {
|
||||
} else if ((m->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) || freelook_active) {
|
||||
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
|
||||
nav_mode = NAVIGATION_ZOOM;
|
||||
} else if (freelook_active) {
|
||||
@@ -1840,7 +1837,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
nav_mode = NAVIGATION_PAN;
|
||||
}
|
||||
|
||||
} else if (m->get_button_mask() & BUTTON_MASK_MIDDLE) {
|
||||
} else if (m->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
|
||||
const int mod = _get_key_modifier(m);
|
||||
if (nav_scheme == NAVIGATION_GODOT) {
|
||||
if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
|
||||
@@ -1851,13 +1848,11 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
// Always allow Alt as a modifier to better support graphic tablets.
|
||||
nav_mode = NAVIGATION_ORBIT;
|
||||
}
|
||||
|
||||
} else if (nav_scheme == NAVIGATION_MAYA) {
|
||||
if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
|
||||
nav_mode = NAVIGATION_PAN;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) {
|
||||
// Handle trackpad (no external mouse) use case
|
||||
const int mod = _get_key_modifier(m);
|
||||
@@ -4199,7 +4194,7 @@ Node3DEditorViewport::~Node3DEditorViewport() {
|
||||
void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
||||
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||
if (mb->is_pressed()) {
|
||||
Vector2 size = get_size();
|
||||
|
||||
@@ -6611,7 +6606,7 @@ void Node3DEditor::_update_preview_environment() {
|
||||
|
||||
void Node3DEditor::_sun_direction_input(const Ref<InputEvent> &p_event) {
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
||||
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||
float x = -mm->get_relative().y * 0.02 * EDSCALE;
|
||||
float y = mm->get_relative().x * 0.02 * EDSCALE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user