Skip to content

Commit

Permalink
Merge pull request OpenMW#2417 from Capostrophic/switchnode
Browse files Browse the repository at this point in the history
Use NiSwitchNode initial index field
  • Loading branch information
akortunov authored Jun 9, 2019
2 parents ef2a716 + 7c8360d commit 747b5fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion components/nif/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

Expand Down
4 changes: 1 addition & 3 deletions components/nifosg/nifloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 747b5fb

Please sign in to comment.