From caa93f767b18731285d7d29d34319b0a3e9d0b5f Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 25 Mar 2015 18:41:37 +0100 Subject: [PATCH] Skip creating meshes for hidden nodes with no VisControllers There's quite a bit of garbage in base_anim.nif, so this change should result in a much leaner scene graph. --- components/nifosg/nifloader.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 17a669312..bdd40e245 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -562,10 +562,20 @@ namespace NifOsg transformNode->setNodeMask(0x1); } - // We could probably skip hidden nodes entirely if they don't have a VisController that + // We can skip creating meshes for hidden nodes if they don't have a VisController that // might make them visible later if (nifNode->flags & Nif::NiNode::Flag_Hidden) - transformNode->setNodeMask(0x1); // Leave mask for UpdateVisitor enabled + { + bool hasVisController = false; + for (Nif::ControllerPtr ctrl = nifNode->controller; !ctrl.empty(); ctrl = ctrl->next) + hasVisController = (ctrl->recType == Nif::RC_NiVisController); + + if (!hasVisController) + skipMeshes = true; // skip child meshes, but still create the child node hierarchy for animating collision shapes + + // now hide this node, but leave the mask for UpdateVisitor enabled so that KeyframeController works + transformNode->setNodeMask(0x1); + } applyNodeProperties(nifNode, transformNode, boundTextures, animflags);