From 7c8360d0f32f14c93fc8343a1c0f01ebedf5fb4c Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sun, 9 Jun 2019 01:58:02 +0300 Subject: [PATCH] Use NiSwitchNode initial index field --- components/nif/node.hpp | 4 +++- components/nifosg/nifloader.cpp | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/nif/node.hpp b/components/nif/node.hpp index d9afbbed71..cc1871d83a 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -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(); } }; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index d6a459b1b1..9945eefb20 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -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(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))