From ad509bb95485b10f511e9044d6da55573c5fdfcd Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 9 Sep 2023 13:12:08 +0200 Subject: [PATCH] Use settings values for Models settings --- apps/openmw/mwclass/npc.cpp | 12 ++++---- apps/openmw/mwrender/animation.cpp | 2 +- apps/openmw/mwrender/creatureanimation.cpp | 6 ++-- apps/openmw/mwrender/npcanimation.cpp | 4 +-- apps/openmw/mwrender/renderingmanager.cpp | 20 ++++++------- apps/openmw/mwrender/sky.cpp | 34 ++++++++++------------ components/sceneutil/actorutil.cpp | 18 ++++++------ 7 files changed, 46 insertions(+), 50 deletions(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 97debd3298..4c0f872344 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -424,10 +424,10 @@ namespace MWClass { const MWWorld::LiveCellRef* ref = ptr.get(); - std::string model = Settings::Manager::getString("baseanim", "Models"); + std::string model = Settings::models().mBaseanim; const ESM::Race* race = MWBase::Environment::get().getESMStore()->get().find(ref->mBase->mRace); if (race->mData.mFlags & ESM::Race::Beast) - model = Settings::Manager::getString("baseanimkna", "Models"); + model = Settings::models().mBaseanimkna; return model; } @@ -437,12 +437,12 @@ namespace MWClass const MWWorld::LiveCellRef* npc = ptr.get(); const ESM::Race* race = MWBase::Environment::get().getESMStore()->get().search(npc->mBase->mRace); if (race && race->mData.mFlags & ESM::Race::Beast) - models.emplace_back(Settings::Manager::getString("baseanimkna", "Models")); + models.push_back(Settings::models().mBaseanimkna); // keep these always loaded just in case - models.emplace_back(Settings::Manager::getString("xargonianswimkna", "Models")); - models.emplace_back(Settings::Manager::getString("xbaseanimfemale", "Models")); - models.emplace_back(Settings::Manager::getString("xbaseanim", "Models")); + models.push_back(Settings::models().mXargonianswimkna); + models.push_back(Settings::models().mXbaseanimfemale); + models.push_back(Settings::models().mXbaseanim); const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 74ec8e6d78..aaf2c9390b 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1394,7 +1394,7 @@ namespace MWRender MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->mBase->mFlags & ESM::Creature::Bipedal) { - defaultSkeleton = Settings::Manager::getString("xbaseanim", "Models"); + defaultSkeleton = Settings::models().mXbaseanim; inject = true; } } diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index 77faee7231..7767520715 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "../mwmechanics/weapontype.hpp" @@ -27,7 +27,7 @@ namespace MWRender setObjectRoot(model, false, false, true); if ((ref->mBase->mFlags & ESM::Creature::Bipedal)) - addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model); + addAnimSource(Settings::models().mXbaseanim.get(), model); if (animated) addAnimSource(model, model); @@ -47,7 +47,7 @@ namespace MWRender setObjectRoot(model, true, false, true); if ((ref->mBase->mFlags & ESM::Creature::Bipedal)) - addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model); + addAnimSource(Settings::models().mXbaseanim.get(), model); if (animated) addAnimSource(model, model); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 6ddca9a674..00f16e4ddc 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -515,7 +515,7 @@ namespace MWRender if (!is1stPerson) { - const std::string& base = Settings::Manager::getString("xbaseanim", "Models"); + const std::string& base = Settings::models().mXbaseanim; if (smodel != base && !isWerewolf) addAnimSource(base, smodel); @@ -529,7 +529,7 @@ namespace MWRender } else { - const std::string& base = Settings::Manager::getString("xbaseanim1st", "Models"); + const std::string& base = Settings::models().mXbaseanim1st; if (smodel != base && !isWerewolf) addAnimSource(base, smodel); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index f9058fa18a..c9750ec0b9 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -543,8 +543,8 @@ namespace MWRender MWBase::Environment::get().getWindowManager()->setCullMask(mask); NifOsg::Loader::setHiddenNodeMask(Mask_UpdateVisitor); NifOsg::Loader::setIntersectionDisabledNodeMask(Mask_Effect); - Nif::Reader::setLoadUnsupportedFiles(Settings::Manager::getBool("load unsupported nif files", "Models")); - Nif::Reader::setWriteNifDebugLog(Settings::Manager::getBool("write nif debug log", "Models")); + Nif::Reader::setLoadUnsupportedFiles(Settings::models().mLoadUnsupportedNifFiles); + Nif::Reader::setWriteNifDebugLog(Settings::models().mWriteNifDebugLog); mStateUpdater->setFogEnd(mViewDistance); @@ -606,15 +606,15 @@ namespace MWRender mSky->listAssetsToPreload(workItem->mModels, workItem->mTextures); mWater->listAssetsToPreload(workItem->mTextures); - workItem->mModels.push_back(Settings::Manager::getString("xbaseanim", "Models")); - workItem->mModels.push_back(Settings::Manager::getString("xbaseanim1st", "Models")); - workItem->mModels.push_back(Settings::Manager::getString("xbaseanimfemale", "Models")); - workItem->mModels.push_back(Settings::Manager::getString("xargonianswimkna", "Models")); + workItem->mModels.push_back(Settings::models().mXbaseanim); + workItem->mModels.push_back(Settings::models().mXbaseanim1st); + workItem->mModels.push_back(Settings::models().mXbaseanimfemale); + workItem->mModels.push_back(Settings::models().mXargonianswimkna); - workItem->mKeyframes.push_back(Settings::Manager::getString("xbaseanimkf", "Models")); - workItem->mKeyframes.push_back(Settings::Manager::getString("xbaseanim1stkf", "Models")); - workItem->mKeyframes.push_back(Settings::Manager::getString("xbaseanimfemalekf", "Models")); - workItem->mKeyframes.push_back(Settings::Manager::getString("xargonianswimknakf", "Models")); + workItem->mKeyframes.push_back(Settings::models().mXbaseanimkf); + workItem->mKeyframes.push_back(Settings::models().mXbaseanim1stkf); + workItem->mKeyframes.push_back(Settings::models().mXbaseanimfemalekf); + workItem->mKeyframes.push_back(Settings::models().mXargonianswimknakf); workItem->mTextures.emplace_back("textures/_land_default.dds"); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index d2f725c4b8..05c7a1bab2 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -302,8 +302,7 @@ namespace MWRender bool forceShaders = mSceneManager->getForceShaders(); - mAtmosphereDay - = mSceneManager->getInstance(Settings::Manager::getString("skyatmosphere", "Models"), mEarlyRenderBinRoot); + mAtmosphereDay = mSceneManager->getInstance(Settings::models().mSkyatmosphere, mEarlyRenderBinRoot); ModVertexAlphaVisitor modAtmosphere(ModVertexAlphaVisitor::Atmosphere); mAtmosphereDay->accept(modAtmosphere); @@ -315,12 +314,10 @@ namespace MWRender mEarlyRenderBinRoot->addChild(mAtmosphereNightNode); osg::ref_ptr atmosphereNight; - if (mSceneManager->getVFS()->exists(Settings::Manager::getString("skynight02", "Models"))) - atmosphereNight = mSceneManager->getInstance( - Settings::Manager::getString("skynight02", "Models"), mAtmosphereNightNode); + if (mSceneManager->getVFS()->exists(Settings::models().mSkynight02.get())) + atmosphereNight = mSceneManager->getInstance(Settings::models().mSkynight02, mAtmosphereNightNode); else - atmosphereNight = mSceneManager->getInstance( - Settings::Manager::getString("skynight01", "Models"), mAtmosphereNightNode); + atmosphereNight = mSceneManager->getInstance(Settings::models().mSkynight01, mAtmosphereNightNode); atmosphereNight->getOrCreateStateSet()->setAttributeAndModes( createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); @@ -340,8 +337,7 @@ namespace MWRender mEarlyRenderBinRoot->addChild(mCloudNode); mCloudMesh = new osg::PositionAttitudeTransform; - osg::ref_ptr cloudMeshChild - = mSceneManager->getInstance(Settings::Manager::getString("skyclouds", "Models"), mCloudMesh); + osg::ref_ptr cloudMeshChild = mSceneManager->getInstance(Settings::models().mSkyclouds, mCloudMesh); mCloudUpdater = new CloudUpdater(forceShaders); mCloudUpdater->setOpacity(1.f); cloudMeshChild->addUpdateCallback(mCloudUpdater); @@ -349,7 +345,7 @@ namespace MWRender mNextCloudMesh = new osg::PositionAttitudeTransform; osg::ref_ptr nextCloudMeshChild - = mSceneManager->getInstance(Settings::Manager::getString("skyclouds", "Models"), mNextCloudMesh); + = mSceneManager->getInstance(Settings::models().mSkyclouds, mNextCloudMesh); mNextCloudUpdater = new CloudUpdater(forceShaders); mNextCloudUpdater->setOpacity(0.f); nextCloudMeshChild->addUpdateCallback(mNextCloudUpdater); @@ -911,16 +907,16 @@ namespace MWRender void SkyManager::listAssetsToPreload(std::vector& models, std::vector& textures) { - models.emplace_back(Settings::Manager::getString("skyatmosphere", "Models")); - if (mSceneManager->getVFS()->exists(Settings::Manager::getString("skynight02", "Models"))) - models.emplace_back(Settings::Manager::getString("skynight02", "Models")); - models.emplace_back(Settings::Manager::getString("skynight01", "Models")); - models.emplace_back(Settings::Manager::getString("skyclouds", "Models")); + models.push_back(Settings::models().mSkyatmosphere); + if (mSceneManager->getVFS()->exists(Settings::models().mSkynight02.get())) + models.push_back(Settings::models().mSkynight02); + models.push_back(Settings::models().mSkynight01); + models.push_back(Settings::models().mSkyclouds); - models.emplace_back(Settings::Manager::getString("weatherashcloud", "Models")); - models.emplace_back(Settings::Manager::getString("weatherblightcloud", "Models")); - models.emplace_back(Settings::Manager::getString("weathersnow", "Models")); - models.emplace_back(Settings::Manager::getString("weatherblizzard", "Models")); + models.push_back(Settings::models().mWeatherashcloud); + models.push_back(Settings::models().mWeatherblightcloud); + models.push_back(Settings::models().mWeathersnow); + models.push_back(Settings::models().mWeatherblizzard); textures.emplace_back("textures/tx_mooncircle_full_s.dds"); textures.emplace_back("textures/tx_mooncircle_full_m.dds"); diff --git a/components/sceneutil/actorutil.cpp b/components/sceneutil/actorutil.cpp index c13cd093bf..63d3beccb7 100644 --- a/components/sceneutil/actorutil.cpp +++ b/components/sceneutil/actorutil.cpp @@ -1,6 +1,6 @@ #include "actorutil.hpp" -#include +#include namespace SceneUtil { @@ -9,24 +9,24 @@ namespace SceneUtil if (!firstPerson) { if (isWerewolf) - return Settings::Manager::getString("wolfskin", "Models"); + return Settings::models().mWolfskin; else if (isBeast) - return Settings::Manager::getString("baseanimkna", "Models"); + return Settings::models().mBaseanimkna; else if (isFemale) - return Settings::Manager::getString("baseanimfemale", "Models"); + return Settings::models().mBaseanimfemale; else - return Settings::Manager::getString("baseanim", "Models"); + return Settings::models().mBaseanim; } else { if (isWerewolf) - return Settings::Manager::getString("wolfskin1st", "Models"); + return Settings::models().mWolfskin1st; else if (isBeast) - return Settings::Manager::getString("baseanimkna1st", "Models"); + return Settings::models().mBaseanimkna1st; else if (isFemale) - return Settings::Manager::getString("baseanimfemale1st", "Models"); + return Settings::models().mBaseanimfemale1st; else - return Settings::Manager::getString("xbaseanim1st", "Models"); + return Settings::models().mXbaseanim1st; } } }