From b67cf3af2435cd772302c1f8ce5bda7ef471c7f5 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Mar 2015 14:33:06 -0700 Subject: [PATCH] more tweaks to LOD tools dialog --- interface/src/LODManager.cpp | 8 -------- interface/src/ui/LodToolsDialog.cpp | 29 +++++++++++++++++------------ interface/src/ui/LodToolsDialog.h | 3 +-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/interface/src/LODManager.cpp b/interface/src/LODManager.cpp index 6d08b8e242..8b942dcfe1 100644 --- a/interface/src/LODManager.cpp +++ b/interface/src/LODManager.cpp @@ -20,10 +20,6 @@ Setting::Handle desktopLODDecreaseFPS("desktopLODDecreaseFPS", DEFAULT_DESKTOP_LOD_DOWN_FPS); Setting::Handle hmdLODDecreaseFPS("hmdLODDecreaseFPS", DEFAULT_HMD_LOD_DOWN_FPS); -Setting::Handle boundaryLevelAdjust("boundaryLevelAdjust", 0); -Setting::Handle octreeSizeScale("octreeSizeScale", DEFAULT_OCTREE_SIZE_SCALE); - - LODManager::LODManager() { calculateAvatarLODDistanceMultiplier(); } @@ -221,15 +217,11 @@ void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) { void LODManager::loadSettings() { setDesktopLODDecreaseFPS(desktopLODDecreaseFPS.get()); setHMDLODDecreaseFPS(hmdLODDecreaseFPS.get()); - setBoundaryLevelAdjust(boundaryLevelAdjust.get()); - setOctreeSizeScale(octreeSizeScale.get()); } void LODManager::saveSettings() { desktopLODDecreaseFPS.set(getDesktopLODDecreaseFPS()); hmdLODDecreaseFPS.set(getHMDLODDecreaseFPS()); - boundaryLevelAdjust.set(getBoundaryLevelAdjust()); - octreeSizeScale.set(getOctreeSizeScale()); } diff --git a/interface/src/ui/LodToolsDialog.cpp b/interface/src/ui/LodToolsDialog.cpp index 97991c62a4..378a1391f4 100644 --- a/interface/src/ui/LodToolsDialog.cpp +++ b/interface/src/ui/LodToolsDialog.cpp @@ -46,9 +46,9 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) : _feedback->setFixedWidth(FEEDBACK_WIDTH); form->addRow("You can see... ", _feedback); - form->addRow("Automatic LOD Adjustment:", _automaticLODAdjust = new QCheckBox(this)); - _automaticLODAdjust->setChecked(lodManager->getAutomaticLODAdjust()); - connect(_automaticLODAdjust, SIGNAL(toggled(bool)), SLOT(updateAutomaticLODAdjust())); + form->addRow("Manually Adjust Level of Detail:", _manualLODAdjust = new QCheckBox(this)); + _manualLODAdjust->setChecked(!lodManager->getAutomaticLODAdjust()); + connect(_manualLODAdjust, SIGNAL(toggled(bool)), SLOT(updateAutomaticLODAdjust())); _lodSize = new QSlider(Qt::Horizontal, this); const int MAX_LOD_SIZE = MAX_LOD_SIZE_MULTIPLIER; @@ -65,7 +65,7 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) : _lodSize->setPageStep(PAGE_STEP_LOD_SIZE); int sliderValue = lodManager->getOctreeSizeScale() / TREE_SCALE; _lodSize->setValue(sliderValue); - form->addRow("Non-Avatar Content LOD:", _lodSize); + form->addRow("Level of Detail:", _lodSize); connect(_lodSize,SIGNAL(valueChanged(int)),this,SLOT(sizeScaleValueChanged(int))); // Add a button to reset @@ -86,12 +86,8 @@ void LodToolsDialog::reloadSliders() { void LodToolsDialog::updateAutomaticLODAdjust() { auto lodManager = DependencyManager::get(); - lodManager->setAutomaticLODAdjust(_automaticLODAdjust->isChecked()); -} - -void LodToolsDialog::updateLODValues() { - auto lodManager = DependencyManager::get(); - lodManager->setAutomaticLODAdjust(_automaticLODAdjust->isChecked()); + lodManager->setAutomaticLODAdjust(!_manualLODAdjust->isChecked()); + _lodSize->setEnabled(_manualLODAdjust->isChecked()); } void LodToolsDialog::sizeScaleValueChanged(int value) { @@ -106,9 +102,9 @@ void LodToolsDialog::resetClicked(bool checked) { int sliderValue = DEFAULT_OCTREE_SIZE_SCALE / TREE_SCALE; _lodSize->setValue(sliderValue); - _automaticLODAdjust->setChecked(true); + _manualLODAdjust->setChecked(false); - updateLODValues(); // tell our LOD manager about the reset + updateAutomaticLODAdjust(); // tell our LOD manager about the reset } void LodToolsDialog::reject() { @@ -119,6 +115,15 @@ void LodToolsDialog::reject() { void LodToolsDialog::closeEvent(QCloseEvent* event) { this->QDialog::closeEvent(event); emit closed(); + auto lodManager = DependencyManager::get(); + + // always revert back to automatic LOD adjustment when closed + lodManager->setAutomaticLODAdjust(true); + + // if the user adjusted the LOD above "normal" then always revert back to default + if (lodManager->getOctreeSizeScale() > DEFAULT_OCTREE_SIZE_SCALE) { + lodManager->setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE); + } } diff --git a/interface/src/ui/LodToolsDialog.h b/interface/src/ui/LodToolsDialog.h index 91be04e0ed..e5a2dae836 100644 --- a/interface/src/ui/LodToolsDialog.h +++ b/interface/src/ui/LodToolsDialog.h @@ -34,7 +34,6 @@ public slots: void resetClicked(bool checked); void reloadSliders(); void updateAutomaticLODAdjust(); - void updateLODValues(); protected: @@ -44,7 +43,7 @@ protected: private: QSlider* _lodSize; - QCheckBox* _automaticLODAdjust; + QCheckBox* _manualLODAdjust; QDoubleSpinBox* _desktopLODDecreaseFPS;