Repository: godotengine/godot
File: editor/editor_settings_dialog.cpp (C++)

Code before:
		set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
		set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_RIGHT_MOUSE;
		orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_1 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
	} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) {
		set_preset = true;
		set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
		pan_mod_key_2 = InputEventKey::create_reference(Key::ALT);
		zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		zoom_mod_key_2 = InputEventKey::create_reference(Key::CTRL);
	}
	// Set settings to the desired preset value
	if (set_preset) {
		EditorSettings::get_singleton()->set_manually("editors/3d/navigation/orbit_mouse_button", (int)set_orbit_mouse_button);
		EditorSettings::get_singleton()->set_manually("editors/3d/navigation/pan_mouse_button", (int)set_pan_mouse_button);
		EditorSettings::get_singleton()->set_manually("editors/3d/navigation/zoom_mouse_button", (int)set_zoom_mouse_button);
		_set_shortcut_input("spatial_editor/viewport_orbit_modifier_1", orbit_mod_key_1);
		_set_shortcut_input("spatial_editor/viewport_orbit_modifier_2", orbit_mod_key_2);
		_set_shortcut_input("spatial_editor/viewport_pan_modifier_1", pan_mod_key_1);
		_set_shortcut_input("spatial_editor/viewport_pan_modifier_2", pan_mod_key_2);
		_set_shortcut_input("spatial_editor/viewport_zoom_modifier_1", zoom_mod_key_1);
		_set_shortcut_input("spatial_editor/viewport_zoom_modifier_2", zoom_mod_key_2);
	}
}

void EditorSettingsDialog::_set_shortcut_input(const String &p_name, Ref<InputEventKey> &p_event) {
	Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_name);
	Array sc_events = sc->get_events();
	sc_events.clear();
	if (p_event->get_keycode() != Key::NONE) {
		sc_events.push_back((Variant)p_event);
	}
	sc->set_events(sc_events);
}

void EditorSettingsDialog::_settings_save() {
	EditorSettings::get_singleton()->notify_changes();
	EditorSettings::get_singleton()->save();
}

void EditorSettingsDialog::cancel_pressed() {

Review comment (suggestion):
```suggestion
	// Set settings to the desired preset values.
```

Code after:
		orbit_mod_key_1 = InputEventKey::create_reference(Key::NONE);
		orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
		pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		zoom_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
		zoom_mod_key_2 = InputEventKey::create_reference(Key::CTRL);
	} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA) {
		set_preset = true;
		set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
		set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_RIGHT_MOUSE;
		orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_1 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
	} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) {
		set_preset = true;
		set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
		orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
		pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
		pan_mod_key_2 = InputEventKey::create_reference(Key::ALT);
		zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
		zoom_mod_key_2 = InputEventKey::create_reference(Key::CTRL);
	}
	// Set settings to the desired preset values.
	if (set_preset) {
		EditorSettings::get_singleton()->set_manually("editors/3d/navigation/orbit_mouse_button", (int)set_orbit_mouse_button);
		EditorSettings::get_singleton()->set_manually("editors/3d/navigation/pan_mouse_button", (int)set_pan_mouse_button);
		EditorSettings::get_singleton()->set_manually("editors/3d/navigation/zoom_mouse_button", (int)set_zoom_mouse_button);
		_set_shortcut_input("spatial_editor/viewport_orbit_modifier_1", orbit_mod_key_1);
		_set_shortcut_input("spatial_editor/viewport_orbit_modifier_2", orbit_mod_key_2);
		_set_shortcut_input("spatial_editor/viewport_pan_modifier_1", pan_mod_key_1);
		_set_shortcut_input("spatial_editor/viewport_pan_modifier_2", pan_mod_key_2);
		_set_shortcut_input("spatial_editor/viewport_zoom_modifier_1", zoom_mod_key_1);
		_set_shortcut_input("spatial_editor/viewport_zoom_modifier_2", zoom_mod_key_2);
	}
}

void EditorSettingsDialog::_set_shortcut_input(const String &p_name, Ref<InputEventKey> &p_event) {
	Array sc_events;
	if (p_event->get_keycode() != Key::NONE) {
		sc_events.push_back((Variant)p_event);
	}

	Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_name);
	sc->set_events(sc_events);