2018-08-27 08:50:40 +00:00
|
|
|
#include <stack>
|
|
|
|
#include <QUuid>
|
|
|
|
#include <QDebug>
|
2018-10-25 00:19:38 +00:00
|
|
|
#include "snapshotxml.h"
|
2018-03-26 12:41:46 +00:00
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
static void saveSkeletonComponent(Snapshot *snapshot, QXmlStreamWriter *writer, const QString &componentId)
|
2018-08-27 08:50:40 +00:00
|
|
|
{
|
|
|
|
const auto findComponent = snapshot->components.find(componentId);
|
|
|
|
if (findComponent == snapshot->components.end())
|
|
|
|
return;
|
|
|
|
auto &component = findComponent->second;
|
|
|
|
writer->writeStartElement("component");
|
|
|
|
std::map<QString, QString>::iterator componentAttributeIterator;
|
|
|
|
QString children;
|
|
|
|
for (componentAttributeIterator = component.begin(); componentAttributeIterator != component.end(); componentAttributeIterator++) {
|
|
|
|
if ("children" == componentAttributeIterator->first) {
|
|
|
|
children = componentAttributeIterator->second;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ("dirty" == componentAttributeIterator->first)
|
|
|
|
continue;
|
|
|
|
writer->writeAttribute(componentAttributeIterator->first, componentAttributeIterator->second);
|
|
|
|
}
|
|
|
|
if (!children.isEmpty()) {
|
|
|
|
for (const auto &childId: children.split(",")) {
|
|
|
|
if (childId.isEmpty())
|
|
|
|
continue;
|
|
|
|
saveSkeletonComponent(snapshot, writer, childId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
void saveSkeletonToXmlStream(Snapshot *snapshot, QXmlStreamWriter *writer)
|
2018-03-26 12:41:46 +00:00
|
|
|
{
|
|
|
|
writer->setAutoFormatting(true);
|
|
|
|
writer->writeStartDocument();
|
|
|
|
|
|
|
|
writer->writeStartElement("canvas");
|
|
|
|
std::map<QString, QString>::iterator canvasIterator;
|
|
|
|
for (canvasIterator = snapshot->canvas.begin(); canvasIterator != snapshot->canvas.end(); canvasIterator++) {
|
|
|
|
writer->writeAttribute(canvasIterator->first, canvasIterator->second);
|
|
|
|
}
|
|
|
|
|
|
|
|
writer->writeStartElement("nodes");
|
|
|
|
std::map<QString, std::map<QString, QString>>::iterator nodeIterator;
|
|
|
|
for (nodeIterator = snapshot->nodes.begin(); nodeIterator != snapshot->nodes.end(); nodeIterator++) {
|
|
|
|
std::map<QString, QString>::iterator nodeAttributeIterator;
|
|
|
|
writer->writeStartElement("node");
|
|
|
|
for (nodeAttributeIterator = nodeIterator->second.begin(); nodeAttributeIterator != nodeIterator->second.end(); nodeAttributeIterator++) {
|
|
|
|
writer->writeAttribute(nodeAttributeIterator->first, nodeAttributeIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
|
|
|
|
writer->writeStartElement("edges");
|
|
|
|
std::map<QString, std::map<QString, QString>>::iterator edgeIterator;
|
|
|
|
for (edgeIterator = snapshot->edges.begin(); edgeIterator != snapshot->edges.end(); edgeIterator++) {
|
|
|
|
std::map<QString, QString>::iterator edgeAttributeIterator;
|
|
|
|
writer->writeStartElement("edge");
|
|
|
|
for (edgeAttributeIterator = edgeIterator->second.begin(); edgeAttributeIterator != edgeIterator->second.end(); edgeAttributeIterator++) {
|
|
|
|
writer->writeAttribute(edgeAttributeIterator->first, edgeAttributeIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
2018-04-09 08:46:06 +00:00
|
|
|
|
|
|
|
writer->writeStartElement("parts");
|
|
|
|
std::map<QString, std::map<QString, QString>>::iterator partIterator;
|
|
|
|
for (partIterator = snapshot->parts.begin(); partIterator != snapshot->parts.end(); partIterator++) {
|
|
|
|
std::map<QString, QString>::iterator partAttributeIterator;
|
|
|
|
writer->writeStartElement("part");
|
|
|
|
for (partAttributeIterator = partIterator->second.begin(); partAttributeIterator != partIterator->second.end(); partAttributeIterator++) {
|
2018-08-27 08:50:40 +00:00
|
|
|
if ("dirty" == partAttributeIterator->first)
|
|
|
|
continue;
|
2018-04-09 08:46:06 +00:00
|
|
|
writer->writeAttribute(partAttributeIterator->first, partAttributeIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
2018-06-15 05:34:41 +00:00
|
|
|
|
2018-08-27 08:50:40 +00:00
|
|
|
const auto &childrenIds = snapshot->rootComponent.find("children");
|
|
|
|
if (childrenIds != snapshot->rootComponent.end()) {
|
|
|
|
writer->writeStartElement("components");
|
|
|
|
for (const auto &componentId: childrenIds->second.split(",")) {
|
|
|
|
if (componentId.isEmpty())
|
|
|
|
continue;
|
|
|
|
saveSkeletonComponent(snapshot, writer, componentId);
|
2018-06-15 05:34:41 +00:00
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
|
2018-10-09 02:19:12 +00:00
|
|
|
writer->writeStartElement("materials");
|
|
|
|
std::vector<std::pair<std::map<QString, QString>, std::vector<std::pair<std::map<QString, QString>, std::vector<std::map<QString, QString>>>>>>::iterator materialIterator;
|
|
|
|
for (materialIterator = snapshot->materials.begin(); materialIterator != snapshot->materials.end(); materialIterator++) {
|
|
|
|
std::map<QString, QString>::iterator materialAttributeIterator;
|
|
|
|
writer->writeStartElement("material");
|
|
|
|
for (materialAttributeIterator = materialIterator->first.begin(); materialAttributeIterator != materialIterator->first.end(); materialAttributeIterator++) {
|
|
|
|
writer->writeAttribute(materialAttributeIterator->first, materialAttributeIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeStartElement("layers");
|
|
|
|
std::vector<std::pair<std::map<QString, QString>, std::vector<std::map<QString, QString>>>>::iterator layerIterator;
|
|
|
|
for (layerIterator = materialIterator->second.begin(); layerIterator != materialIterator->second.end(); layerIterator++) {
|
|
|
|
std::map<QString, QString>::iterator layerAttributeIterator;
|
|
|
|
writer->writeStartElement("layer");
|
|
|
|
for (layerAttributeIterator = layerIterator->first.begin(); layerAttributeIterator != layerIterator->first.end(); layerAttributeIterator++) {
|
|
|
|
writer->writeAttribute(layerAttributeIterator->first, layerAttributeIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeStartElement("maps");
|
|
|
|
std::vector<std::map<QString, QString>>::iterator mapIterator;
|
|
|
|
for (mapIterator = layerIterator->second.begin(); mapIterator != layerIterator->second.end(); mapIterator++) {
|
|
|
|
std::map<QString, QString>::iterator attributesIterator;
|
|
|
|
writer->writeStartElement("map");
|
|
|
|
for (attributesIterator = mapIterator->begin(); attributesIterator != mapIterator->end();
|
|
|
|
attributesIterator++) {
|
|
|
|
writer->writeAttribute(attributesIterator->first, attributesIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
|
2018-09-21 07:10:18 +00:00
|
|
|
writer->writeStartElement("poses");
|
2018-11-09 03:20:48 +00:00
|
|
|
//std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>>::iterator poseIterator;
|
|
|
|
std::vector<std::pair<std::map<QString, QString>, std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>>>>::iterator poseIterator;
|
2018-09-21 07:10:18 +00:00
|
|
|
for (poseIterator = snapshot->poses.begin(); poseIterator != snapshot->poses.end(); poseIterator++) {
|
|
|
|
std::map<QString, QString>::iterator poseAttributeIterator;
|
|
|
|
writer->writeStartElement("pose");
|
2018-10-02 04:59:30 +00:00
|
|
|
for (poseAttributeIterator = poseIterator->first.begin(); poseAttributeIterator != poseIterator->first.end(); poseAttributeIterator++) {
|
|
|
|
writer->writeAttribute(poseAttributeIterator->first, poseAttributeIterator->second);
|
|
|
|
}
|
2018-11-09 03:20:48 +00:00
|
|
|
writer->writeStartElement("frames");
|
|
|
|
std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>>::iterator frameIterator;
|
|
|
|
for (frameIterator = poseIterator->second.begin(); frameIterator != poseIterator->second.end(); frameIterator++) {
|
|
|
|
std::map<QString, QString>::iterator frameAttributeIterator;
|
|
|
|
writer->writeStartElement("frame");
|
|
|
|
for (frameAttributeIterator = frameIterator->first.begin(); frameAttributeIterator != frameIterator->first.end(); frameAttributeIterator++) {
|
|
|
|
writer->writeAttribute(frameAttributeIterator->first, frameAttributeIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeStartElement("parameters");
|
|
|
|
std::map<QString, std::map<QString, QString>>::iterator itemsIterator;
|
|
|
|
for (itemsIterator = frameIterator->second.begin(); itemsIterator != frameIterator->second.end(); itemsIterator++) {
|
|
|
|
std::map<QString, QString>::iterator parametersIterator;
|
|
|
|
writer->writeStartElement("parameter");
|
|
|
|
writer->writeAttribute("for", itemsIterator->first);
|
|
|
|
for (parametersIterator = itemsIterator->second.begin(); parametersIterator != itemsIterator->second.end();
|
|
|
|
parametersIterator++) {
|
|
|
|
writer->writeAttribute(parametersIterator->first, parametersIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
writer->writeEndElement();
|
2018-10-02 04:59:30 +00:00
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
|
|
|
|
writer->writeStartElement("motions");
|
2018-10-23 14:57:47 +00:00
|
|
|
std::vector<std::pair<std::map<QString, QString>, std::vector<std::map<QString, QString>>>>::iterator motionIterator;
|
2018-10-02 04:59:30 +00:00
|
|
|
for (motionIterator = snapshot->motions.begin(); motionIterator != snapshot->motions.end(); motionIterator++) {
|
|
|
|
std::map<QString, QString>::iterator motionAttributeIterator;
|
|
|
|
writer->writeStartElement("motion");
|
|
|
|
for (motionAttributeIterator = std::get<0>(*motionIterator).begin(); motionAttributeIterator != std::get<0>(*motionIterator).end(); motionAttributeIterator++) {
|
|
|
|
writer->writeAttribute(motionAttributeIterator->first, motionAttributeIterator->second);
|
|
|
|
}
|
2018-10-23 14:57:47 +00:00
|
|
|
writer->writeStartElement("clips");
|
2018-10-02 04:59:30 +00:00
|
|
|
{
|
|
|
|
std::vector<std::map<QString, QString>>::iterator itemsIterator;
|
|
|
|
for (itemsIterator = std::get<1>(*motionIterator).begin(); itemsIterator != std::get<1>(*motionIterator).end(); itemsIterator++) {
|
|
|
|
std::map<QString, QString>::iterator attributesIterator;
|
2018-10-23 14:57:47 +00:00
|
|
|
writer->writeStartElement("clip");
|
2018-10-02 04:59:30 +00:00
|
|
|
for (attributesIterator = itemsIterator->begin(); attributesIterator != itemsIterator->end();
|
|
|
|
attributesIterator++) {
|
|
|
|
writer->writeAttribute(attributesIterator->first, attributesIterator->second);
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
2018-09-21 07:10:18 +00:00
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
writer->writeEndElement();
|
|
|
|
}
|
|
|
|
writer->writeEndElement();
|
|
|
|
|
2018-03-26 12:41:46 +00:00
|
|
|
writer->writeEndElement();
|
|
|
|
|
|
|
|
writer->writeEndDocument();
|
|
|
|
}
|
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
void loadSkeletonFromXmlStream(Snapshot *snapshot, QXmlStreamReader &reader)
|
2018-03-26 12:41:46 +00:00
|
|
|
{
|
2018-08-27 08:50:40 +00:00
|
|
|
std::stack<QString> componentStack;
|
2018-09-14 09:45:05 +00:00
|
|
|
std::vector<QString> elementNameStack;
|
2018-10-09 02:19:12 +00:00
|
|
|
std::pair<std::map<QString, QString>, std::vector<std::map<QString, QString>>> currentMaterialLayer;
|
|
|
|
std::pair<std::map<QString, QString>, std::vector<std::pair<std::map<QString, QString>, std::vector<std::map<QString, QString>>>>> currentMaterial;
|
2018-11-09 03:20:48 +00:00
|
|
|
std::pair<std::map<QString, QString>, std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>>> currentPose;
|
|
|
|
std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>> currentPoseFrame;
|
2018-10-23 14:57:47 +00:00
|
|
|
std::pair<std::map<QString, QString>, std::vector<std::map<QString, QString>>> currentMotion;
|
2018-03-26 12:41:46 +00:00
|
|
|
while (!reader.atEnd()) {
|
|
|
|
reader.readNext();
|
2018-09-21 07:10:18 +00:00
|
|
|
if (!reader.isStartElement() && !reader.isEndElement()) {
|
|
|
|
if (!reader.name().toString().isEmpty())
|
|
|
|
qDebug() << "Skip xml element:" << reader.name().toString() << " tokenType:" << reader.tokenType();
|
2018-09-14 09:45:05 +00:00
|
|
|
continue;
|
2018-09-21 07:10:18 +00:00
|
|
|
}
|
2018-09-14 09:45:05 +00:00
|
|
|
QString baseName = reader.name().toString();
|
|
|
|
if (reader.isStartElement())
|
|
|
|
elementNameStack.push_back(baseName);
|
|
|
|
QStringList nameItems;
|
|
|
|
for (const auto &nameItem: elementNameStack) {
|
|
|
|
nameItems.append(nameItem);
|
|
|
|
}
|
|
|
|
QString fullName = nameItems.join(".");
|
|
|
|
if (reader.isEndElement())
|
|
|
|
elementNameStack.pop_back();
|
2018-09-21 07:10:18 +00:00
|
|
|
//qDebug() << (reader.isStartElement() ? "<" : ">") << "fullName:" << fullName << "baseName:" << baseName;
|
2018-03-26 12:41:46 +00:00
|
|
|
if (reader.isStartElement()) {
|
2018-09-14 09:45:05 +00:00
|
|
|
if (fullName == "canvas") {
|
2018-03-26 12:41:46 +00:00
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
snapshot->canvas[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-09-14 09:45:05 +00:00
|
|
|
} else if (fullName == "canvas.nodes.node") {
|
2018-03-26 12:41:46 +00:00
|
|
|
QString nodeId = reader.attributes().value("id").toString();
|
2018-04-09 08:46:06 +00:00
|
|
|
if (nodeId.isEmpty())
|
|
|
|
continue;
|
2018-03-26 12:41:46 +00:00
|
|
|
std::map<QString, QString> *nodeMap = &snapshot->nodes[nodeId];
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
(*nodeMap)[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-09-14 09:45:05 +00:00
|
|
|
} else if (fullName == "canvas.edges.edge") {
|
2018-04-09 08:46:06 +00:00
|
|
|
QString edgeId = reader.attributes().value("id").toString();
|
|
|
|
if (edgeId.isEmpty())
|
|
|
|
continue;
|
|
|
|
std::map<QString, QString> *edgeMap = &snapshot->edges[edgeId];
|
2018-03-26 12:41:46 +00:00
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
(*edgeMap)[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-09-14 09:45:05 +00:00
|
|
|
} else if (fullName == "canvas.parts.part") {
|
2018-04-09 08:46:06 +00:00
|
|
|
QString partId = reader.attributes().value("id").toString();
|
|
|
|
if (partId.isEmpty())
|
|
|
|
continue;
|
|
|
|
std::map<QString, QString> *partMap = &snapshot->parts[partId];
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
(*partMap)[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-09-14 09:45:05 +00:00
|
|
|
} else if (fullName == "canvas.partIdList.partId") {
|
2018-04-09 08:46:06 +00:00
|
|
|
QString partId = reader.attributes().value("id").toString();
|
|
|
|
if (partId.isEmpty())
|
|
|
|
continue;
|
2018-08-27 08:50:40 +00:00
|
|
|
QString componentId = QUuid::createUuid().toString();
|
|
|
|
auto &component = snapshot->components[componentId];
|
|
|
|
component["id"] = componentId;
|
|
|
|
component["linkData"] = partId;
|
|
|
|
component["linkDataType"] = "partId";
|
|
|
|
auto &childrenIds = snapshot->rootComponent["children"];
|
|
|
|
if (!childrenIds.isEmpty())
|
|
|
|
childrenIds += ",";
|
|
|
|
childrenIds += componentId;
|
2018-09-14 09:45:05 +00:00
|
|
|
} else if (fullName.startsWith("canvas.components.component")) {
|
2018-08-27 08:50:40 +00:00
|
|
|
QString componentId = reader.attributes().value("id").toString();
|
|
|
|
QString parentId;
|
|
|
|
if (!componentStack.empty())
|
|
|
|
parentId = componentStack.top();
|
|
|
|
componentStack.push(componentId);
|
|
|
|
if (componentId.isEmpty())
|
|
|
|
continue;
|
|
|
|
std::map<QString, QString> *componentMap = &snapshot->components[componentId];
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
(*componentMap)[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
|
|
|
auto &parentChildrenIds = parentId.isEmpty() ? snapshot->rootComponent["children"] : snapshot->components[parentId]["children"];
|
|
|
|
if (!parentChildrenIds.isEmpty())
|
|
|
|
parentChildrenIds += ",";
|
|
|
|
parentChildrenIds += componentId;
|
2018-10-09 02:19:12 +00:00
|
|
|
} else if (fullName == "canvas.materials.material.layers.layer") {
|
|
|
|
currentMaterialLayer = decltype(currentMaterialLayer)();
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
currentMaterialLayer.first[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
|
|
|
} else if (fullName == "canvas.materials.material.layers.layer.maps.map") {
|
|
|
|
std::map<QString, QString> attributes;
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
attributes[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
|
|
|
currentMaterialLayer.second.push_back(attributes);
|
|
|
|
} else if (fullName == "canvas.materials.material") {
|
|
|
|
QString materialId = reader.attributes().value("id").toString();
|
|
|
|
if (materialId.isEmpty())
|
|
|
|
continue;
|
|
|
|
currentMaterial = decltype(currentMaterial)();
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
currentMaterial.first[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-09-21 07:10:18 +00:00
|
|
|
} else if (fullName == "canvas.poses.pose") {
|
|
|
|
QString poseId = reader.attributes().value("id").toString();
|
|
|
|
if (poseId.isEmpty())
|
|
|
|
continue;
|
|
|
|
currentPose = decltype(currentPose)();
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
currentPose.first[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-11-09 03:20:48 +00:00
|
|
|
} else if (fullName == "canvas.poses.pose.frames.frame") {
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
currentPoseFrame.first[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
|
|
|
} else if (fullName == "canvas.poses.pose.frames.frame.parameters.parameter") {
|
2018-09-21 07:10:18 +00:00
|
|
|
QString forWhat = reader.attributes().value("for").toString();
|
|
|
|
if (forWhat.isEmpty())
|
|
|
|
continue;
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
if ("for" == attr.name().toString())
|
|
|
|
continue;
|
2018-11-09 03:20:48 +00:00
|
|
|
currentPoseFrame.second[forWhat][attr.name().toString()] = attr.value().toString();
|
2018-09-21 07:10:18 +00:00
|
|
|
}
|
2018-10-02 04:59:30 +00:00
|
|
|
} else if (fullName == "canvas.motions.motion") {
|
|
|
|
QString motionId = reader.attributes().value("id").toString();
|
|
|
|
if (motionId.isEmpty())
|
|
|
|
continue;
|
|
|
|
currentMotion = decltype(currentMotion)();
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
2018-10-23 14:57:47 +00:00
|
|
|
currentMotion.first[attr.name().toString()] = attr.value().toString();
|
2018-10-02 04:59:30 +00:00
|
|
|
}
|
2018-10-23 14:57:47 +00:00
|
|
|
} else if (fullName == "canvas.motions.motion.clips.clip") {
|
2018-10-02 04:59:30 +00:00
|
|
|
std::map<QString, QString> attributes;
|
|
|
|
foreach(const QXmlStreamAttribute &attr, reader.attributes()) {
|
|
|
|
attributes[attr.name().toString()] = attr.value().toString();
|
|
|
|
}
|
2018-10-23 14:57:47 +00:00
|
|
|
currentMotion.second.push_back(attributes);
|
2018-08-27 08:50:40 +00:00
|
|
|
}
|
|
|
|
} else if (reader.isEndElement()) {
|
2018-09-14 09:45:05 +00:00
|
|
|
if (fullName.startsWith("canvas.components.component")) {
|
2018-08-27 08:50:40 +00:00
|
|
|
componentStack.pop();
|
2018-10-09 02:19:12 +00:00
|
|
|
} else if (fullName == "canvas.materials.material.layers.layer") {
|
|
|
|
currentMaterial.second.push_back(currentMaterialLayer);
|
|
|
|
} else if (fullName == "canvas.materials.material") {
|
|
|
|
snapshot->materials.push_back(currentMaterial);
|
2018-11-09 03:20:48 +00:00
|
|
|
} else if (fullName == "canvas.poses.pose.frames.frame") {
|
|
|
|
currentPose.second.push_back(currentPoseFrame);
|
2018-09-21 07:10:18 +00:00
|
|
|
} else if (fullName == "canvas.poses.pose") {
|
|
|
|
snapshot->poses.push_back(currentPose);
|
2018-10-02 04:59:30 +00:00
|
|
|
} else if (fullName == "canvas.motions.motion") {
|
|
|
|
snapshot->motions.push_back(currentMotion);
|
2018-03-26 12:41:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|