Remove redundant and ambiguous NiNode::makeBone()

Ambiguous because a skeleton can have multiple skinned meshes, with their own bone weights/bind matrix each.
0.6.1
scrawl 8 years ago
parent aba3c471a9
commit 9b27ec4945

@ -23,13 +23,11 @@ void NiSkinInstance::post(NIFFile *nif)
if(bnum != data->bones.size()) if(bnum != data->bones.size())
nif->fail("Mismatch in NiSkinData bone count"); nif->fail("Mismatch in NiSkinData bone count");
root->makeRootBone(&data->trafo);
for(size_t i=0; i<bnum; i++) for(size_t i=0; i<bnum; i++)
{ {
if(bones[i].empty()) if(bones[i].empty())
nif->fail("Oops: Missing bone! Don't know how to handle this."); nif->fail("Oops: Missing bone! Don't know how to handle this.");
bones[i]->makeBone(i, data->bones[i]); bones[i]->setBone();
} }
} }

@ -55,8 +55,7 @@ public:
parent = NULL; parent = NULL;
boneTrafo = NULL; isBone = false;
boneIndex = -1;
} }
void post(NIFFile *nif) void post(NIFFile *nif)
@ -69,27 +68,11 @@ public:
// NiNodes (or types derived from NiNodes) can be parents. // NiNodes (or types derived from NiNodes) can be parents.
NiNode *parent; NiNode *parent;
// Bone transformation. If set, node is a part of a skeleton. bool isBone;
const Transformation *boneTrafo;
// Bone weight info, from NiSkinData void setBone()
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)
{ {
boneInfo = &bi; isBone = true;
boneTrafo = &bi.trafo;
boneIndex = ind;
} }
}; };

@ -542,7 +542,7 @@ namespace NifOsg
dataVariance = (nifNode->controller.empty() ? osg::Object::STATIC : osg::Object::DYNAMIC); dataVariance = (nifNode->controller.empty() ? osg::Object::STATIC : osg::Object::DYNAMIC);
} }
if (nifNode->boneTrafo || nifNode->boneIndex != -1) if (nifNode->isBone)
dataVariance = osg::Object::DYNAMIC; dataVariance = osg::Object::DYNAMIC;
break; break;

Loading…
Cancel
Save