Apply UVControllers only for given UV Set (bug #4827)

pull/541/head
Andrei Kortunov 6 years ago
parent f405b1e247
commit b2126c2b6b

@ -22,6 +22,7 @@
Bug #4803: Stray special characters before begin statement break script compilation
Bug #4804: Particle system with the "Has Sizes = false" causes an exception
Bug #4820: Spell absorption is broken
Bug #4827: NiUVController is handled incorrectly
Feature #2229: Improve pathfinding AI
Feature #3442: Default values for fallbacks from ini file
Feature #3610: Option to invert X axis

@ -139,7 +139,7 @@ namespace Nif
{
Controller::read(nif);
nif->getUShort(); // always 0
uvSet = nif->getUShort();
data.read(nif);
}

@ -112,6 +112,7 @@ class NiUVController : public Controller
{
public:
NiUVDataPtr data;
int uvSet;
void read(NIFStream *nif);
void post(NIFFile *nif);

@ -648,9 +648,14 @@ namespace NifOsg
if (ctrl->recType == Nif::RC_NiUVController)
{
const Nif::NiUVController *niuvctrl = static_cast<const Nif::NiUVController*>(ctrl.getPtr());
const int uvSet = niuvctrl->uvSet;
std::set<int> texUnits;
// UVController should work only for textures which use a given UV Set, usually 0.
for (unsigned int i=0; i<boundTextures.size(); ++i)
texUnits.insert(i);
{
if (boundTextures[i] == uvSet)
texUnits.insert(i);
}
osg::ref_ptr<UVController> uvctrl = new UVController(niuvctrl->data.getPtr(), texUnits);
setupController(niuvctrl, uvctrl, animflags);

Loading…
Cancel
Save