From 4dee9acd1ea0a58ad3dce7ecf24c85225c06936e Mon Sep 17 00:00:00 2001 From: "glassmancody.info" Date: Tue, 31 May 2022 16:26:51 -0700 Subject: [PATCH] fill bars to postprocess hud --- components/fx/widgets.cpp | 2 ++ components/fx/widgets.hpp | 12 ++++++++++++ files/mygui/openmw_postprocessor_hud.skin.xml | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/components/fx/widgets.cpp b/components/fx/widgets.cpp index 4316e8d7fe..749f0a1c6a 100644 --- a/components/fx/widgets.cpp +++ b/components/fx/widgets.cpp @@ -32,6 +32,7 @@ namespace fx return; mCheckbutton->setCaptionWithReplacing(value ? "#{sOn}" : "#{sOff}"); + mFill->setVisible(value); uniform->setValue(value); } @@ -61,6 +62,7 @@ namespace fx Base::initialiseOverride(); assignWidget(mCheckbutton, "Checkbutton"); + assignWidget(mFill, "Fill"); mCheckbutton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditBool::notifyMouseButtonClick); } diff --git a/components/fx/widgets.hpp b/components/fx/widgets.hpp index ed50e6d4d4..0019bd349c 100644 --- a/components/fx/widgets.hpp +++ b/components/fx/widgets.hpp @@ -68,6 +68,7 @@ namespace fx void notifyMouseButtonClick(MyGUI::Widget* sender); MyGUI::Button* mCheckbutton; + MyGUI::Widget* mFill; }; template @@ -86,17 +87,26 @@ namespace fx else mValueLabel->setCaption(std::to_string(mValue)); + float range = 0.f; + if (auto uniform = mUniform.lock()) { if constexpr (std::is_fundamental_v) + { uniform->template setValue(mValue); + range = uniform->template getMax() - uniform->template getMin(); + } else { UType uvalue = uniform->template getValue(); uvalue[mIndex] = mValue; uniform->template setValue(uvalue); + range = uniform->template getMax()[mIndex] - uniform->template getMin()[mIndex]; } } + + float fill = (range == 0.f) ? 1.f : mValue / range; + mFill->setRealSize(fill, 1.0); } void setValueFromUniform() override @@ -135,6 +145,7 @@ namespace fx assignWidget(mValueLabel, "Value"); assignWidget(mButtonIncrease, "ButtonIncrease"); assignWidget(mButtonDecrease, "ButtonDecrease"); + assignWidget(mFill, "Fill"); mButtonIncrease->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNumber::notifyButtonClicked); mButtonDecrease->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNumber::notifyButtonClicked); @@ -226,6 +237,7 @@ namespace fx MyGUI::Button* mButtonDecrease; MyGUI::Button* mButtonIncrease; MyGUI::Widget* mDragger; + MyGUI::Widget* mFill; MyGUI::TextBox* mValueLabel; T mValue; diff --git a/files/mygui/openmw_postprocessor_hud.skin.xml b/files/mygui/openmw_postprocessor_hud.skin.xml index ad9a5667be..094330620c 100644 --- a/files/mygui/openmw_postprocessor_hud.skin.xml +++ b/files/mygui/openmw_postprocessor_hud.skin.xml @@ -3,6 +3,11 @@ + + + + + @@ -26,6 +31,12 @@ + + + + + + @@ -35,7 +46,6 @@ - @@ -71,7 +81,7 @@ - +