Merge pull request #116778 from YeldhamDev/orbiting_around_the_world

Fix `GridMap` editor pasting when orbiting using the "Alt" key
This commit is contained in:
Thaddeus Crews 2026-02-27 08:49:39 -06:00
commit 95535167b3
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
2 changed files with 26 additions and 19 deletions

View file

@ -832,10 +832,14 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
}
if (mb->is_pressed()) {
Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->is_alt_pressed()) {
input_action = INPUT_NONE;
} else if (mb->get_button_index() == MouseButton::LEFT) {
if (mb->get_button_index() == MouseButton::LEFT) {
Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->is_alt_pressed()) {
return EditorPlugin::AFTER_GUI_INPUT_PASS;
}
valid_mb_press = true;
bool can_edit = (node && node->get_mesh_library().is_valid());
if (input_action == INPUT_PASTE) {
_do_paste();
@ -862,6 +866,9 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
return EditorPlugin::AFTER_GUI_INPUT_STOP;
} else if (selection.active) {
_set_selection(false);
if (input_action == INPUT_SELECT) {
input_action = INPUT_NONE;
}
return EditorPlugin::AFTER_GUI_INPUT_STOP;
}
} else {
@ -896,22 +903,21 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
return EditorPlugin::AFTER_GUI_INPUT_PASS;
}
if (mb->get_button_index() == MouseButton::LEFT && input_action == INPUT_SELECT) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("GridMap Selection"));
undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
undo_redo->commit_action();
}
if (valid_mb_press && mb->get_button_index() == MouseButton::LEFT) {
valid_mb_press = false;
if (mb->get_button_index() == MouseButton::LEFT && input_action != INPUT_NONE) {
set_items.clear();
input_action = INPUT_NONE;
return EditorPlugin::AFTER_GUI_INPUT_STOP;
}
if (mb->get_button_index() == MouseButton::RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
input_action = INPUT_NONE;
return EditorPlugin::AFTER_GUI_INPUT_STOP;
if (input_action == INPUT_SELECT) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("GridMap Selection"));
undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
undo_redo->commit_action();
}
if (input_action != INPUT_NONE) {
set_items.clear();
input_action = INPUT_NONE;
return EditorPlugin::AFTER_GUI_INPUT_STOP;
}
}
}
}

View file

@ -69,6 +69,7 @@ class GridMapEditor : public EditorDock {
};
InputAction input_action = INPUT_NONE;
bool valid_mb_press = false;
Panel *panel = nullptr;
MenuButton *options = nullptr;
SpinBox *floor = nullptr;