Apply camera setting changes immediately. Remove current value check for shader setting changes.

This commit is contained in:
cc9cii 2014-09-29 06:27:54 +10:00
parent 6e8977348a
commit f0c739b763
2 changed files with 11 additions and 7 deletions

View file

@ -83,7 +83,7 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
fastFactor->setWidgetWidth (10); fastFactor->setWidgetWidth (10);
fastFactor->setViewLocation(1, 2); fastFactor->setViewLocation(1, 2);
Setting *farClipDist = createSetting (Type_SpinBox, section, "far clip distance"); Setting *farClipDist = createSetting (Type_DoubleSpinBox, section, "far clip distance");
farClipDist->setDefaultValue(300000); farClipDist->setDefaultValue(300000);
farClipDist->setEditorSetting(true); farClipDist->setEditorSetting(true);
farClipDist->setColumnSpan (1); farClipDist->setColumnSpan (1);
@ -483,15 +483,13 @@ void CSMSettings::UserSettings::updateUserSetting(const QString &settingKey,
{ {
mSettingDefinitions->setValue (settingKey ,list); mSettingDefinitions->setValue (settingKey ,list);
if(settingKey == "Objects/num_lights" if(settingKey == "Objects/num_lights" && !list.empty())
&& mSettingDefinitions->value(settingKey).toString() != list.at(0))
{ {
sh::Factory::getInstance ().setGlobalSetting ("num_lights", list.at(0).toStdString()); sh::Factory::getInstance ().setGlobalSetting ("num_lights", list.at(0).toStdString());
} }
else if(settingKey == "Objects/shaders" else if(settingKey == "Objects/shaders" && !list.empty())
&& mSettingDefinitions->value(settingKey).toString() != list.at(0))
{ {
sh::Factory::getInstance ().setShadersEnabled (list.at(0) == "true" ? true : false); sh::Factory::getInstance ().setShadersEnabled (list.at(0).toStdString() == "true" ? true : false);
} }
emit userSettingUpdated (settingKey, list); emit userSettingUpdated (settingKey, list);

View file

@ -48,7 +48,7 @@ namespace CSVRender
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance(); CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
int farClipDist = userSettings.setting("Scene/far clip distance", QString("300000")).toInt(); float farClipDist = userSettings.setting("Scene/far clip distance", QString("300000")).toFloat();
mCamera->setFarClipDistance (farClipDist); mCamera->setFarClipDistance (farClipDist);
mFastFactor = userSettings.setting("Scene/fast factor", QString("4")).toInt(); mFastFactor = userSettings.setting("Scene/fast factor", QString("4")).toInt();
@ -412,6 +412,12 @@ namespace CSVRender
if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive))) if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive)))
flagAsModified(); flagAsModified();
if(key == "Objects/far clip distance" && !list.empty())
{
if(mCamera->getFarClipDistance() != list.at(0).toFloat())
mCamera->setFarClipDistance(list.at(0).toFloat());
}
// minimise unnecessary ogre window creation by updating only when there is a change // minimise unnecessary ogre window creation by updating only when there is a change
if(key == "Video/antialiasing") if(key == "Video/antialiasing")
{ {