editor: added depth of field refocus hotkey

This commit is contained in:
Turánszki János
2023-07-06 09:40:49 +02:00
parent 9d661fa5df
commit b3378751e3
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -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) {
+10
View File
@@ -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)
{