mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:49:58 +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,
|
const Fallback::Map* fallback,
|
||||||
ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager,
|
ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager,
|
||||||
const std::vector<std::string>& blacklistedScripts)
|
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),
|
mTools (*this, encoding),
|
||||||
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
||||||
(savePath.filename().string() + ".project")),
|
(savePath.filename().string() + ".project")),
|
||||||
|
|
|
@ -62,9 +62,9 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
|
||||||
return number;
|
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),
|
: 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()))
|
mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS()))
|
||||||
{
|
{
|
||||||
mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string());
|
mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string());
|
||||||
|
@ -1218,8 +1218,7 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
||||||
|
|
||||||
void CSMWorld::Data::assetsChanged()
|
void CSMWorld::Data::assetsChanged()
|
||||||
{
|
{
|
||||||
VFS::Manager* vfs = mResourcesManager.getVFS();
|
mVFS->rebuildIndex();
|
||||||
vfs->rebuildIndex();
|
|
||||||
|
|
||||||
ResourceTable* meshTable = static_cast<ResourceTable*>(getTableModel(UniversalId::Type_Meshes));
|
ResourceTable* meshTable = static_cast<ResourceTable*>(getTableModel(UniversalId::Type_Meshes));
|
||||||
ResourceTable* iconTable = static_cast<ResourceTable*>(getTableModel(UniversalId::Type_Icons));
|
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
|
const VFS::Manager* CSMWorld::Data::getVFS() const
|
||||||
{
|
{
|
||||||
return mResourcesManager.getVFS();
|
return mVFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Fallback::Map* CSMWorld::Data::getFallbackMap() const
|
const Fallback::Map* CSMWorld::Data::getFallbackMap() const
|
||||||
|
|
|
@ -108,6 +108,7 @@ namespace CSMWorld
|
||||||
RefCollection mRefs;
|
RefCollection mRefs;
|
||||||
IdCollection<ESM::Filter> mFilters;
|
IdCollection<ESM::Filter> mFilters;
|
||||||
Collection<MetaData> mMetaData;
|
Collection<MetaData> mMetaData;
|
||||||
|
VFS::Manager* mVFS;
|
||||||
ResourcesManager& mResourcesManager;
|
ResourcesManager& mResourcesManager;
|
||||||
const Fallback::Map* mFallbackMap;
|
const Fallback::Map* mFallbackMap;
|
||||||
std::vector<QAbstractItemModel *> mModels;
|
std::vector<QAbstractItemModel *> mModels;
|
||||||
|
@ -140,7 +141,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
public:
|
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();
|
virtual ~Data();
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,19 @@ void CSMWorld::ResourcesManager::addResources (const Resources& 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;
|
mVFS = vfs;
|
||||||
mResources.clear();
|
mResources.clear();
|
||||||
|
|
||||||
// maybe we could go over the osgDB::Registry to list all supported node formats
|
addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, getMeshExtensions()));
|
||||||
|
|
||||||
static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 };
|
|
||||||
|
|
||||||
addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, sMeshTypes));
|
|
||||||
addResources (Resources (vfs, "icons", UniversalId::Type_Icon));
|
addResources (Resources (vfs, "icons", UniversalId::Type_Icon));
|
||||||
addResources (Resources (vfs, "music", UniversalId::Type_Music));
|
addResources (Resources (vfs, "music", UniversalId::Type_Music));
|
||||||
addResources (Resources (vfs, "sound", UniversalId::Type_SoundRes));
|
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));
|
addResources (Resources (vfs, "videos", UniversalId::Type_Video));
|
||||||
}
|
}
|
||||||
|
|
||||||
VFS::Manager* CSMWorld::ResourcesManager::getVFS() const
|
const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const
|
||||||
{
|
{
|
||||||
return mVFS;
|
return mVFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::ResourcesManager::recreateResources()
|
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();
|
std::map<UniversalId::Type, Resources>::iterator it = mResources.begin();
|
||||||
for ( ; it != mResources.end(); ++it)
|
for ( ; it != mResources.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->first == UniversalId::Type_Mesh)
|
if (it->first == UniversalId::Type_Mesh)
|
||||||
it->second.recreate(mVFS, sMeshTypes);
|
it->second.recreate(mVFS, getMeshExtensions());
|
||||||
else
|
else
|
||||||
it->second.recreate(mVFS);
|
it->second.recreate(mVFS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,21 @@ namespace CSMWorld
|
||||||
class ResourcesManager
|
class ResourcesManager
|
||||||
{
|
{
|
||||||
std::map<UniversalId::Type, Resources> mResources;
|
std::map<UniversalId::Type, Resources> mResources;
|
||||||
VFS::Manager* mVFS;
|
const VFS::Manager* mVFS;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void addResources (const Resources& resources);
|
void addResources (const Resources& resources);
|
||||||
|
|
||||||
|
const char * const * getMeshExtensions();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ResourcesManager();
|
ResourcesManager();
|
||||||
|
|
||||||
VFS::Manager* getVFS() const;
|
const VFS::Manager* getVFS() const;
|
||||||
|
|
||||||
void setVFS(VFS::Manager* vfs);
|
void setVFS(const VFS::Manager* vfs);
|
||||||
|
|
||||||
void recreateResources();
|
void recreateResources();
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <osgDB/Registry>
|
|
||||||
|
|
||||||
#include "scenemanager.hpp"
|
#include "scenemanager.hpp"
|
||||||
#include "imagemanager.hpp"
|
#include "imagemanager.hpp"
|
||||||
#include "niffilemanager.hpp"
|
#include "niffilemanager.hpp"
|
||||||
|
|
Loading…
Reference in a new issue