|
|
@ -277,11 +277,13 @@ namespace NifOsg
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/// @param filename used for warning messages.
|
|
|
|
/// @param filename used for warning messages.
|
|
|
|
LoaderImpl(const std::string& filename)
|
|
|
|
LoaderImpl(const std::string& filename)
|
|
|
|
: mFilename(filename)
|
|
|
|
: mFilename(filename), mFirstRootTextureIndex(-1), mFoundFirstRootTexturingProperty(false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string mFilename;
|
|
|
|
std::string mFilename;
|
|
|
|
|
|
|
|
size_t mFirstRootTextureIndex;
|
|
|
|
|
|
|
|
bool mFoundFirstRootTexturingProperty;
|
|
|
|
|
|
|
|
|
|
|
|
static void loadKf(Nif::NIFFilePtr nif, KeyframeHolder& target)
|
|
|
|
static void loadKf(Nif::NIFFilePtr nif, KeyframeHolder& target)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -372,26 +374,21 @@ namespace NifOsg
|
|
|
|
void applyNodeProperties(const Nif::Node *nifNode, osg::Node *applyTo, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, std::vector<int>& boundTextures, int animflags)
|
|
|
|
void applyNodeProperties(const Nif::Node *nifNode, osg::Node *applyTo, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, std::vector<int>& boundTextures, int animflags)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const Nif::PropertyList& props = nifNode->props;
|
|
|
|
const Nif::PropertyList& props = nifNode->props;
|
|
|
|
bool foundFirstRootTexturingProperty = false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i <props.length(); ++i)
|
|
|
|
for (size_t i = 0; i <props.length(); ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!props[i].empty())
|
|
|
|
if (!props[i].empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// store the recIndex of the NiTexturingProperty. Used for spells when overriding textures.
|
|
|
|
// Get the lowest numbered recIndex of the NiTexturingProperty root node.
|
|
|
|
// Get the lowest numbered one for the root node. This is what is overridden when a spell
|
|
|
|
// This is what is overridden when a spell effect "particle texture" is used.
|
|
|
|
// effect "particle texture" is used. For non-root nodes we keep setting until we have the highest
|
|
|
|
if (nifNode->parent == NULL && !mFoundFirstRootTexturingProperty && props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
// numbered one, which is the one that displays in the game and can be overridden if it matches the
|
|
|
|
|
|
|
|
// lowest one on the root.
|
|
|
|
|
|
|
|
if (!foundFirstRootTexturingProperty && nifNode->parent == NULL && props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index = props[i].getPtr()->recIndex;
|
|
|
|
mFirstRootTextureIndex = props[i].getPtr()->recIndex;
|
|
|
|
applyTo->setUserValue("overrideIndex", index);
|
|
|
|
mFoundFirstRootTexturingProperty = true;
|
|
|
|
foundFirstRootTexturingProperty = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
else if (props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index = props[i].getPtr()->recIndex;
|
|
|
|
if (props[i].getPtr()->recIndex == mFirstRootTextureIndex)
|
|
|
|
applyTo->setUserValue("NiTexturingPropertyIndex", index);
|
|
|
|
applyTo->setUserValue("overrideFx", 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
handleProperty(props[i].getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
|
|
|
handleProperty(props[i].getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|