diff --git a/apps/niftest/niftest.cpp b/apps/niftest/niftest.cpp index f848ae330..e9484d5f5 100644 --- a/apps/niftest/niftest.cpp +++ b/apps/niftest/niftest.cpp @@ -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::const_iterator it=files.begin(); it!=files.end(); ++it) { diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 0aef614c8..068b3e46c 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -361,6 +361,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"); diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 8214a8288..06b4a89d0 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -5,8 +5,6 @@ #include #include -#include - 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; +} + } diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 9d8edac26..c6dd8af75 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -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;