mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
A bit of cleanup
This commit is contained in:
parent
5950b26912
commit
d7744e8b16
6 changed files with 23 additions and 23 deletions
|
@ -275,7 +275,7 @@ CSMDoc::Document::Document (VFS::Manager* vfs, const Files::ConfigurationManager
|
|||
const Fallback::Map* fallback,
|
||||
ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager,
|
||||
const std::vector<std::string>& blacklistedScripts)
|
||||
: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager, fallback, resDir),
|
||||
: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, vfs, resourcesManager, fallback, resDir),
|
||||
mTools (*this, encoding),
|
||||
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
||||
(savePath.filename().string() + ".project")),
|
||||
|
|
|
@ -62,9 +62,9 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
|
|||
return number;
|
||||
}
|
||||
|
||||
CSMWorld::Data::Data (ToUTF8::FromType encoding, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir)
|
||||
CSMWorld::Data::Data (ToUTF8::FromType encoding, VFS::Manager* vfs, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir)
|
||||
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
|
||||
mResourcesManager (resourcesManager), mFallbackMap(fallback),
|
||||
mVFS(vfs), mResourcesManager (resourcesManager), mFallbackMap(fallback),
|
||||
mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS()))
|
||||
{
|
||||
mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string());
|
||||
|
@ -1218,8 +1218,7 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
|||
|
||||
void CSMWorld::Data::assetsChanged()
|
||||
{
|
||||
VFS::Manager* vfs = mResourcesManager.getVFS();
|
||||
vfs->rebuildIndex();
|
||||
mVFS->rebuildIndex();
|
||||
|
||||
ResourceTable* meshTable = static_cast<ResourceTable*>(getTableModel(UniversalId::Type_Meshes));
|
||||
ResourceTable* iconTable = static_cast<ResourceTable*>(getTableModel(UniversalId::Type_Icons));
|
||||
|
@ -1264,7 +1263,7 @@ void CSMWorld::Data::rowsChanged (const QModelIndex& parent, int start, int end)
|
|||
|
||||
const VFS::Manager* CSMWorld::Data::getVFS() const
|
||||
{
|
||||
return mResourcesManager.getVFS();
|
||||
return mVFS;
|
||||
}
|
||||
|
||||
const Fallback::Map* CSMWorld::Data::getFallbackMap() const
|
||||
|
|
|
@ -108,6 +108,7 @@ namespace CSMWorld
|
|||
RefCollection mRefs;
|
||||
IdCollection<ESM::Filter> mFilters;
|
||||
Collection<MetaData> mMetaData;
|
||||
VFS::Manager* mVFS;
|
||||
ResourcesManager& mResourcesManager;
|
||||
const Fallback::Map* mFallbackMap;
|
||||
std::vector<QAbstractItemModel *> mModels;
|
||||
|
@ -140,7 +141,7 @@ namespace CSMWorld
|
|||
|
||||
public:
|
||||
|
||||
Data (ToUTF8::FromType encoding, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir);
|
||||
Data (ToUTF8::FromType encoding, VFS::Manager* vfs, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir);
|
||||
|
||||
virtual ~Data();
|
||||
|
||||
|
|
|
@ -14,16 +14,19 @@ void CSMWorld::ResourcesManager::addResources (const Resources& resources)
|
|||
resources));
|
||||
}
|
||||
|
||||
void CSMWorld::ResourcesManager::setVFS(VFS::Manager *vfs)
|
||||
const char * const * CSMWorld::ResourcesManager::getMeshExtensions()
|
||||
{
|
||||
// maybe we could go over the osgDB::Registry to list all supported node formats
|
||||
static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 };
|
||||
return sMeshTypes;
|
||||
}
|
||||
|
||||
void CSMWorld::ResourcesManager::setVFS(const VFS::Manager *vfs)
|
||||
{
|
||||
mVFS = vfs;
|
||||
mResources.clear();
|
||||
|
||||
// maybe we could go over the osgDB::Registry to list all supported node formats
|
||||
|
||||
static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 };
|
||||
|
||||
addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, sMeshTypes));
|
||||
addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, getMeshExtensions()));
|
||||
addResources (Resources (vfs, "icons", UniversalId::Type_Icon));
|
||||
addResources (Resources (vfs, "music", UniversalId::Type_Music));
|
||||
addResources (Resources (vfs, "sound", UniversalId::Type_SoundRes));
|
||||
|
@ -31,21 +34,18 @@ void CSMWorld::ResourcesManager::setVFS(VFS::Manager *vfs)
|
|||
addResources (Resources (vfs, "videos", UniversalId::Type_Video));
|
||||
}
|
||||
|
||||
VFS::Manager* CSMWorld::ResourcesManager::getVFS() const
|
||||
const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const
|
||||
{
|
||||
return mVFS;
|
||||
}
|
||||
|
||||
void CSMWorld::ResourcesManager::recreateResources()
|
||||
{
|
||||
// TODO make this shared with setVFS function
|
||||
static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 };
|
||||
|
||||
std::map<UniversalId::Type, Resources>::iterator it = mResources.begin();
|
||||
for ( ; it != mResources.end(); ++it)
|
||||
{
|
||||
if (it->first == UniversalId::Type_Mesh)
|
||||
it->second.recreate(mVFS, sMeshTypes);
|
||||
it->second.recreate(mVFS, getMeshExtensions());
|
||||
else
|
||||
it->second.recreate(mVFS);
|
||||
}
|
||||
|
|
|
@ -16,19 +16,21 @@ namespace CSMWorld
|
|||
class ResourcesManager
|
||||
{
|
||||
std::map<UniversalId::Type, Resources> mResources;
|
||||
VFS::Manager* mVFS;
|
||||
const VFS::Manager* mVFS;
|
||||
|
||||
private:
|
||||
|
||||
void addResources (const Resources& resources);
|
||||
|
||||
const char * const * getMeshExtensions();
|
||||
|
||||
public:
|
||||
|
||||
ResourcesManager();
|
||||
|
||||
VFS::Manager* getVFS() const;
|
||||
const VFS::Manager* getVFS() const;
|
||||
|
||||
void setVFS(VFS::Manager* vfs);
|
||||
void setVFS(const VFS::Manager* vfs);
|
||||
|
||||
void recreateResources();
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#include "scenemanager.hpp"
|
||||
#include "imagemanager.hpp"
|
||||
#include "niffilemanager.hpp"
|
||||
|
|
Loading…
Reference in a new issue