Remove NIFFile settings manager dependency

pull/593/head
Alexei Dobrohotov 4 years ago
parent 35115f2f24
commit c857588ee9

@ -132,6 +132,7 @@ int main(int argc, char **argv)
if(!parseOptions (argc, argv, files)) if(!parseOptions (argc, argv, files))
return 1; return 1;
Nif::NIFFile::setLoadUnsupportedFiles(true);
// std::cout << "Reading Files" << std::endl; // std::cout << "Reading Files" << std::endl;
for(std::vector<std::string>::const_iterator it=files.begin(); it!=files.end(); ++it) for(std::vector<std::string>::const_iterator it=files.begin(); it!=files.end(); ++it)
{ {

@ -361,6 +361,7 @@ namespace MWRender
mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor|Mask_SimpleWater)); mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor|Mask_SimpleWater));
NifOsg::Loader::setHiddenNodeMask(Mask_UpdateVisitor); NifOsg::Loader::setHiddenNodeMask(Mask_UpdateVisitor);
NifOsg::Loader::setIntersectionDisabledNodeMask(Mask_Effect); NifOsg::Loader::setIntersectionDisabledNodeMask(Mask_Effect);
Nif::NIFFile::setLoadUnsupportedFiles(Settings::Manager::getBool("load unsupported nif files", "Models"));
mNearClip = Settings::Manager::getFloat("near clip", "Camera"); mNearClip = Settings::Manager::getFloat("near clip", "Camera");
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera"); mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");

@ -5,8 +5,6 @@
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <components/settings/settings.hpp>
namespace Nif namespace Nif
{ {
@ -182,8 +180,7 @@ void NIFFile::parse(Files::IStreamPtr stream)
} }
if (!supported) if (!supported)
{ {
static const bool ignoreUnsupported = Settings::Manager::getBool("load unsupported nif files", "Models"); if (sLoadUnsupportedFiles)
if (ignoreUnsupported)
warn("Unsupported NIF version: " + printVersion(ver) + ". Proceed with caution!"); warn("Unsupported NIF version: " + printVersion(ver) + ". Proceed with caution!");
else else
fail("Unsupported NIF version: " + printVersion(ver)); fail("Unsupported NIF version: " + printVersion(ver));
@ -331,4 +328,11 @@ bool NIFFile::getUseSkinning() const
return mUseSkinning; return mUseSkinning;
} }
bool NIFFile::sLoadUnsupportedFiles = false;
void NIFFile::setLoadUnsupportedFiles(bool load)
{
sLoadUnsupportedFiles = load;
}
} }

@ -62,6 +62,8 @@ class NIFFile final : public File
bool mUseSkinning = false; bool mUseSkinning = false;
static bool sLoadUnsupportedFiles;
/// Parse the file /// Parse the file
void parse(Files::IStreamPtr stream); void parse(Files::IStreamPtr stream);
@ -149,6 +151,8 @@ public:
/// Get the Bethesda version of the NIF format used /// Get the Bethesda version of the NIF format used
unsigned int getBethVersion() const override { return bethVer; } unsigned int getBethVersion() const override { return bethVer; }
static void setLoadUnsupportedFiles(bool load);
}; };
using NIFFilePtr = std::shared_ptr<const Nif::NIFFile>; using NIFFilePtr = std::shared_ptr<const Nif::NIFFile>;

Loading…
Cancel
Save