1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 19:53:53 +00:00

Store the parents of NIF's nodes

This commit is contained in:
Chris Robinson 2012-07-02 22:49:44 -07:00
parent 046e9686f9
commit 291599c609

View file

@ -31,6 +31,8 @@
namespace Nif namespace Nif
{ {
class NiNode;
/** A Node is an object that's part of the main NIF tree. It has /** A Node is an object that's part of the main NIF tree. It has
parent node (unless it's the root), and transformation (location parent node (unless it's the root), and transformation (location
and rotation) relative to it's parent. and rotation) relative to it's parent.
@ -66,6 +68,8 @@ public:
boundXYZ = nif->getVector(); boundXYZ = nif->getVector();
} }
parent = NULL;
boneTrafo = NULL; boneTrafo = NULL;
boneIndex = -1; boneIndex = -1;
} }
@ -76,6 +80,10 @@ public:
props.post(nif); props.post(nif);
} }
// Parent node, or NULL for the root node. As far as I'm aware, only
// NiNodes (or types derived from NiNodes) can be parents.
NiNode *parent;
// Bone transformation. If set, node is a part of a skeleton. // Bone transformation. If set, node is a part of a skeleton.
const NiSkinData::BoneTrafo *boneTrafo; const NiSkinData::BoneTrafo *boneTrafo;
@ -139,6 +147,9 @@ struct NiNode : Node
Node::post(nif); Node::post(nif);
children.post(nif); children.post(nif);
effects.post(nif); effects.post(nif);
for(size_t i = 0;i < children.length();i++)
children[i].parent = this;
} }
}; };