XPlor/libs/xassets/xpathnodetree.cpp

64 lines
1.1 KiB
C++
Raw Normal View History

2025-08-17 13:14:17 -04:00
#include "xpathnodetree.h"
XPathNodeTree::XPathNodeTree()
2025-09-05 18:35:17 -04:00
: XAsset()
, mAxis(0)
, mDist(0.0f)
, mInfo(new XPathNodeTreeInfo())
{
}
XPathNodeTree::~XPathNodeTree()
{
delete mInfo;
2025-08-17 13:14:17 -04:00
}
void XPathNodeTree::ParseData(QDataStream *aStream) {
if (GetPtr() == -1) {
2025-09-05 18:35:17 -04:00
*aStream
>> mAxis
>> mDist;
2025-08-17 13:14:17 -04:00
// Skip reading the union directly from the stream
// We'll assume we're parsing as children by default
for (int i = 0; i < 2; ++i) {
2025-09-05 18:35:17 -04:00
qint32 treePtr;
*aStream >> treePtr;
2025-08-17 13:14:17 -04:00
}
}
}
2025-09-05 18:35:17 -04:00
void XPathNodeTree::Clear()
{
mAxis = 0;
mDist = 0.0f;
mInfo->Clear();
}
2025-08-17 13:14:17 -04:00
int XPathNodeTree::GetAxis() const {
return mAxis;
}
void XPathNodeTree::SetAxis(int axis) {
mAxis = axis;
}
float XPathNodeTree::GetDist() const {
return mDist;
}
void XPathNodeTree::SetDist(float dist) {
mDist = dist;
}
2025-09-05 18:35:17 -04:00
XPathNodeTreeInfo* XPathNodeTree::GetInfo() const {
2025-08-17 13:14:17 -04:00
return mInfo;
}
2025-09-05 18:35:17 -04:00
void XPathNodeTree::SetInfo(XPathNodeTreeInfo *info) {
2025-08-17 13:14:17 -04:00
if (mInfo != nullptr) {
delete mInfo;
}
2025-09-05 18:35:17 -04:00
mInfo = new XPathNodeTreeInfo(*info);
2025-08-17 13:14:17 -04:00
}