From 9b27ec4945d7a1f35ca7dc678935849076183c74 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 26 Feb 2017 22:39:23 +0100 Subject: [PATCH] Remove redundant and ambiguous NiNode::makeBone() Ambiguous because a skeleton can have multiple skinned meshes, with their own bone weights/bind matrix each. --- components/nif/data.cpp | 4 +--- components/nif/node.hpp | 25 ++++--------------------- components/nifosg/nifloader.cpp | 2 +- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/components/nif/data.cpp b/components/nif/data.cpp index 0813ab36b..a6721fde1 100644 --- a/components/nif/data.cpp +++ b/components/nif/data.cpp @@ -23,13 +23,11 @@ void NiSkinInstance::post(NIFFile *nif) if(bnum != data->bones.size()) nif->fail("Mismatch in NiSkinData bone count"); - root->makeRootBone(&data->trafo); - for(size_t i=0; ifail("Oops: Missing bone! Don't know how to handle this."); - bones[i]->makeBone(i, data->bones[i]); + bones[i]->setBone(); } } diff --git a/components/nif/node.hpp b/components/nif/node.hpp index 17b58bd46..c32969d1b 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -55,8 +55,7 @@ public: parent = NULL; - boneTrafo = NULL; - boneIndex = -1; + isBone = false; } void post(NIFFile *nif) @@ -69,27 +68,11 @@ public: // NiNodes (or types derived from NiNodes) can be parents. NiNode *parent; - // Bone transformation. If set, node is a part of a skeleton. - const Transformation *boneTrafo; + bool isBone; - // Bone weight info, from NiSkinData - const NiSkinData::BoneInfo *boneInfo; - - // Bone index. If -1, this node is either not a bone, or if - // boneTrafo is set it is the root bone in the skeleton. - short boneIndex; - - void makeRootBone(const Transformation *tr) - { - boneTrafo = tr; - boneIndex = -1; - } - - void makeBone(short ind, const NiSkinData::BoneInfo &bi) + void setBone() { - boneInfo = &bi; - boneTrafo = &bi.trafo; - boneIndex = ind; + isBone = true; } }; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index d60920fe8..afe38b9bc 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -542,7 +542,7 @@ namespace NifOsg dataVariance = (nifNode->controller.empty() ? osg::Object::STATIC : osg::Object::DYNAMIC); } - if (nifNode->boneTrafo || nifNode->boneIndex != -1) + if (nifNode->isBone) dataVariance = osg::Object::DYNAMIC; break;