mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 22:45:36 +00:00
Use normalized path for models settings
This commit is contained in:
parent
f456978cc3
commit
9e36b3fc0b
12 changed files with 76 additions and 62 deletions
|
@ -445,12 +445,11 @@ namespace MWClass
|
|||
{
|
||||
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
|
||||
|
||||
const std::string& model = Settings::models().mBaseanim;
|
||||
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
|
||||
if (race->mData.mFlags & ESM::Race::Beast)
|
||||
return Settings::models().mBaseanimkna;
|
||||
return Settings::models().mBaseanimkna.get().value();
|
||||
|
||||
return model;
|
||||
return Settings::models().mBaseanim.get().value();
|
||||
}
|
||||
|
||||
void Npc::getModelsToPreload(const MWWorld::ConstPtr& ptr, std::vector<std::string_view>& models) const
|
||||
|
|
|
@ -10,24 +10,24 @@ namespace MWRender
|
|||
if (!firstPerson)
|
||||
{
|
||||
if (isWerewolf)
|
||||
return Settings::models().mWolfskin;
|
||||
return Settings::models().mWolfskin.get().value();
|
||||
else if (isBeast)
|
||||
return Settings::models().mBaseanimkna;
|
||||
return Settings::models().mBaseanimkna.get().value();
|
||||
else if (isFemale)
|
||||
return Settings::models().mBaseanimfemale;
|
||||
return Settings::models().mBaseanimfemale.get().value();
|
||||
else
|
||||
return Settings::models().mBaseanim;
|
||||
return Settings::models().mBaseanim.get().value();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isWerewolf)
|
||||
return Settings::models().mWolfskin1st;
|
||||
return Settings::models().mWolfskin1st.get().value();
|
||||
else if (isBeast)
|
||||
return Settings::models().mBaseanimkna1st;
|
||||
return Settings::models().mBaseanimkna1st.get().value();
|
||||
else if (isFemale)
|
||||
return Settings::models().mBaseanimfemale1st;
|
||||
return Settings::models().mBaseanimfemale1st.get().value();
|
||||
else
|
||||
return Settings::models().mXbaseanim1st;
|
||||
return Settings::models().mXbaseanim1st.get().value();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1590,7 +1590,7 @@ namespace MWRender
|
|||
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
||||
if (ref->mBase->mFlags & ESM::Creature::Bipedal)
|
||||
{
|
||||
defaultSkeleton = Settings::models().mXbaseanim;
|
||||
defaultSkeleton = Settings::models().mXbaseanim.get().value();
|
||||
inject = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -502,7 +502,7 @@ namespace MWRender
|
|||
|
||||
if (!is1stPerson)
|
||||
{
|
||||
const std::string& base = Settings::models().mXbaseanim;
|
||||
const std::string& base = Settings::models().mXbaseanim.get().value();
|
||||
if (!isWerewolf)
|
||||
addAnimSource(base, smodel);
|
||||
|
||||
|
@ -521,9 +521,8 @@ namespace MWRender
|
|||
}
|
||||
else
|
||||
{
|
||||
const std::string& base = Settings::models().mXbaseanim1st;
|
||||
if (!isWerewolf)
|
||||
addAnimSource(base, smodel);
|
||||
addAnimSource(Settings::models().mXbaseanim1st.get().value(), smodel);
|
||||
|
||||
if (!isBase)
|
||||
addAnimSource(smodel, smodel);
|
||||
|
|
|
@ -283,12 +283,12 @@ namespace MWRender
|
|||
{
|
||||
try
|
||||
{
|
||||
for (std::vector<std::string>::const_iterator it = mModels.begin(); it != mModels.end(); ++it)
|
||||
mResourceSystem->getSceneManager()->getTemplate(*it);
|
||||
for (std::vector<std::string>::const_iterator it = mTextures.begin(); it != mTextures.end(); ++it)
|
||||
mResourceSystem->getImageManager()->getImage(*it);
|
||||
for (std::vector<std::string>::const_iterator it = mKeyframes.begin(); it != mKeyframes.end(); ++it)
|
||||
mResourceSystem->getKeyframeManager()->get(*it);
|
||||
for (const VFS::Path::Normalized& v : mModels)
|
||||
mResourceSystem->getSceneManager()->getTemplate(v);
|
||||
for (const VFS::Path::Normalized& v : mTextures)
|
||||
mResourceSystem->getImageManager()->getImage(v);
|
||||
for (const VFS::Path::Normalized& v : mKeyframes)
|
||||
mResourceSystem->getKeyframeManager()->get(v);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
@ -296,9 +296,9 @@ namespace MWRender
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> mModels;
|
||||
std::vector<std::string> mTextures;
|
||||
std::vector<std::string> mKeyframes;
|
||||
std::vector<VFS::Path::Normalized> mModels;
|
||||
std::vector<VFS::Path::Normalized> mTextures;
|
||||
std::vector<VFS::Path::Normalized> mKeyframes;
|
||||
|
||||
private:
|
||||
Resource::ResourceSystem* mResourceSystem;
|
||||
|
|
|
@ -934,7 +934,8 @@ namespace MWRender
|
|||
mUnderwaterSwitch->setWaterLevel(height);
|
||||
}
|
||||
|
||||
void SkyManager::listAssetsToPreload(std::vector<std::string>& models, std::vector<std::string>& textures)
|
||||
void SkyManager::listAssetsToPreload(
|
||||
std::vector<VFS::Path::Normalized>& models, std::vector<VFS::Path::Normalized>& textures)
|
||||
{
|
||||
models.push_back(Settings::models().mSkyatmosphere);
|
||||
if (mSceneManager->getVFS()->exists(Settings::models().mSkynight02.get()))
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <osg/Vec4f>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
#include "precipitationocclusion.hpp"
|
||||
#include "skyutil.hpp"
|
||||
|
||||
|
@ -100,7 +102,8 @@ namespace MWRender
|
|||
/// Set height of water plane (used to remove underwater weather particles)
|
||||
void setWaterHeight(float height);
|
||||
|
||||
void listAssetsToPreload(std::vector<std::string>& models, std::vector<std::string>& textures);
|
||||
void listAssetsToPreload(
|
||||
std::vector<VFS::Path::Normalized>& models, std::vector<VFS::Path::Normalized>& textures);
|
||||
|
||||
float getBaseWindSpeed() const;
|
||||
|
||||
|
|
|
@ -744,7 +744,7 @@ namespace MWRender
|
|||
}
|
||||
}
|
||||
|
||||
void Water::listAssetsToPreload(std::vector<std::string>& textures)
|
||||
void Water::listAssetsToPreload(std::vector<VFS::Path::Normalized>& textures)
|
||||
{
|
||||
const int frameCount = std::clamp(Fallback::Map::getInt("Water_SurfaceFrameCount"), 0, 320);
|
||||
std::string_view texture = Fallback::Map::getString("Water_SurfaceTexture");
|
||||
|
@ -752,7 +752,7 @@ namespace MWRender
|
|||
{
|
||||
std::ostringstream texname;
|
||||
texname << "textures/water/" << texture << std::setw(2) << std::setfill('0') << i << ".dds";
|
||||
textures.push_back(texname.str());
|
||||
textures.emplace_back(texname.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <osg/ref_ptr>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
namespace osg
|
||||
{
|
||||
|
@ -92,7 +93,7 @@ namespace MWRender
|
|||
|
||||
void setCullCallback(osg::Callback* callback);
|
||||
|
||||
void listAssetsToPreload(std::vector<std::string>& textures);
|
||||
void listAssetsToPreload(std::vector<VFS::Path::Normalized>& textures);
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
|
|
|
@ -2,14 +2,7 @@
|
|||
#define OPENMW_COMPONENTS_SETTINGS_CATEGORIES_MODELS_H
|
||||
|
||||
#include <components/settings/settingvalue.hpp>
|
||||
|
||||
#include <osg/Math>
|
||||
#include <osg/Vec2f>
|
||||
#include <osg/Vec3f>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
namespace Settings
|
||||
{
|
||||
|
@ -18,29 +11,29 @@ namespace Settings
|
|||
using WithIndex::WithIndex;
|
||||
|
||||
SettingValue<bool> mLoadUnsupportedNifFiles{ mIndex, "Models", "load unsupported nif files" };
|
||||
SettingValue<std::string> mXbaseanim{ mIndex, "Models", "xbaseanim" };
|
||||
SettingValue<std::string> mBaseanim{ mIndex, "Models", "baseanim" };
|
||||
SettingValue<std::string> mXbaseanim1st{ mIndex, "Models", "xbaseanim1st" };
|
||||
SettingValue<std::string> mBaseanimkna{ mIndex, "Models", "baseanimkna" };
|
||||
SettingValue<std::string> mBaseanimkna1st{ mIndex, "Models", "baseanimkna1st" };
|
||||
SettingValue<std::string> mXbaseanimfemale{ mIndex, "Models", "xbaseanimfemale" };
|
||||
SettingValue<std::string> mBaseanimfemale{ mIndex, "Models", "baseanimfemale" };
|
||||
SettingValue<std::string> mBaseanimfemale1st{ mIndex, "Models", "baseanimfemale1st" };
|
||||
SettingValue<std::string> mWolfskin{ mIndex, "Models", "wolfskin" };
|
||||
SettingValue<std::string> mWolfskin1st{ mIndex, "Models", "wolfskin1st" };
|
||||
SettingValue<std::string> mXargonianswimkna{ mIndex, "Models", "xargonianswimkna" };
|
||||
SettingValue<std::string> mXbaseanimkf{ mIndex, "Models", "xbaseanimkf" };
|
||||
SettingValue<std::string> mXbaseanim1stkf{ mIndex, "Models", "xbaseanim1stkf" };
|
||||
SettingValue<std::string> mXbaseanimfemalekf{ mIndex, "Models", "xbaseanimfemalekf" };
|
||||
SettingValue<std::string> mXargonianswimknakf{ mIndex, "Models", "xargonianswimknakf" };
|
||||
SettingValue<std::string> mSkyatmosphere{ mIndex, "Models", "skyatmosphere" };
|
||||
SettingValue<std::string> mSkyclouds{ mIndex, "Models", "skyclouds" };
|
||||
SettingValue<std::string> mSkynight01{ mIndex, "Models", "skynight01" };
|
||||
SettingValue<std::string> mSkynight02{ mIndex, "Models", "skynight02" };
|
||||
SettingValue<std::string> mWeatherashcloud{ mIndex, "Models", "weatherashcloud" };
|
||||
SettingValue<std::string> mWeatherblightcloud{ mIndex, "Models", "weatherblightcloud" };
|
||||
SettingValue<std::string> mWeathersnow{ mIndex, "Models", "weathersnow" };
|
||||
SettingValue<std::string> mWeatherblizzard{ mIndex, "Models", "weatherblizzard" };
|
||||
SettingValue<VFS::Path::Normalized> mXbaseanim{ mIndex, "Models", "xbaseanim" };
|
||||
SettingValue<VFS::Path::Normalized> mBaseanim{ mIndex, "Models", "baseanim" };
|
||||
SettingValue<VFS::Path::Normalized> mXbaseanim1st{ mIndex, "Models", "xbaseanim1st" };
|
||||
SettingValue<VFS::Path::Normalized> mBaseanimkna{ mIndex, "Models", "baseanimkna" };
|
||||
SettingValue<VFS::Path::Normalized> mBaseanimkna1st{ mIndex, "Models", "baseanimkna1st" };
|
||||
SettingValue<VFS::Path::Normalized> mXbaseanimfemale{ mIndex, "Models", "xbaseanimfemale" };
|
||||
SettingValue<VFS::Path::Normalized> mBaseanimfemale{ mIndex, "Models", "baseanimfemale" };
|
||||
SettingValue<VFS::Path::Normalized> mBaseanimfemale1st{ mIndex, "Models", "baseanimfemale1st" };
|
||||
SettingValue<VFS::Path::Normalized> mWolfskin{ mIndex, "Models", "wolfskin" };
|
||||
SettingValue<VFS::Path::Normalized> mWolfskin1st{ mIndex, "Models", "wolfskin1st" };
|
||||
SettingValue<VFS::Path::Normalized> mXargonianswimkna{ mIndex, "Models", "xargonianswimkna" };
|
||||
SettingValue<VFS::Path::Normalized> mXbaseanimkf{ mIndex, "Models", "xbaseanimkf" };
|
||||
SettingValue<VFS::Path::Normalized> mXbaseanim1stkf{ mIndex, "Models", "xbaseanim1stkf" };
|
||||
SettingValue<VFS::Path::Normalized> mXbaseanimfemalekf{ mIndex, "Models", "xbaseanimfemalekf" };
|
||||
SettingValue<VFS::Path::Normalized> mXargonianswimknakf{ mIndex, "Models", "xargonianswimknakf" };
|
||||
SettingValue<VFS::Path::Normalized> mSkyatmosphere{ mIndex, "Models", "skyatmosphere" };
|
||||
SettingValue<VFS::Path::Normalized> mSkyclouds{ mIndex, "Models", "skyclouds" };
|
||||
SettingValue<VFS::Path::Normalized> mSkynight01{ mIndex, "Models", "skynight01" };
|
||||
SettingValue<VFS::Path::Normalized> mSkynight02{ mIndex, "Models", "skynight02" };
|
||||
SettingValue<VFS::Path::Normalized> mWeatherashcloud{ mIndex, "Models", "weatherashcloud" };
|
||||
SettingValue<VFS::Path::Normalized> mWeatherblightcloud{ mIndex, "Models", "weatherblightcloud" };
|
||||
SettingValue<VFS::Path::Normalized> mWeathersnow{ mIndex, "Models", "weathersnow" };
|
||||
SettingValue<VFS::Path::Normalized> mWeatherblizzard{ mIndex, "Models", "weatherblizzard" };
|
||||
SettingValue<bool> mWriteNifDebugLog{ mIndex, "Models", "write nif debug log" };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <components/detournavigator/collisionshapetype.hpp>
|
||||
#include <components/sceneutil/lightingmethod.hpp>
|
||||
#include <components/sdlutil/vsyncmode.hpp>
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <set>
|
||||
|
@ -263,6 +264,13 @@ namespace Settings
|
|||
return SDLUtil::VSyncMode::Disabled;
|
||||
return static_cast<SDLUtil::VSyncMode>(value);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline VFS::Path::Normalized Manager::getImpl<VFS::Path::Normalized>(
|
||||
std::string_view setting, std::string_view category)
|
||||
{
|
||||
return VFS::Path::Normalized(getString(setting, category));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // COMPONENTS_SETTINGS_H
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include "sanitizer.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
#include "components/debug/debuglog.hpp"
|
||||
#include "components/detournavigator/collisionshapetype.hpp"
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/detournavigator/collisionshapetype.hpp>
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
|
@ -44,6 +45,7 @@ namespace Settings
|
|||
HrtfMode,
|
||||
WindowMode,
|
||||
VSyncMode,
|
||||
NormalizedPath,
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
@ -175,6 +177,12 @@ namespace Settings
|
|||
return SettingValueType::VSyncMode;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline constexpr SettingValueType getSettingValueType<VFS::Path::Normalized>()
|
||||
{
|
||||
return SettingValueType::NormalizedPath;
|
||||
}
|
||||
|
||||
inline constexpr std::string_view getSettingValueTypeName(SettingValueType type)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -221,6 +229,8 @@ namespace Settings
|
|||
return "window mode";
|
||||
case SettingValueType::VSyncMode:
|
||||
return "vsync mode";
|
||||
case SettingValueType::NormalizedPath:
|
||||
return "normalized path";
|
||||
}
|
||||
return "unsupported";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue