From 291599c6098c446d4cf00b9f18342d040f5b59ab Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 2 Jul 2012 22:49:44 -0700 Subject: [PATCH] Store the parents of NIF's nodes --- components/nif/node.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/nif/node.hpp b/components/nif/node.hpp index fe9d10c7a..e4cc9291e 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -31,6 +31,8 @@ namespace Nif { +class NiNode; + /** 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 and rotation) relative to it's parent. @@ -66,6 +68,8 @@ public: boundXYZ = nif->getVector(); } + parent = NULL; + boneTrafo = NULL; boneIndex = -1; } @@ -76,6 +80,10 @@ public: 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. const NiSkinData::BoneTrafo *boneTrafo; @@ -139,6 +147,9 @@ struct NiNode : Node Node::post(nif); children.post(nif); effects.post(nif); + + for(size_t i = 0;i < children.length();i++) + children[i].parent = this; } };