1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:23:53 +00:00

Merge pull request #2417 from Capostrophic/switchnode

Use NiSwitchNode initial index field
This commit is contained in:
Andrei Kortunov 2019-06-09 07:41:18 +04:00 committed by GitHub
commit 747b5fbc98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -238,10 +238,12 @@ struct NiRotatingParticles : Node
// A node used as the base to switch between child nodes, such as for LOD levels.
struct NiSwitchNode : public NiNode
{
unsigned int initialIndex;
void read(NIFStream *nif)
{
NiNode::read(nif);
nif->getInt(); // unknown
initialIndex = nif->getUInt();
}
};

View file

@ -629,10 +629,8 @@ namespace NifOsg
if (nifNode->recType == Nif::RC_NiSwitchNode)
{
// show only first child by default
node->asSwitch()->setSingleChildOn(0);
const Nif::NiSwitchNode* niSwitchNode = static_cast<const Nif::NiSwitchNode*>(nifNode);
node->asSwitch()->setSingleChildOn(niSwitchNode->initialIndex);
if (niSwitchNode->name == Constants::NightDayLabel && !SceneUtil::hasUserDescription(rootNode, Constants::NightDayLabel))
rootNode->getOrCreateUserDataContainer()->addDescription(Constants::NightDayLabel);
else if (niSwitchNode->name == Constants::HerbalismLabel && !SceneUtil::hasUserDescription(rootNode, Constants::HerbalismLabel))