diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp index d91bfe49c..e9e56a801 100644 --- a/Editor/CameraWindow.cpp +++ b/Editor/CameraWindow.cpp @@ -108,7 +108,7 @@ void CameraWindow::Create(EditorComponent* _editor) AddWidget(&fovSlider); focalLengthSlider.Create(0.001f, 100, 1, 10000, "Focal Length: "); - focalLengthSlider.SetTooltip("Controls the depth of field effect's focus distance"); + focalLengthSlider.SetTooltip("Controls the depth of field effect's focus distance.\nYou can also refocus by holding the C key and picking in the scene with the left mouse button."); focalLengthSlider.SetSize(XMFLOAT2(wid, hei)); focalLengthSlider.SetPos(XMFLOAT2(x, y += step)); focalLengthSlider.OnSlide([&](wi::gui::EventArgs args) { diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 192a1872b..0462ce20b 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -446,6 +446,7 @@ void EditorComponent::Load() ss += "Rotate Toggle: 2\n"; ss += "Scale Toggle: 3\n"; ss += "Wireframe mode: Ctrl + W\n"; + ss += "Depth of field refocus to point: C + left mouse button\n"; ss += "Color grading reference: Ctrl + G (color grading palette reference will be displayed in top left corner)\n"; ss += "Focus on selected: F button, this will make the camera jump to selection.\n"; ss += "Inspector mode: I button (hold), hovered entity information will be displayed near mouse position.\n"; @@ -1082,6 +1083,15 @@ void EditorComponent::Update(float dt) } } + if (hovered.entity != INVALID_ENTITY && + wi::input::Down((wi::input::BUTTON)'C') && + wi::input::Down(wi::input::MOUSE_BUTTON_LEFT)) + { + camera.focal_length = hovered.distance; + camera.SetDirty(); + optionsWnd.cameraWnd.focalLengthSlider.SetValue(camera.focal_length); + } + // Interactions only when paint tool is disabled: if (optionsWnd.paintToolWnd.GetMode() == PaintToolWindow::MODE_DISABLED) {