From 723c392a73d918f0de7d0a5d455aa76df6eb459f Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 17 Dec 2015 04:05:39 +0100 Subject: [PATCH] NifLoader: fall back to the first UV set when encountering invalid UV set references --- components/nifosg/nifloader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 98512ca5c..5c28bbc7e 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -963,7 +963,9 @@ namespace NifOsg int uvSet = *it; if (uvSet >= (int)data->uvlist.size()) { - std::cerr << "Warning: using an undefined UV set " << uvSet << " on TriShape \"" << triShape->name << "\" in " << mFilename << std::endl; + std::cerr << "Warning: out of bounds UV set " << uvSet << " on TriShape \"" << triShape->name << "\" in " << mFilename << std::endl; + if (data->uvlist.size()) + geometry->setTexCoordArray(textureStage, data->uvlist[0]); continue; }