Fix part mesh generation variation
Before this commit, the node id and edge id changed when reload from file, then caused the uuid changing and affected the node processing order during mesh generation.master
parent
83cb6383c1
commit
a945612718
|
@ -1250,8 +1250,9 @@ void Document::addFromSnapshot(const Snapshot &snapshot, bool fromPaste)
|
||||||
nodeKv.second.find("z") == nodeKv.second.end() ||
|
nodeKv.second.find("z") == nodeKv.second.end() ||
|
||||||
nodeKv.second.find("partId") == nodeKv.second.end())
|
nodeKv.second.find("partId") == nodeKv.second.end())
|
||||||
continue;
|
continue;
|
||||||
SkeletonNode node;
|
QUuid oldNodeId = QUuid(nodeKv.first);
|
||||||
oldNewIdMap[QUuid(nodeKv.first)] = node.id;
|
SkeletonNode node(nodeMap.find(oldNodeId) == nodeMap.end() ? oldNodeId : QUuid::createUuid());
|
||||||
|
oldNewIdMap[oldNodeId] = node.id;
|
||||||
node.name = valueOfKeyInMapOrEmpty(nodeKv.second, "name");
|
node.name = valueOfKeyInMapOrEmpty(nodeKv.second, "name");
|
||||||
node.radius = valueOfKeyInMapOrEmpty(nodeKv.second, "radius").toFloat();
|
node.radius = valueOfKeyInMapOrEmpty(nodeKv.second, "radius").toFloat();
|
||||||
node.x = valueOfKeyInMapOrEmpty(nodeKv.second, "x").toFloat();
|
node.x = valueOfKeyInMapOrEmpty(nodeKv.second, "x").toFloat();
|
||||||
|
@ -1267,8 +1268,9 @@ void Document::addFromSnapshot(const Snapshot &snapshot, bool fromPaste)
|
||||||
edgeKv.second.find("to") == edgeKv.second.end() ||
|
edgeKv.second.find("to") == edgeKv.second.end() ||
|
||||||
edgeKv.second.find("partId") == edgeKv.second.end())
|
edgeKv.second.find("partId") == edgeKv.second.end())
|
||||||
continue;
|
continue;
|
||||||
SkeletonEdge edge;
|
QUuid oldEdgeId = QUuid(edgeKv.first);
|
||||||
oldNewIdMap[QUuid(edgeKv.first)] = edge.id;
|
SkeletonEdge edge(edgeMap.find(oldEdgeId) == edgeMap.end() ? oldEdgeId : QUuid::createUuid());
|
||||||
|
oldNewIdMap[oldEdgeId] = edge.id;
|
||||||
edge.name = valueOfKeyInMapOrEmpty(edgeKv.second, "name");
|
edge.name = valueOfKeyInMapOrEmpty(edgeKv.second, "name");
|
||||||
edge.partId = oldNewIdMap[QUuid(valueOfKeyInMapOrEmpty(edgeKv.second, "partId"))];
|
edge.partId = oldNewIdMap[QUuid(valueOfKeyInMapOrEmpty(edgeKv.second, "partId"))];
|
||||||
QString fromNodeId = valueOfKeyInMapOrEmpty(edgeKv.second, "from");
|
QString fromNodeId = valueOfKeyInMapOrEmpty(edgeKv.second, "from");
|
||||||
|
|
Loading…
Reference in New Issue