#include "xcleafbrushnodedata.h"
#include "xcleafbrushnodeleaf.h"

XCLeafBrushNodeData::XCLeafBrushNodeData()
    : XAsset()
    , mLeaf(new XCLeafBrushNodeLeaf())
    , mChildren(new XCLeafBrushNodeChildren())
{
    SetName("C Leaf Brush Node Data");
}

XCLeafBrushNodeData::~XCLeafBrushNodeData()
{
    
}

void XCLeafBrushNodeData::ParseData(XDataStream *aStream) {
    if (GetPtr() == -1) {
        // We need to determine which part of the union to parse
        // For simplicity, we'll assume it's always leaf for now
        mLeaf->ParseData(aStream);
    }
}

void XCLeafBrushNodeData::Clear()
{
    mLeaf->Clear();
    mChildren->Clear();
}

XCLeafBrushNodeLeaf *XCLeafBrushNodeData::GetLeaf() const {
    return mLeaf;
}

void XCLeafBrushNodeData::SetLeaf(XCLeafBrushNodeLeaf& leaf) {
    mLeaf = &leaf;
}

XCLeafBrushNodeChildren* XCLeafBrushNodeData::GetChildren() const {
    return mChildren;
}

void XCLeafBrushNodeData::SetChildren(XCLeafBrushNodeChildren& children) {
    mChildren = &children;
}
