diff --git a/Editor/AnimationWindow.cpp b/Editor/AnimationWindow.cpp index dad5f38e2..258c0ae0b 100644 --- a/Editor/AnimationWindow.cpp +++ b/Editor/AnimationWindow.cpp @@ -9,7 +9,7 @@ void AnimationWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_ANIMATION " Animation", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(520, 400)); + SetSize(XMFLOAT2(520, 410)); closeButton.SetTooltip("Delete Animation"); OnClose([=](wi::gui::EventArgs args) { @@ -777,6 +777,58 @@ void AnimationWindow::ResizeLayout() { wi::gui::Window::ResizeLayout(); const float padding = 4; - const float width = GetWidgetAreaSize().x - padding * 2; - keyframesList.SetSize(XMFLOAT2(width, keyframesList.GetSize().y)); + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 80; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(modeComboBox); + + loopedCheckBox.SetPos(XMFLOAT2(margin_left, y)); + const float l = loopedCheckBox.GetPos().x + loopedCheckBox.GetSize().x + padding; + const float r = width - margin_right - padding; + const float diff = r - l; + playButton.SetSize(XMFLOAT2(diff * 0.5f, playButton.GetSize().y)); + stopButton.SetSize(playButton.GetSize()); + playButton.SetPos(XMFLOAT2(loopedCheckBox.GetPos().x + loopedCheckBox.GetSize().x + padding, y)); + stopButton.SetPos(XMFLOAT2(playButton.GetPos().x + playButton.GetSize().x + padding, y)); + y += stopButton.GetSize().y; + y += padding; + + add(timerSlider); + add(amountSlider); + add(speedSlider); + add(startInput); + add(endInput); + add(recordCombo); + add_fullwidth(keyframesList); } diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp index d607393ac..96b15a9db 100644 --- a/Editor/CameraWindow.cpp +++ b/Editor/CameraWindow.cpp @@ -217,7 +217,10 @@ void CameraWindow::Create(EditorComponent* _editor) fpsCheckBox.SetSize(XMFLOAT2(hei, hei)); fpsCheckBox.SetPos(XMFLOAT2(x, y += step)); fpsCheckBox.SetCheck(true); - fpsCheckBox.SetCheck(editor->main->config.GetSection("camera").GetBool("fps")); + if (editor->main->config.GetSection("camera").Has("fps")) + { + fpsCheckBox.SetCheck(editor->main->config.GetSection("camera").GetBool("fps")); + } fpsCheckBox.OnClick([&](wi::gui::EventArgs args) { editor->main->config.GetSection("camera").Set("fps", args.bValue); editor->main->config.Commit(); diff --git a/Editor/ColliderWindow.cpp b/Editor/ColliderWindow.cpp index c1ca6dd3f..f701415d7 100644 --- a/Editor/ColliderWindow.cpp +++ b/Editor/ColliderWindow.cpp @@ -10,7 +10,7 @@ void ColliderWindow::Create(EditorComponent* _editor) editor = _editor; wi::gui::Window::Create(ICON_COLLIDER " Collider", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(670, 260)); + SetSize(XMFLOAT2(670, 280)); closeButton.SetTooltip("Delete ColliderComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -154,7 +154,6 @@ void ColliderWindow::Create(EditorComponent* _editor) SetEntity(INVALID_ENTITY); } - void ColliderWindow::SetEntity(Entity entity) { if (this->entity == entity) @@ -178,3 +177,57 @@ void ColliderWindow::SetEntity(Entity entity) tailZ.SetValue(collider->tail.z); } } + +void ColliderWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 80; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(shapeCombo); + add(radiusSlider); + + y += jump; + + add(offsetX); + add(offsetY); + add(offsetZ); + + y += jump; + + add(tailX); + add(tailY); + add(tailZ); + +} diff --git a/Editor/ColliderWindow.h b/Editor/ColliderWindow.h index c04f79da2..ec2993ad4 100644 --- a/Editor/ColliderWindow.h +++ b/Editor/ColliderWindow.h @@ -20,5 +20,7 @@ public: wi::gui::Slider tailX; wi::gui::Slider tailY; wi::gui::Slider tailZ; + + void ResizeLayout() override; }; diff --git a/Editor/ComponentsWindow.cpp b/Editor/ComponentsWindow.cpp index 7f1dee075..94acb8da0 100644 --- a/Editor/ComponentsWindow.cpp +++ b/Editor/ComponentsWindow.cpp @@ -52,7 +52,7 @@ void ComponentsWindow::Create(EditorComponent* _editor) newComponentCombo.AddItem("Light " ICON_POINTLIGHT, 3); newComponentCombo.AddItem("Matetial " ICON_MATERIAL, 4); newComponentCombo.AddItem("Spring", 5); - newComponentCombo.AddItem("Inverse Kinematics", 6); + newComponentCombo.AddItem("Inverse Kinematics " ICON_IK, 6); newComponentCombo.AddItem("Sound " ICON_SOUND, 7); newComponentCombo.AddItem("Environment Probe " ICON_ENVIRONMENTPROBE, 8); newComponentCombo.AddItem("Emitted Particle System " ICON_EMITTER, 9); diff --git a/Editor/DecalWindow.cpp b/Editor/DecalWindow.cpp index 010392046..2db83dfb0 100644 --- a/Editor/DecalWindow.cpp +++ b/Editor/DecalWindow.cpp @@ -10,7 +10,7 @@ void DecalWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_DECAL " Decal", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(300, 150)); + SetSize(XMFLOAT2(300, 180)); closeButton.SetTooltip("Delete DecalComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -41,7 +41,7 @@ void DecalWindow::Create(EditorComponent* _editor) y += step; infoLabel.Create(""); - infoLabel.SetText("Selecting decals will select the according material. Set decal properties (texture, color, etc.) in the Material window."); + infoLabel.SetText("Set decal properties (texture, color, etc.) in the Material window."); infoLabel.SetSize(XMFLOAT2(300, 100)); infoLabel.SetPos(XMFLOAT2(10, y)); infoLabel.SetColor(wi::Color::Transparent()); @@ -70,3 +70,45 @@ void DecalWindow::SetEntity(Entity entity) SetEnabled(false); } } + +void DecalWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 80; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(infoLabel); + add_right(placementCheckBox); + +} diff --git a/Editor/DecalWindow.h b/Editor/DecalWindow.h index e952db109..aee5371b5 100644 --- a/Editor/DecalWindow.h +++ b/Editor/DecalWindow.h @@ -14,5 +14,7 @@ public: wi::gui::CheckBox placementCheckBox; wi::gui::Label infoLabel; + + void ResizeLayout() override; }; diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 375f068e5..75ca0ea1a 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -190,30 +190,9 @@ void EditorComponent::ResizeLayout() componentsWnd.SetPos(XMFLOAT2(screenW - componentsWnd.GetScale().x, screenH - componentsWnd.GetScale().y)); - //////////////////////////////////////////////////////////////////////////////////// - - float hei = 25; - - saveButton.SetPos(XMFLOAT2(screenW - 40 - 44 - 44 - 104 * 3, 0)); - saveButton.SetSize(XMFLOAT2(100, hei)); - - openButton.SetPos(XMFLOAT2(screenW - 40 - 44 - 44 - 104 * 2, 0)); - openButton.SetSize(XMFLOAT2(100, hei)); - - closeButton.SetPos(XMFLOAT2(screenW - 40 - 44 - 44 - 104 * 1, 0)); - closeButton.SetSize(XMFLOAT2(100, hei)); - - logButton.SetPos(XMFLOAT2(screenW - 40 - 44 - 44, 0)); - logButton.SetSize(XMFLOAT2(40, hei)); - - aboutButton.SetPos(XMFLOAT2(screenW - 40 - 44, 0)); - aboutButton.SetSize(XMFLOAT2(40, hei)); - aboutLabel.SetSize(XMFLOAT2(screenW / 2.0f, screenH / 1.5f)); aboutLabel.SetPos(XMFLOAT2(screenW / 2.0f - aboutLabel.scale.x / 2.0f, screenH / 2.0f - aboutLabel.scale.y / 2.0f)); - exitButton.SetPos(XMFLOAT2(screenW - 40, 0)); - exitButton.SetSize(XMFLOAT2(40, hei)); } void EditorComponent::Load() { @@ -223,7 +202,7 @@ void EditorComponent::Load() wi::font::AddFontStyle("FontAwesomeV6", font_awesome_v6, sizeof(font_awesome_v6)); - saveButton.Create(ICON_SAVE " Save"); + saveButton.Create(""); saveButton.font.params.shadowColor = wi::Color::Transparent(); saveButton.SetShadowRadius(2); saveButton.SetTooltip("Save the current scene to a new file (Ctrl + Shift + S)"); @@ -235,7 +214,7 @@ void EditorComponent::Load() GetGUI().AddWidget(&saveButton); - openButton.Create(ICON_OPEN " Open"); + openButton.Create(""); openButton.SetShadowRadius(2); openButton.font.params.shadowColor = wi::Color::Transparent(); openButton.SetTooltip("Open a scene, import a model or execute a Lua script..."); @@ -330,7 +309,7 @@ void EditorComponent::Load() GetGUI().AddWidget(&openButton); - closeButton.Create(ICON_CLOSE " Close"); + closeButton.Create(""); closeButton.SetShadowRadius(2); closeButton.font.params.shadowColor = wi::Color::Transparent(); closeButton.SetTooltip("Close the current scene.\nThis will clear everything from the currently selected scene, and delete the scene.\nThis operation cannot be undone!"); @@ -383,7 +362,7 @@ void EditorComponent::Load() GetGUI().AddWidget(&closeButton); - logButton.Create(ICON_BACKLOG); + logButton.Create(""); logButton.SetShadowRadius(2); logButton.font.params.shadowColor = wi::Color::Transparent(); logButton.SetTooltip("Open the backlog (toggle with HOME button)"); @@ -395,7 +374,7 @@ void EditorComponent::Load() GetGUI().AddWidget(&logButton); - aboutButton.Create(ICON_HELP); + aboutButton.Create(""); aboutButton.SetShadowRadius(2); aboutButton.font.params.shadowColor = wi::Color::Transparent(); aboutButton.SetTooltip("About..."); @@ -460,7 +439,7 @@ void EditorComponent::Load() GetGUI().AddWidget(&aboutLabel); } - exitButton.Create(ICON_EXIT); + exitButton.Create(""); exitButton.SetShadowRadius(2); exitButton.font.params.shadowColor = wi::Color::Transparent(); exitButton.SetTooltip("Exit"); @@ -545,6 +524,7 @@ void EditorComponent::Update(float dt) selectionOutlineTimer += dt; CheckBonePickingEnabled(); + UpdateTopMenuAnimation(); bool clear_selected = false; if (wi::input::Press(wi::input::KEYBOARD_BUTTON_ESCAPE)) @@ -568,7 +548,6 @@ void EditorComponent::Update(float dt) } translator.interactable = false; - bool deleting = false; // Camera control: if (!wi::backlog::isActive() && !GetGUI().HasFocus()) @@ -1274,6 +1253,7 @@ void EditorComponent::Update(float dt) // Delete if (deleting) { + deleting = false; wi::Archive& archive = AdvanceHistory(); archive << HISTORYOP_DELETE; RecordSelection(archive); @@ -2714,3 +2694,34 @@ void EditorComponent::CheckBonePickingEnabled() } } +void EditorComponent::UpdateTopMenuAnimation() +{ + float screenW = GetLogicalWidth(); + float screenH = GetLogicalHeight(); + float hei = 25; + float wid_idle = 40; + float wid_focus = wid_idle * 2.5f; + float padding = 4; + float lerp = 0.3f; + + exitButton.SetText(exitButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? ICON_EXIT " Exit" : ICON_EXIT); + aboutButton.SetText(aboutButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? ICON_HELP " About" : ICON_HELP); + logButton.SetText(logButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? ICON_BACKLOG " Backlog" : ICON_BACKLOG); + closeButton.SetText(closeButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? ICON_CLOSE " Close" : ICON_CLOSE); + openButton.SetText(openButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? ICON_OPEN " Open" : ICON_OPEN); + saveButton.SetText(saveButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? ICON_SAVE " Save" : ICON_SAVE); + + exitButton.SetSize(XMFLOAT2(wi::math::Lerp(exitButton.GetSize().x, exitButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? wid_focus : wid_idle, lerp), hei)); + aboutButton.SetSize(XMFLOAT2(wi::math::Lerp(aboutButton.GetSize().x, aboutButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? wid_focus : wid_idle, lerp), hei)); + logButton.SetSize(XMFLOAT2(wi::math::Lerp(logButton.GetSize().x, logButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? wid_focus : wid_idle, lerp), hei)); + closeButton.SetSize(XMFLOAT2(wi::math::Lerp(closeButton.GetSize().x, closeButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? wid_focus : wid_idle, lerp), hei)); + openButton.SetSize(XMFLOAT2(wi::math::Lerp(openButton.GetSize().x, openButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? wid_focus : wid_idle, lerp), hei)); + saveButton.SetSize(XMFLOAT2(wi::math::Lerp(saveButton.GetSize().x, saveButton.GetState() > wi::gui::WIDGETSTATE::IDLE ? wid_focus : wid_idle, lerp), hei)); + + exitButton.SetPos(XMFLOAT2(screenW - exitButton.GetSize().x, 0)); + aboutButton.SetPos(XMFLOAT2(exitButton.GetPos().x - aboutButton.GetSize().x - padding, 0)); + logButton.SetPos(XMFLOAT2(aboutButton.GetPos().x - logButton.GetSize().x - padding, 0)); + closeButton.SetPos(XMFLOAT2(logButton.GetPos().x - closeButton.GetSize().x - padding, 0)); + openButton.SetPos(XMFLOAT2(closeButton.GetPos().x - openButton.GetSize().x - padding, 0)); + saveButton.SetPos(XMFLOAT2(openButton.GetPos().x - saveButton.GetSize().x - padding, 0)); +} diff --git a/Editor/Editor.h b/Editor/Editor.h index 990074974..49fc2a5ee 100644 --- a/Editor/Editor.h +++ b/Editor/Editor.h @@ -83,6 +83,8 @@ public: bool bone_picking = false; void CheckBonePickingEnabled(); + void UpdateTopMenuAnimation(); + wi::Archive clipboard; enum HistoryOperationType @@ -106,6 +108,7 @@ public: void Save(const std::string& filename); void SaveAs(); + bool deleting = false; struct EditorScene { diff --git a/Editor/EmitterWindow.cpp b/Editor/EmitterWindow.cpp index 644b0e15b..f426253eb 100644 --- a/Editor/EmitterWindow.cpp +++ b/Editor/EmitterWindow.cpp @@ -11,7 +11,7 @@ void EmitterWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_EMITTER " Emitter", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(300, 900)); + SetSize(XMFLOAT2(300, 940)); closeButton.SetTooltip("Delete EmittedParticleSystem"); OnClose([=](wi::gui::EventArgs args) { @@ -221,7 +221,7 @@ void EmitterWindow::Create(EditorComponent* _editor) framesXInput.SetSize(XMFLOAT2(38, 18)); framesXInput.SetText(""); framesXInput.SetTooltip("How many horizontal frames there are in the spritesheet."); - framesXInput.SetDescription("Frames X: "); + framesXInput.SetDescription("Frames: "); framesXInput.OnInputAccepted([this](wi::gui::EventArgs args) { auto emitter = GetEmitter(); if (emitter != nullptr) @@ -236,7 +236,6 @@ void EmitterWindow::Create(EditorComponent* _editor) framesYInput.SetSize(XMFLOAT2(38, 18)); framesYInput.SetText(""); framesYInput.SetTooltip("How many vertical frames there are in the spritesheet."); - framesYInput.SetDescription("Frames Y: "); framesYInput.OnInputAccepted([this](wi::gui::EventArgs args) { auto emitter = GetEmitter(); if (emitter != nullptr) @@ -766,3 +765,111 @@ void EmitterWindow::UpdateData() infoLabel.SetText(ss); } + +void EmitterWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 130; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(infoLabel); + add_fullwidth(restartButton); + add(meshComboBox); + add(shaderTypeComboBox); + add_right(sortCheckBox); + add_right(depthCollisionsCheckBox); + add_right(sphCheckBox); + add_right(pauseCheckBox); + add_right(debugCheckBox); + add_right(volumeCheckBox); + add_right(frameBlendingCheckBox); + add(maxParticlesSlider); + add(emitCountSlider); + add(emitSizeSlider); + add(emitRotationSlider); + add(emitNormalSlider); + add(emitScalingSlider); + add(emitLifeSlider); + add(emitLifeRandomnessSlider); + add(emitRandomnessSlider); + add(emitColorRandomnessSlider); + add(emitMotionBlurSlider); + add(emitMassSlider); + add(timestepSlider); + add(dragSlider); + add(restitutionSlider); + + const float l = margin_left; + const float r = width - margin_right; + float w = ((r - l) - padding * 2) / 3.0f; + VelocityXInput.SetSize(XMFLOAT2(w, VelocityXInput.GetSize().y)); + VelocityYInput.SetSize(XMFLOAT2(w, VelocityYInput.GetSize().y)); + VelocityZInput.SetSize(XMFLOAT2(w, VelocityZInput.GetSize().y)); + GravityXInput.SetSize(XMFLOAT2(w, GravityXInput.GetSize().y)); + GravityYInput.SetSize(XMFLOAT2(w, GravityYInput.GetSize().y)); + GravityZInput.SetSize(XMFLOAT2(w, GravityZInput.GetSize().y)); + + VelocityXInput.SetPos(XMFLOAT2(margin_left, y)); + VelocityYInput.SetPos(XMFLOAT2(VelocityXInput.GetPos().x + w + padding, y)); + VelocityZInput.SetPos(XMFLOAT2(VelocityYInput.GetPos().x + w + padding, y)); + + y += VelocityZInput.GetSize().y; + y += padding; + + GravityXInput.SetPos(XMFLOAT2(margin_left, y)); + GravityYInput.SetPos(XMFLOAT2(GravityXInput.GetPos().x + w + padding, y)); + GravityZInput.SetPos(XMFLOAT2(GravityYInput.GetPos().x + w + padding, y)); + + y += GravityZInput.GetSize().y; + y += padding; + + add(frameRateInput); + + w = ((r - l) - padding) / 2.0f; + framesXInput.SetSize(XMFLOAT2(w, framesXInput.GetSize().y)); + framesYInput.SetSize(XMFLOAT2(w, framesYInput.GetSize().y)); + framesXInput.SetPos(XMFLOAT2(margin_left, y)); + framesYInput.SetPos(XMFLOAT2(framesXInput.GetPos().x + w + padding, y)); + + y += framesYInput.GetSize().y; + y += padding; + + add(frameCountInput); + add(frameStartInput); + + add(sph_h_Slider); + add(sph_K_Slider); + add(sph_p0_Slider); + add(sph_e_Slider); +} diff --git a/Editor/EmitterWindow.h b/Editor/EmitterWindow.h index fb5282f8a..23caf1441 100644 --- a/Editor/EmitterWindow.h +++ b/Editor/EmitterWindow.h @@ -62,5 +62,6 @@ public: wi::gui::TextInputField frameCountInput; wi::gui::TextInputField frameStartInput; + void ResizeLayout() override; }; diff --git a/Editor/EnvProbeWindow.cpp b/Editor/EnvProbeWindow.cpp index 47c692656..c0da4e32d 100644 --- a/Editor/EnvProbeWindow.cpp +++ b/Editor/EnvProbeWindow.cpp @@ -9,7 +9,7 @@ void EnvProbeWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_ENVIRONMENTPROBE " Environment Probe", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(420, 220)); + SetSize(XMFLOAT2(420, 230)); closeButton.SetTooltip("Delete EnvironmentProbeComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -122,3 +122,55 @@ void EnvProbeWindow::SetEntity(Entity entity) } } + +void EnvProbeWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 80; + const float margin_right = padding; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(infoLabel); + + refreshButton.SetSize(XMFLOAT2(width * 0.5f - padding * 1.5f, refreshButton.GetSize().y)); + refreshAllButton.SetSize(refreshButton.GetSize()); + refreshAllButton.SetPos(XMFLOAT2(width - padding - refreshButton.GetSize().x, y)); + refreshButton.SetPos(XMFLOAT2(refreshAllButton.GetPos().x - padding - refreshButton.GetSize().x, y)); + y += refreshAllButton.GetSize().y; + y += padding; + + add_right(realTimeCheckBox); + add_right(msaaCheckBox); + + +} diff --git a/Editor/EnvProbeWindow.h b/Editor/EnvProbeWindow.h index 8d288c5e5..287f55e18 100644 --- a/Editor/EnvProbeWindow.h +++ b/Editor/EnvProbeWindow.h @@ -17,5 +17,7 @@ public: wi::gui::CheckBox msaaCheckBox; wi::gui::Button refreshButton; wi::gui::Button refreshAllButton; + + void ResizeLayout() override; }; diff --git a/Editor/ForceFieldWindow.cpp b/Editor/ForceFieldWindow.cpp index 8c2856ebd..3e210d3ae 100644 --- a/Editor/ForceFieldWindow.cpp +++ b/Editor/ForceFieldWindow.cpp @@ -120,3 +120,47 @@ void ForceFieldWindow::SetEntity(Entity entity) } } + +void ForceFieldWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 70; + const float margin_right = 50; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(typeComboBox); + add(gravitySlider); + add(rangeSlider); + + +} diff --git a/Editor/ForceFieldWindow.h b/Editor/ForceFieldWindow.h index 0be55fec4..dfefef8b4 100644 --- a/Editor/ForceFieldWindow.h +++ b/Editor/ForceFieldWindow.h @@ -15,5 +15,7 @@ public: wi::gui::ComboBox typeComboBox; wi::gui::Slider gravitySlider; wi::gui::Slider rangeSlider; + + void ResizeLayout() override; }; diff --git a/Editor/GraphicsWindow.cpp b/Editor/GraphicsWindow.cpp index c6d62e152..951e0a114 100644 --- a/Editor/GraphicsWindow.cpp +++ b/Editor/GraphicsWindow.cpp @@ -1324,9 +1324,15 @@ void GraphicsWindow::Create(EditorComponent* _editor) gridHelperCheckBox.SetTooltip("Toggle showing of unit visualizer grid in the world origin"); gridHelperCheckBox.SetPos(XMFLOAT2(x, y += step)); gridHelperCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - gridHelperCheckBox.OnClick([](wi::gui::EventArgs args) { + if (editor->main->config.GetSection("graphics").Has("grid_helper")) + { + wi::renderer::SetToDrawGridHelper(editor->main->config.GetSection("graphics").GetBool("grid_helper")); + } + gridHelperCheckBox.OnClick([=](wi::gui::EventArgs args) { wi::renderer::SetToDrawGridHelper(args.bValue); - }); + editor->main->config.GetSection("graphics").Set("grid_helper", args.bValue); + editor->main->config.Commit(); + }); gridHelperCheckBox.SetCheck(wi::renderer::GetToDrawGridHelper()); AddWidget(&gridHelperCheckBox); diff --git a/Editor/HairParticleWindow.cpp b/Editor/HairParticleWindow.cpp index 09dae9eb2..37a1d9614 100644 --- a/Editor/HairParticleWindow.cpp +++ b/Editor/HairParticleWindow.cpp @@ -109,19 +109,19 @@ void HairParticleWindow::Create(EditorComponent* _editor) randomnessSlider.SetTooltip("Set hair length randomization factor. This will affect randomness of hair lengths."); AddWidget(&randomnessSlider); - segmentcountSlider.Create(1, 10, 1, 9, "Segment Count: "); - segmentcountSlider.SetSize(XMFLOAT2(wid, hei)); - segmentcountSlider.SetPos(XMFLOAT2(x, y += step)); - segmentcountSlider.OnSlide([&](wi::gui::EventArgs args) { - auto hair = GetHair(); - if (hair != nullptr) - { - hair->segmentCount = (uint32_t)args.iValue; - } - }); - segmentcountSlider.SetEnabled(false); - segmentcountSlider.SetTooltip("Set hair strand segment count. This will affect simulation quality and performance."); - AddWidget(&segmentcountSlider); + //segmentcountSlider.Create(1, 10, 1, 9, "Segment Count: "); + //segmentcountSlider.SetSize(XMFLOAT2(wid, hei)); + //segmentcountSlider.SetPos(XMFLOAT2(x, y += step)); + //segmentcountSlider.OnSlide([&](wi::gui::EventArgs args) { + // auto hair = GetHair(); + // if (hair != nullptr) + // { + // hair->segmentCount = (uint32_t)args.iValue; + // } + //}); + //segmentcountSlider.SetEnabled(false); + //segmentcountSlider.SetTooltip("Set hair strand segment count. This will affect simulation quality and performance."); + //AddWidget(&segmentcountSlider); randomSeedSlider.Create(1, 12345, 1, 12344, "Random seed: "); randomSeedSlider.SetSize(XMFLOAT2(wid, hei)); @@ -156,7 +156,7 @@ void HairParticleWindow::Create(EditorComponent* _editor) framesXInput.SetSize(XMFLOAT2(40, hei)); framesXInput.SetText(""); framesXInput.SetTooltip("How many horizontal frames there are in the spritesheet."); - framesXInput.SetDescription("Frames X: "); + framesXInput.SetDescription("Frames: "); framesXInput.OnInputAccepted([this](wi::gui::EventArgs args) { auto hair = GetHair(); if (hair != nullptr) @@ -171,7 +171,6 @@ void HairParticleWindow::Create(EditorComponent* _editor) framesYInput.SetSize(XMFLOAT2(40, hei)); framesYInput.SetText(""); framesYInput.SetTooltip("How many vertical frames there are in the spritesheet."); - framesYInput.SetDescription("Frames Y: "); framesYInput.OnInputAccepted([this](wi::gui::EventArgs args) { auto hair = GetHair(); if (hair != nullptr) @@ -234,7 +233,7 @@ void HairParticleWindow::SetEntity(Entity entity) stiffnessSlider.SetValue(hair->stiffness); randomnessSlider.SetValue(hair->randomness); countSlider.SetValue((float)hair->strandCount); - segmentcountSlider.SetValue((float)hair->segmentCount); + //segmentcountSlider.SetValue((float)hair->segmentCount); randomSeedSlider.SetValue((float)hair->randomSeed); viewDistanceSlider.SetValue(hair->viewDistance); framesXInput.SetValue((int)hair->framesX); @@ -288,3 +287,64 @@ void HairParticleWindow::UpdateData() } } } + +void HairParticleWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 100; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(meshComboBox); + add(lengthSlider); + add(stiffnessSlider); + add(randomnessSlider); + add(countSlider); + add(randomSeedSlider); + add(viewDistanceSlider); + + const float l = margin_left; + const float r = width - margin_right; + const float w = ((r - l) - padding) / 2.0f; + framesXInput.SetSize(XMFLOAT2(w, framesXInput.GetSize().y)); + framesYInput.SetSize(XMFLOAT2(w, framesYInput.GetSize().y)); + framesXInput.SetPos(XMFLOAT2(margin_left, y)); + framesYInput.SetPos(XMFLOAT2(framesXInput.GetPos().x + w + padding, y)); + + y += framesYInput.GetSize().y; + y += padding; + + add(frameCountInput); + add(frameStartInput); + +} diff --git a/Editor/HairParticleWindow.h b/Editor/HairParticleWindow.h index 4cce0445f..62e31fdcc 100644 --- a/Editor/HairParticleWindow.h +++ b/Editor/HairParticleWindow.h @@ -18,7 +18,7 @@ public: wi::HairParticleSystem* GetHair(); - wi::gui::ComboBox meshComboBox; + wi::gui::ComboBox meshComboBox; wi::gui::Slider lengthSlider; wi::gui::Slider stiffnessSlider; wi::gui::Slider randomnessSlider; @@ -31,5 +31,6 @@ public: wi::gui::TextInputField frameCountInput; wi::gui::TextInputField frameStartInput; + void ResizeLayout() override; }; diff --git a/Editor/IKWindow.cpp b/Editor/IKWindow.cpp index 23c10c531..3dea7f26e 100644 --- a/Editor/IKWindow.cpp +++ b/Editor/IKWindow.cpp @@ -10,7 +10,7 @@ void IKWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_IK " Inverse Kinematics", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(400, 110)); + SetSize(XMFLOAT2(400, 120)); closeButton.SetTooltip("Delete InverseKinematicsComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -122,3 +122,47 @@ void IKWindow::SetEntity(Entity entity) } } + +void IKWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 110; + const float margin_right = 30; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(targetCombo); + add_right(disabledCheckBox); + add(chainLengthSlider); + add(iterationCountSlider); + +} diff --git a/Editor/IKWindow.h b/Editor/IKWindow.h index 1edcc8c3c..f58eb7b18 100644 --- a/Editor/IKWindow.h +++ b/Editor/IKWindow.h @@ -16,5 +16,7 @@ public: wi::gui::CheckBox disabledCheckBox; wi::gui::Slider chainLengthSlider; wi::gui::Slider iterationCountSlider; + + void ResizeLayout() override; }; diff --git a/Editor/LayerWindow.cpp b/Editor/LayerWindow.cpp index fc8b75111..52c7317b5 100644 --- a/Editor/LayerWindow.cpp +++ b/Editor/LayerWindow.cpp @@ -68,7 +68,7 @@ void LayerWindow::Create(EditorComponent* _editor) y += step * 7; - enableAllButton.Create("Enable ALL"); + enableAllButton.Create("ALL " ICON_CHECK); enableAllButton.SetPos(XMFLOAT2(x, y)); enableAllButton.OnClick([this](wi::gui::EventArgs args) { LayerComponent* layer = editor->GetCurrentScene().layers.GetComponent(entity); @@ -82,7 +82,7 @@ void LayerWindow::Create(EditorComponent* _editor) }); AddWidget(&enableAllButton); - enableNoneButton.Create("Enable NONE"); + enableNoneButton.Create("NONE " ICON_DISABLED); enableNoneButton.SetPos(XMFLOAT2(x + 120, y)); enableNoneButton.OnClick([this](wi::gui::EventArgs args) { LayerComponent* layer = editor->GetCurrentScene().layers.GetComponent(entity); @@ -143,3 +143,63 @@ void LayerWindow::SetEntity(Entity entity) SetEnabled(false); } } + +void LayerWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 80; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(label); + enableAllButton.SetSize(XMFLOAT2(width * 0.5f - padding * 1.5f, enableAllButton.GetSize().y)); + enableNoneButton.SetSize(enableAllButton.GetSize()); + enableNoneButton.SetPos(XMFLOAT2(width - padding - enableNoneButton.GetSize().x, y)); + enableAllButton.SetPos(XMFLOAT2(enableNoneButton.GetPos().x - padding - enableAllButton.GetSize().x, y)); + y += enableNoneButton.GetSize().y; + y += padding; + + float off_x = padding; + for (uint32_t i = 0; i < arraysize(layers); ++i) + { + layers[i].SetPos(XMFLOAT2(off_x, y)); + off_x += 50; + if (off_x + layers[i].GetSize().x > width - padding) + { + off_x = padding; + y += layers[i].GetSize().y; + y += padding; + } + } + +} diff --git a/Editor/LayerWindow.h b/Editor/LayerWindow.h index 7a1ce0079..31489be3b 100644 --- a/Editor/LayerWindow.h +++ b/Editor/LayerWindow.h @@ -16,5 +16,7 @@ public: wi::gui::CheckBox layers[32]; wi::gui::Button enableAllButton; wi::gui::Button enableNoneButton; + + void ResizeLayout() override; }; diff --git a/Editor/LightWindow.cpp b/Editor/LightWindow.cpp index 86d93cbbd..36fb80fcc 100644 --- a/Editor/LightWindow.cpp +++ b/Editor/LightWindow.cpp @@ -368,7 +368,7 @@ void LightWindow::ResizeLayout() auto add_right = [&](wi::gui::Widget& widget) { if (!widget.IsVisible()) return; - const float margin_right = 45; + const float margin_right = 40; widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); y += widget.GetSize().y; y += padding; diff --git a/Editor/MaterialWindow.cpp b/Editor/MaterialWindow.cpp index f9b577999..fc0877a9f 100644 --- a/Editor/MaterialWindow.cpp +++ b/Editor/MaterialWindow.cpp @@ -862,7 +862,7 @@ void MaterialWindow::ResizeLayout() auto add_right = [&](wi::gui::Widget& widget) { if (!widget.IsVisible()) return; - const float margin_right = 45; + const float margin_right = 40; widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); y += widget.GetSize().y; y += padding; diff --git a/Editor/MeshWindow.cpp b/Editor/MeshWindow.cpp index 577927d83..a21b4e548 100644 --- a/Editor/MeshWindow.cpp +++ b/Editor/MeshWindow.cpp @@ -15,7 +15,7 @@ void MeshWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_MESH " Mesh", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(580, 650)); + SetSize(XMFLOAT2(580, 700)); closeButton.SetTooltip("Delete MeshComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -719,3 +719,66 @@ void MeshWindow::SetEntity(Entity entity, int subset) mergeButton.SetEnabled(true); } + +void MeshWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 100; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(meshInfoLabel); + add(subsetComboBox); + add(subsetMaterialComboBox); + add_right(doubleSidedCheckBox); + add_fullwidth(impostorCreateButton); + add(impostorDistanceSlider); + add(tessellationFactorSlider); + add_fullwidth(flipCullingButton); + add_fullwidth(flipNormalsButton); + add_fullwidth(computeNormalsSmoothButton); + add_fullwidth(computeNormalsHardButton); + add_fullwidth(recenterButton); + add_fullwidth(recenterToBottomButton); + add_fullwidth(mergeButton); + add_fullwidth(optimizeButton); + + add(morphTargetCombo); + add(morphTargetSlider); + + add_fullwidth(lodgenButton); + add(lodCountSlider); + add(lodQualitySlider); + add(lodErrorSlider); + add_right(lodSloppyCheckBox); +} diff --git a/Editor/MeshWindow.h b/Editor/MeshWindow.h index 2a4e44241..25d671724 100644 --- a/Editor/MeshWindow.h +++ b/Editor/MeshWindow.h @@ -37,5 +37,7 @@ public: wi::gui::Slider lodQualitySlider; wi::gui::Slider lodErrorSlider; wi::gui::CheckBox lodSloppyCheckBox; + + void ResizeLayout() override; }; diff --git a/Editor/ObjectWindow.cpp b/Editor/ObjectWindow.cpp index b05fabe9b..0bfa5669c 100644 --- a/Editor/ObjectWindow.cpp +++ b/Editor/ObjectWindow.cpp @@ -261,7 +261,7 @@ void ObjectWindow::Create(EditorComponent* _editor) editor = _editor; wi::gui::Window::Create(ICON_OBJECT " Object", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(670, 860)); + SetSize(XMFLOAT2(670, 600)); closeButton.SetTooltip("Delete ObjectComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -581,3 +581,56 @@ void ObjectWindow::SetEntity(Entity entity) } + + +void ObjectWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 140; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_right(renderableCheckBox); + add_right(shadowCheckBox); + add(ditherSlider); + add(cascadeMaskSlider); + add(lodSlider); + add(colorComboBox); + add_fullwidth(colorPicker); + add(lightmapResolutionSlider); + add(lightmapSourceUVSetComboBox); + add(generateLightmapButton); + add(stopLightmapGenButton); + add(clearLightmapButton); + +} diff --git a/Editor/ObjectWindow.h b/Editor/ObjectWindow.h index 1a32b8ed3..f146e437b 100644 --- a/Editor/ObjectWindow.h +++ b/Editor/ObjectWindow.h @@ -26,5 +26,7 @@ public: wi::gui::Button generateLightmapButton; wi::gui::Button stopLightmapGenButton; wi::gui::Button clearLightmapButton; + + void ResizeLayout() override; }; diff --git a/Editor/OptionsWindow.cpp b/Editor/OptionsWindow.cpp index b2aea5147..e06920a80 100644 --- a/Editor/OptionsWindow.cpp +++ b/Editor/OptionsWindow.cpp @@ -344,6 +344,11 @@ void OptionsWindow::Create(EditorComponent* _editor) editor->RecordSelection(archive); }); + entityTree.OnDelete([=](wi::gui::EventArgs args) { + // Deletions will be performed in a batch next frame: + // We don't delete here, because this callback will execute once for each item + editor->deleting = true; + }); AddWidget(&entityTree); // Renderer and Postprocess windows are created in ChangeRenderPath(), because they deal with @@ -673,7 +678,7 @@ void OptionsWindow::Create(EditorComponent* _editor) AddWidget(&themeCombo); - SetSize(XMFLOAT2(340, 500)); + SetSize(XMFLOAT2(338, 500)); } void OptionsWindow::Update(float dt) { diff --git a/Editor/RigidBodyWindow.cpp b/Editor/RigidBodyWindow.cpp index 61938ccc9..2cabd0328 100644 --- a/Editor/RigidBodyWindow.cpp +++ b/Editor/RigidBodyWindow.cpp @@ -10,7 +10,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) editor = _editor; wi::gui::Window::Create(ICON_RIGIDBODY " Rigid Body Physics", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(670, 280)); + SetSize(XMFLOAT2(670, 300)); closeButton.SetTooltip("Delete RigidBodyPhysicsComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -250,7 +250,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) }); AddWidget(&angulardampingSlider); - physicsMeshLODSlider.Create(0, 6, 0, 6, "Physics Mesh LOD: "); + physicsMeshLODSlider.Create(0, 6, 0, 6, "Use Mesh LOD: "); physicsMeshLODSlider.SetTooltip("Specify which LOD to use for triangle mesh physics."); physicsMeshLODSlider.SetSize(XMFLOAT2(wid, hei)); physicsMeshLODSlider.SetPos(XMFLOAT2(x, y += step)); @@ -361,3 +361,56 @@ void RigidBodyWindow::SetEntity(Entity entity) } } + + +void RigidBodyWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 120; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(collisionShapeComboBox); + add(XSlider); + add(YSlider); + add(ZSlider); + add(massSlider); + add(frictionSlider); + add(restitutionSlider); + add(lineardampingSlider); + add(angulardampingSlider); + add(physicsMeshLODSlider); + add_right(disabledeactivationCheckBox); + add_right(kinematicCheckBox); + +} diff --git a/Editor/RigidBodyWindow.h b/Editor/RigidBodyWindow.h index e95952ff5..d223756ab 100644 --- a/Editor/RigidBodyWindow.h +++ b/Editor/RigidBodyWindow.h @@ -24,5 +24,7 @@ public: wi::gui::Slider physicsMeshLODSlider; wi::gui::CheckBox disabledeactivationCheckBox; wi::gui::CheckBox kinematicCheckBox; + + void ResizeLayout() override; }; diff --git a/Editor/SoftBodyWindow.cpp b/Editor/SoftBodyWindow.cpp index 69f620563..34c9b6563 100644 --- a/Editor/SoftBodyWindow.cpp +++ b/Editor/SoftBodyWindow.cpp @@ -9,7 +9,7 @@ void SoftBodyWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_SOFTBODY " Soft Body Physics", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(580, 120)); + SetSize(XMFLOAT2(580, 200)); closeButton.SetTooltip("Delete MeshComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -31,6 +31,11 @@ void SoftBodyWindow::Create(EditorComponent* _editor) float step = hei + 2; float wid = 170; + infoLabel.Create(""); + infoLabel.SetText("Soft body physics must be used together with a MeshComponent, otherwise it will have no effect.\nYou can use the Paint Tool to pin or soften soft body vertices."); + infoLabel.SetSize(XMFLOAT2(100, 90)); + AddWidget(&infoLabel); + massSlider.Create(0, 10, 1, 100000, "Mass: "); massSlider.SetTooltip("Set the mass amount for the physics engine."); massSlider.SetSize(XMFLOAT2(wid, hei)); @@ -81,7 +86,6 @@ void SoftBodyWindow::Create(EditorComponent* _editor) SetEntity(INVALID_ENTITY); } - void SoftBodyWindow::SetEntity(Entity entity) { this->entity = entity; @@ -96,3 +100,47 @@ void SoftBodyWindow::SetEntity(Entity entity) restitutionSlider.SetValue(physicscomponent->restitution); } } + +void SoftBodyWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 120; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(infoLabel); + add(massSlider); + add(frictionSlider); + add(restitutionSlider); + +} diff --git a/Editor/SoftBodyWindow.h b/Editor/SoftBodyWindow.h index 6beffc2b6..1af83c0a2 100644 --- a/Editor/SoftBodyWindow.h +++ b/Editor/SoftBodyWindow.h @@ -12,8 +12,11 @@ public: wi::ecs::Entity entity = wi::ecs::INVALID_ENTITY; void SetEntity(wi::ecs::Entity entity); + wi::gui::Label infoLabel; wi::gui::Slider massSlider; wi::gui::Slider frictionSlider; wi::gui::Slider restitutionSlider; + + void ResizeLayout() override; }; diff --git a/Editor/SoundWindow.cpp b/Editor/SoundWindow.cpp index f5dd2335f..965cea8f9 100644 --- a/Editor/SoundWindow.cpp +++ b/Editor/SoundWindow.cpp @@ -11,7 +11,7 @@ void SoundWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_SOUND " Sound", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(440, 220)); + SetSize(XMFLOAT2(440, 200)); closeButton.SetTooltip("Delete SoundComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -34,7 +34,7 @@ void SoundWindow::Create(EditorComponent* _editor) float wid = 200; - openButton.Create("Open File"); + openButton.Create("Open File " ICON_OPEN); openButton.SetPos(XMFLOAT2(x, y)); openButton.SetSize(XMFLOAT2(wid, hei)); openButton.OnClick([&](wi::gui::EventArgs args) { @@ -59,10 +59,9 @@ void SoundWindow::Create(EditorComponent* _editor) filenameLabel.Create("Filename"); filenameLabel.SetPos(XMFLOAT2(x, y += step)); filenameLabel.SetSize(XMFLOAT2(wid, hei)); - filenameLabel.font.params.h_align = wi::font::WIFALIGN_RIGHT; AddWidget(&filenameLabel); - playstopButton.Create("Play"); + playstopButton.Create(ICON_PLAY); playstopButton.SetTooltip("Play/Stop selected sound instance."); playstopButton.SetPos(XMFLOAT2(x, y += step)); playstopButton.SetSize(XMFLOAT2(wid, hei)); @@ -89,6 +88,7 @@ void SoundWindow::Create(EditorComponent* _editor) loopedCheckbox.SetTooltip("Enable looping for the selected sound instance."); loopedCheckbox.SetPos(XMFLOAT2(x, y += step)); loopedCheckbox.SetSize(XMFLOAT2(hei, hei)); + loopedCheckbox.SetCheckText(ICON_LOOP); loopedCheckbox.OnClick([&](wi::gui::EventArgs args) { SoundComponent* sound = editor->GetCurrentScene().sounds.GetComponent(entity); if (sound != nullptr) @@ -212,6 +212,8 @@ void SoundWindow::Create(EditorComponent* _editor) void SoundWindow::SetEntity(Entity entity) { + if (this->entity == entity) + return; this->entity = entity; Scene& scene = editor->GetCurrentScene(); @@ -220,7 +222,7 @@ void SoundWindow::SetEntity(Entity entity) if (sound != nullptr) { - filenameLabel.SetText(sound->filename); + filenameLabel.SetText(wi::helper::GetFileNameFromPath(sound->filename)); playstopButton.SetEnabled(true); loopedCheckbox.SetEnabled(true); loopedCheckbox.SetCheck(sound->IsLooped()); @@ -232,11 +234,11 @@ void SoundWindow::SetEntity(Entity entity) volumeSlider.SetValue(sound->volume); if (sound->IsPlaying()) { - playstopButton.SetText("Stop"); + playstopButton.SetText(ICON_STOP); } else { - playstopButton.SetText("Play"); + playstopButton.SetText(ICON_PLAY); } submixComboBox.SetEnabled(true); if (submixComboBox.GetSelected() != (int)sound->soundinstance.type) @@ -256,3 +258,52 @@ void SoundWindow::SetEntity(Entity entity) } } + +void SoundWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 80; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 40; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(openButton); + add(reverbComboBox); + add_fullwidth(filenameLabel); + add(playstopButton); + loopedCheckbox.SetPos(XMFLOAT2(playstopButton.GetPos().x - loopedCheckbox.GetSize().x - 2, playstopButton.GetPos().y)); + add_right(reverbCheckbox); + disable3dCheckbox.SetPos(XMFLOAT2(reverbCheckbox.GetPos().x - disable3dCheckbox.GetSize().x - 100 - 2, reverbCheckbox.GetPos().y)); + add(volumeSlider); + add(submixComboBox); +} + diff --git a/Editor/SoundWindow.h b/Editor/SoundWindow.h index 81557a37b..fe2bea8eb 100644 --- a/Editor/SoundWindow.h +++ b/Editor/SoundWindow.h @@ -21,4 +21,6 @@ public: wi::gui::CheckBox disable3dCheckbox; wi::gui::Slider volumeSlider; wi::gui::ComboBox submixComboBox; + + void ResizeLayout() override; }; diff --git a/Editor/SpringWindow.cpp b/Editor/SpringWindow.cpp index 3e0dcc14b..0e912a44c 100644 --- a/Editor/SpringWindow.cpp +++ b/Editor/SpringWindow.cpp @@ -10,7 +10,7 @@ void SpringWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create("Spring", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(460, 200)); + SetSize(XMFLOAT2(460, 220)); closeButton.SetTooltip("Delete SpringComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -136,3 +136,51 @@ void SpringWindow::SetEntity(Entity entity) debugCheckBox.SetEnabled(true); } + +void SpringWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + const float margin_left = 120; + const float margin_right = 40; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(resetAllButton); + add_right(debugCheckBox); + add_right(disabledCheckBox); + add_right(stretchCheckBox); + add_right(gravityCheckBox); + add(stiffnessSlider); + add(dragSlider); + add(windSlider); + +} diff --git a/Editor/SpringWindow.h b/Editor/SpringWindow.h index 62c82a429..2015e7470 100644 --- a/Editor/SpringWindow.h +++ b/Editor/SpringWindow.h @@ -20,5 +20,7 @@ public: wi::gui::Slider stiffnessSlider; wi::gui::Slider dragSlider; wi::gui::Slider windSlider; + + void ResizeLayout() override; }; diff --git a/Editor/TransformWindow.cpp b/Editor/TransformWindow.cpp index 310b66f14..63ae2646c 100644 --- a/Editor/TransformWindow.cpp +++ b/Editor/TransformWindow.cpp @@ -10,7 +10,7 @@ void TransformWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_TRANSFORM " Transform" , wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(480, 360)); + SetSize(XMFLOAT2(480, 260)); closeButton.SetTooltip("Delete TransformComponent\nNote that a lot of components won't work correctly without a TransformComponent!"); OnClose([=](wi::gui::EventArgs args) { @@ -56,7 +56,7 @@ void TransformWindow::Create(EditorComponent* _editor) txInput.Create(""); txInput.SetValue(0); - txInput.SetDescription("Position X: "); + txInput.SetDescription("Position: "); txInput.SetPos(XMFLOAT2(x, y += step)); txInput.SetSize(XMFLOAT2(siz, hei)); txInput.OnInputAccepted([&](wi::gui::EventArgs args) { @@ -71,7 +71,6 @@ void TransformWindow::Create(EditorComponent* _editor) tyInput.Create(""); tyInput.SetValue(0); - tyInput.SetDescription("Position Y: "); tyInput.SetPos(XMFLOAT2(x, y += step)); tyInput.SetSize(XMFLOAT2(siz, hei)); tyInput.OnInputAccepted([&](wi::gui::EventArgs args) { @@ -86,7 +85,6 @@ void TransformWindow::Create(EditorComponent* _editor) tzInput.Create(""); tzInput.SetValue(0); - tzInput.SetDescription("Position Z: "); tzInput.SetPos(XMFLOAT2(x, y += step)); tzInput.SetSize(XMFLOAT2(siz, hei)); tzInput.OnInputAccepted([&](wi::gui::EventArgs args) { @@ -104,7 +102,7 @@ void TransformWindow::Create(EditorComponent* _editor) sxInput.Create(""); sxInput.SetValue(1); - sxInput.SetDescription("Scale X: "); + sxInput.SetDescription("Scale: "); sxInput.SetPos(XMFLOAT2(x, y)); sxInput.SetSize(XMFLOAT2(siz, hei)); sxInput.OnInputAccepted([&](wi::gui::EventArgs args) { @@ -119,7 +117,6 @@ void TransformWindow::Create(EditorComponent* _editor) syInput.Create(""); syInput.SetValue(1); - syInput.SetDescription("Scale Y: "); syInput.SetPos(XMFLOAT2(x, y += step)); syInput.SetSize(XMFLOAT2(siz, hei)); syInput.OnInputAccepted([&](wi::gui::EventArgs args) { @@ -134,7 +131,6 @@ void TransformWindow::Create(EditorComponent* _editor) szInput.Create(""); szInput.SetValue(1); - szInput.SetDescription("Scale Z: "); szInput.SetPos(XMFLOAT2(x, y += step)); szInput.SetSize(XMFLOAT2(siz, hei)); szInput.OnInputAccepted([&](wi::gui::EventArgs args) { @@ -153,7 +149,7 @@ void TransformWindow::Create(EditorComponent* _editor) rollInput.Create(""); rollInput.SetValue(0); - rollInput.SetDescription("Rotation X: "); + rollInput.SetDescription("Rotation: "); rollInput.SetTooltip("Roll (in degrees)\n Note: Euler angle rotations can result in precision loss from quaternion conversion!"); rollInput.SetPos(XMFLOAT2(x, y += step)); rollInput.SetSize(XMFLOAT2(siz, hei)); @@ -174,7 +170,6 @@ void TransformWindow::Create(EditorComponent* _editor) pitchInput.Create(""); pitchInput.SetValue(0); - pitchInput.SetDescription("Rotation Y: "); pitchInput.SetTooltip("Pitch (in degrees)\n Note: Euler angle rotations can result in precision loss from quaternion conversion!"); pitchInput.SetPos(XMFLOAT2(x, y += step)); pitchInput.SetSize(XMFLOAT2(siz, hei)); @@ -195,7 +190,6 @@ void TransformWindow::Create(EditorComponent* _editor) yawInput.Create(""); yawInput.SetValue(0); - yawInput.SetDescription("Rotation Z: "); yawInput.SetTooltip("Yaw (in degrees)\n Note: Euler angle rotations can result in precision loss from quaternion conversion!"); yawInput.SetPos(XMFLOAT2(x, y += step)); yawInput.SetSize(XMFLOAT2(siz, hei)); @@ -219,7 +213,7 @@ void TransformWindow::Create(EditorComponent* _editor) rxInput.Create(""); rxInput.SetValue(0); - rxInput.SetDescription("Quaternion X: "); + rxInput.SetDescription("Quaternion: "); rxInput.SetTooltip("Rotation Quaternion.X"); rxInput.SetPos(XMFLOAT2(x, y += step)); rxInput.SetSize(XMFLOAT2(siz, hei)); @@ -236,7 +230,6 @@ void TransformWindow::Create(EditorComponent* _editor) ryInput.Create(""); ryInput.SetValue(0); - ryInput.SetDescription("Quaternion Y: "); ryInput.SetTooltip("Rotation Quaternion.Y"); ryInput.SetPos(XMFLOAT2(x, y += step)); ryInput.SetSize(XMFLOAT2(siz, hei)); @@ -253,7 +246,6 @@ void TransformWindow::Create(EditorComponent* _editor) rzInput.Create(""); rzInput.SetValue(0); - rzInput.SetDescription("Quaternion Z: "); rzInput.SetTooltip("Rotation Quaternion.Z"); rzInput.SetPos(XMFLOAT2(x, y += step)); rzInput.SetSize(XMFLOAT2(siz, hei)); @@ -270,7 +262,6 @@ void TransformWindow::Create(EditorComponent* _editor) rwInput.Create(""); rwInput.SetValue(1); - rwInput.SetDescription("Quaternion W: "); rwInput.SetTooltip("Rotation Quaternion.W"); rwInput.SetPos(XMFLOAT2(x, y += step)); rwInput.SetSize(XMFLOAT2(siz, hei)); @@ -366,3 +357,82 @@ void TransformWindow::SetEntity(Entity entity) SetEnabled(false); } } + +void TransformWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 80; + const float margin_right = 4; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 4; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(clearButton); + + float safe_width = width - 100; + txInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + tyInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + tzInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + + sxInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + syInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + szInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + + rollInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + pitchInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + yawInput.SetSize(XMFLOAT2(safe_width / 3.0f - padding, txInput.GetSize().y)); + + rxInput.SetSize(XMFLOAT2(safe_width / 4.0f - padding, txInput.GetSize().y)); + ryInput.SetSize(XMFLOAT2(safe_width / 4.0f - padding, txInput.GetSize().y)); + rzInput.SetSize(XMFLOAT2(safe_width / 4.0f - padding, txInput.GetSize().y)); + rwInput.SetSize(XMFLOAT2(safe_width / 4.0f - padding, txInput.GetSize().y)); + + add_right(tzInput); + tyInput.SetPos(XMFLOAT2(tzInput.GetPos().x - tyInput.GetSize().x - padding, tzInput.GetPos().y)); + txInput.SetPos(XMFLOAT2(tyInput.GetPos().x - txInput.GetSize().x - padding, tyInput.GetPos().y)); + add_right(szInput); + syInput.SetPos(XMFLOAT2(szInput.GetPos().x - syInput.GetSize().x - padding, szInput.GetPos().y)); + sxInput.SetPos(XMFLOAT2(syInput.GetPos().x - sxInput.GetSize().x - padding, syInput.GetPos().y)); + add_right(yawInput); + pitchInput.SetPos(XMFLOAT2(yawInput.GetPos().x - pitchInput.GetSize().x - padding, yawInput.GetPos().y)); + rollInput.SetPos(XMFLOAT2(pitchInput.GetPos().x - rollInput.GetSize().x - padding, pitchInput.GetPos().y)); + add_right(rwInput); + rzInput.SetPos(XMFLOAT2(rwInput.GetPos().x - rzInput.GetSize().x - padding, rwInput.GetPos().y)); + ryInput.SetPos(XMFLOAT2(rzInput.GetPos().x - ryInput.GetSize().x - padding, rzInput.GetPos().y)); + rxInput.SetPos(XMFLOAT2(ryInput.GetPos().x - rxInput.GetSize().x - padding, ryInput.GetPos().y)); + + y += jump; + + add_right(snapScaleInput); + add_right(snapRotateInput); + add_right(snapTranslateInput); + +} diff --git a/Editor/TransformWindow.h b/Editor/TransformWindow.h index 527b35caf..5ca1aceaf 100644 --- a/Editor/TransformWindow.h +++ b/Editor/TransformWindow.h @@ -35,5 +35,6 @@ public: wi::gui::TextInputField snapRotateInput; wi::gui::TextInputField snapTranslateInput; + void ResizeLayout() override; }; diff --git a/Editor/WeatherWindow.cpp b/Editor/WeatherWindow.cpp index 7241bf85e..cb62aa291 100644 --- a/Editor/WeatherWindow.cpp +++ b/Editor/WeatherWindow.cpp @@ -10,7 +10,7 @@ void WeatherWindow::Create(EditorComponent* _editor) { editor = _editor; wi::gui::Window::Create(ICON_WEATHER " Weather", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(660, 1300)); + SetSize(XMFLOAT2(660, 1400)); closeButton.SetTooltip("Delete WeatherComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -807,3 +807,99 @@ void WeatherWindow::UpdateWind() dir *= windMagnitudeSlider.GetValue(); XMStoreFloat3(&GetWeather().windDirection, dir); } + +void WeatherWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 150; + const float margin_right = 50; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 50; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add_fullwidth(primaryButton); + add_right(simpleskyCheckBox); + add_right(realisticskyCheckBox); + add(colorComboBox); + add_fullwidth(colorPicker); + add_fullwidth(skyButton); + add_fullwidth(colorgradingButton); + add_right(heightFogCheckBox); + add(fogStartSlider); + add(fogEndSlider); + add(fogHeightStartSlider); + add(fogHeightEndSlider); + add(fogHeightSkySlider); + add(cloudinessSlider); + add(cloudScaleSlider); + add(cloudSpeedSlider); + add(cloudShadowAmountSlider); + add(cloudShadowScaleSlider); + add(cloudShadowSpeedSlider); + add(windSpeedSlider); + add(windMagnitudeSlider); + add(windDirectionSlider); + add(windWaveSizeSlider); + add(windRandomnessSlider); + add(skyExposureSlider); + add(starsSlider); + + y += jump; + + add_right(volumetricCloudsCheckBox); + add(coverageAmountSlider); + add(coverageMinimumSlider); + + y += jump; + + add_right(ocean_enabledCheckBox); + add(ocean_patchSizeSlider); + add(ocean_waveAmplitudeSlider); + add(ocean_choppyScaleSlider); + add(ocean_windDependencySlider); + add(ocean_timeScaleSlider); + add(ocean_heightSlider); + add(ocean_detailSlider); + add(ocean_toleranceSlider); + add_fullwidth(ocean_resetButton); + + y += jump; + + add_fullwidth(preset0Button); + add_fullwidth(preset1Button); + add_fullwidth(preset2Button); + add_fullwidth(preset3Button); + add_fullwidth(preset4Button); + add_fullwidth(preset5Button); + add_fullwidth(eliminateCoarseCascadesButton); + add_fullwidth(ktxConvButton); + +} diff --git a/Editor/WeatherWindow.h b/Editor/WeatherWindow.h index b5e631169..d5fc55876 100644 --- a/Editor/WeatherWindow.h +++ b/Editor/WeatherWindow.h @@ -74,5 +74,7 @@ public: wi::gui::Button preset5Button; wi::gui::Button eliminateCoarseCascadesButton; wi::gui::Button ktxConvButton; + + void ResizeLayout() override; }; diff --git a/Editor/config.ini b/Editor/config.ini index 526267549..06ab024ab 100644 --- a/Editor/config.ini +++ b/Editor/config.ini @@ -65,6 +65,8 @@ chromatic_aberration_strength = 10 fsr = true fsr_sharpness = 1.0 +grid_helper = true + [camera] near = 0.1 far = 5000 diff --git a/WickedEngine/wiBacklog.cpp b/WickedEngine/wiBacklog.cpp index 310deaa1e..1eb0e45cd 100644 --- a/WickedEngine/wiBacklog.cpp +++ b/WickedEngine/wiBacklog.cpp @@ -108,6 +108,8 @@ namespace wi::backlog Scroll(-1000.0f * dt); } + Scroll(wi::input::GetPointer().z * 20); + static bool created = false; if (!created) { @@ -236,7 +238,7 @@ namespace wi::backlog toggleButton.Render(canvas, cmd); - rect.bottom = int32_t(canvas.LogicalToPhysical(canvas.GetLogicalHeight() - 35)); + rect.bottom = int32_t(canvas.LogicalToPhysical(inputField.GetPos().y - 15)); wi::graphics::GetDevice()->BindScissorRects(1, &rect, cmd); DrawOutputText(canvas, cmd, colorspace); diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index 5336ae761..ddc8ae766 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -261,6 +261,8 @@ namespace wi::gui XMStoreFloat3(&translation, T); XMStoreFloat3(&scale, S); + scale = wi::math::Max(scale, XMFLOAT3(0.001f, 0.001f, 0.001f)); + scissorRect.bottom = (int32_t)std::ceil(translation.y + scale.y); scissorRect.left = (int32_t)std::floor(translation.x); scissorRect.right = (int32_t)std::ceil(translation.x + scale.x); @@ -431,6 +433,7 @@ namespace wi::gui SetDirty(); scale_local.x = value.x; scale_local.y = value.y; + scale_local = wi::math::Max(scale_local, XMFLOAT3(0.001f, 0.001f, 0.001f)); UpdateTransform(); scale = scale_local; diff --git a/WickedEngine/wiGUI.h b/WickedEngine/wiGUI.h index c76b8747e..9a31f7f51 100644 --- a/WickedEngine/wiGUI.h +++ b/WickedEngine/wiGUI.h @@ -17,15 +17,15 @@ namespace wi::gui struct EventArgs { - XMFLOAT2 clickPos = {0,0}; - XMFLOAT2 startPos = {0,0}; - XMFLOAT2 deltaPos = {0,0}; - XMFLOAT2 endPos = {0,0}; + XMFLOAT2 clickPos = {}; + XMFLOAT2 startPos = {}; + XMFLOAT2 deltaPos = {}; + XMFLOAT2 endPos = {}; float fValue = 0; bool bValue = false; int iValue = 0; - wi::Color color = wi::Color::Black(); - std::string sValue = ""; + wi::Color color; + std::string sValue; uint64_t userdata = 0; }; @@ -86,7 +86,7 @@ namespace wi::gui // Window: WIDGET_ID_WINDOW_BASE, - // other user-defined widget states can be specified after this: + // other user-defined widget states can be specified after this (but in user's own enum): // And you will of course need to handle it yourself in a SetColor() override for example WIDGET_ID_USER, }; diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index ca652f2a0..e890fc620 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -3229,7 +3229,6 @@ namespace wi::scene size_t transform_index = transforms.GetIndex(entity); if (transform_index == ~0ull) { - assert(0); continue; } TransformComponent& transform = transforms[transform_index]; diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 6a6724496..058f59d57 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 26; + const int revision = 27; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);