Merge branch 'niffile' into 'master'

Remove NIFFile settings manager dependency

See merge request OpenMW/openmw!398
pull/3030/head
psi29a 4 years ago
commit ed8342ebc9

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

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

@ -5,8 +5,6 @@
#include <map>
#include <sstream>
#include <components/settings/settings.hpp>
namespace Nif
{
@ -182,8 +180,7 @@ void NIFFile::parse(Files::IStreamPtr stream)
}
if (!supported)
{
static const bool ignoreUnsupported = Settings::Manager::getBool("load unsupported nif files", "Models");
if (ignoreUnsupported)
if (sLoadUnsupportedFiles)
warn("Unsupported NIF version: " + printVersion(ver) + ". Proceed with caution!");
else
fail("Unsupported NIF version: " + printVersion(ver));
@ -331,4 +328,11 @@ bool NIFFile::getUseSkinning() const
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;
static bool sLoadUnsupportedFiles;
/// Parse the file
void parse(Files::IStreamPtr stream);
@ -149,6 +151,8 @@ public:
/// Get the Bethesda version of the NIF format used
unsigned int getBethVersion() const override { return bethVer; }
static void setLoadUnsupportedFiles(bool load);
};
using NIFFilePtr = std::shared_ptr<const Nif::NIFFile>;

Loading…
Cancel
Save