From 2ae68776a9922e93b76aa8f9416d2c499928e0da Mon Sep 17 00:00:00 2001 From: Seth Troisi Date: Wed, 2 Mar 2022 00:07:25 -0800 Subject: [PATCH] Add FPS parameter to UI --- Source/Fractorium/Fractorium.cpp | 1 + Source/Fractorium/Fractorium.ui | 31 ++++++++++++++++++++++++ Source/Fractorium/FractoriumLibrary.cpp | 8 ++++-- Source/Fractorium/FractoriumSettings.cpp | 3 +++ Source/Fractorium/FractoriumSettings.h | 4 +++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index a53c03f..8c40520 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -1232,6 +1232,7 @@ void Fractorium::SetTabOrders() w = SetTabOrder(this, w, ui.SequenceRotationsPerBlendCWCheckBox); w = SetTabOrder(this, w, ui.SequenceRotationsPerBlendMaxSpinBox); w = SetTabOrder(this, w, ui.SequenceLinearCheckBox); + w = SetTabOrder(this, w, ui.SequenceAnimationFpsSpinBox); w = SetTabOrder(this, w, ui.SequenceGenerateButton); w = SetTabOrder(this, w, ui.SequenceRenderButton); w = SetTabOrder(this, w, ui.SequenceSaveButton); diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index 11c9b6c..6ab2161 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -8070,6 +8070,37 @@ + + + + + 0 + 0 + + + + <html><head/><body><p>The number of frames per second for preview animation.</p></body></html> + + + QAbstractSpinBox::NoButtons + + + + + + Animation FPS: + + + 200 + + + 1 + + + 30 + + + diff --git a/Source/Fractorium/FractoriumLibrary.cpp b/Source/Fractorium/FractoriumLibrary.cpp index 7020aec..753596b 100644 --- a/Source/Fractorium/FractoriumLibrary.cpp +++ b/Source/Fractorium/FractoriumLibrary.cpp @@ -65,8 +65,11 @@ void Fractorium::InitLibraryUI() ui.SequenceRotationsPerBlendMaxSpinBox->setMinimum(m_Settings->RotationsPerBlend());//Upper min = lower max. //Linear. ui.SequenceLinearCheckBox->setChecked(m_Settings->Linear()); + //Animation FPS. + ui.SequenceAnimationFpsSpinBox->setValue(m_Settings->AnimationFps()); } + /// /// Select the item in the library tree specified by the passed in index. /// @@ -849,8 +852,8 @@ void FractoriumEmberController::SequenceAnimateButtonClicked() { animation->setExpanded(true); m_AnimateFrame = 0; - const auto fps = 30;//TODO Make this a UI Parameter - m_AnimateTimer->start(1000 / fps); + // TODO look at duration based instead of time + m_AnimateTimer->start(1000 / m_Fractorium->ui.SequenceAnimationFpsSpinBox->value()); } } } @@ -1018,6 +1021,7 @@ void Fractorium::SyncSequenceSettings() m_Settings->RotationsPerBlend(ui.SequenceRotationsPerBlendSpinBox->value()); m_Settings->RotationsPerBlendMax(ui.SequenceRotationsPerBlendMaxSpinBox->value()); m_Settings->Linear(ui.SequenceLinearCheckBox->isChecked()); + m_Settings->AnimationFps(ui.SequenceAnimationFpsSpinBox->value()); } template class FractoriumEmberController; diff --git a/Source/Fractorium/FractoriumSettings.cpp b/Source/Fractorium/FractoriumSettings.cpp index 28a6311..c60819e 100644 --- a/Source/Fractorium/FractoriumSettings.cpp +++ b/Source/Fractorium/FractoriumSettings.cpp @@ -242,6 +242,9 @@ void FractoriumSettings::RotationsPerBlendMax(uint i) { setValue(ROTATIONSPERBLE bool FractoriumSettings::Linear() { return value(LINEAR).toBool(); } void FractoriumSettings::Linear(bool b) { setValue(LINEAR, b); } +uint FractoriumSettings::AnimationFps() { return value(ANIMATION_FPS).toUInt(); } +void FractoriumSettings::AnimationFps(uint i) { setValue(ANIMATION_FPS, i); } + /// /// Variations filter settings. /// diff --git a/Source/Fractorium/FractoriumSettings.h b/Source/Fractorium/FractoriumSettings.h index 78d5600..f8bbf00 100644 --- a/Source/Fractorium/FractoriumSettings.h +++ b/Source/Fractorium/FractoriumSettings.h @@ -43,6 +43,7 @@ #define ROTATIONSPERBLEND "sequence/rotationsperblend" #define ROTATIONSPERBLENDMAX "sequence/rotationsperblendmax" #define LINEAR "sequence/linear" +#define ANIMATION_FPS "sequence/animationfps" #define VARFILTERSUM "varfilter/sumcheckbox" #define VARFILTERASSIGN "varfilter/assigncheckbox" @@ -218,6 +219,9 @@ public: bool Linear(); void Linear(bool b); + uint AnimationFps(); + void AnimationFps(uint i); + int VarFilterSum(); void VarFilterSum(int i);