mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:29:13 +02:00
Baking - if mesh extraction or compression fails don't change node
Needed to prevent a null (would-be Draco mesh) node being added.
This commit is contained in:
parent
37ead11cf9
commit
82e43aea11
2 changed files with 31 additions and 31 deletions
|
@ -257,39 +257,40 @@ void FBXBaker::rewriteAndBakeSceneModels() {
|
||||||
} else if (hasWarnings()) {
|
} else if (hasWarnings()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
objectChild.children.push_back(dracoMeshNode);
|
||||||
objectChild.children.push_back(dracoMeshNode);
|
|
||||||
|
|
||||||
static const std::vector<QString> nodeNamesToDelete {
|
static const std::vector<QString> nodeNamesToDelete {
|
||||||
// Node data that is packed into the draco mesh
|
// Node data that is packed into the draco mesh
|
||||||
"Vertices",
|
"Vertices",
|
||||||
"PolygonVertexIndex",
|
"PolygonVertexIndex",
|
||||||
"LayerElementNormal",
|
"LayerElementNormal",
|
||||||
"LayerElementColor",
|
"LayerElementColor",
|
||||||
"LayerElementUV",
|
"LayerElementUV",
|
||||||
"LayerElementMaterial",
|
"LayerElementMaterial",
|
||||||
"LayerElementTexture",
|
"LayerElementTexture",
|
||||||
|
|
||||||
// Node data that we don't support
|
// Node data that we don't support
|
||||||
"Edges",
|
"Edges",
|
||||||
"LayerElementTangent",
|
"LayerElementTangent",
|
||||||
"LayerElementBinormal",
|
"LayerElementBinormal",
|
||||||
"LayerElementSmoothing"
|
"LayerElementSmoothing"
|
||||||
};
|
};
|
||||||
auto& children = objectChild.children;
|
auto& children = objectChild.children;
|
||||||
auto it = children.begin();
|
auto it = children.begin();
|
||||||
while (it != children.end()) {
|
while (it != children.end()) {
|
||||||
auto begin = nodeNamesToDelete.begin();
|
auto begin = nodeNamesToDelete.begin();
|
||||||
auto end = nodeNamesToDelete.end();
|
auto end = nodeNamesToDelete.end();
|
||||||
if (find(begin, end, it->name) != end) {
|
if (find(begin, end, it->name) != end) {
|
||||||
it = children.erase(it);
|
it = children.erase(it);
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // Geometry Object
|
||||||
}
|
|
||||||
|
} // foreach root child
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,7 @@ QByteArray FBXWriter::encodeFBX(const FBXNode& root) {
|
||||||
out.setVersion(QDataStream::Qt_4_5);
|
out.setVersion(QDataStream::Qt_4_5);
|
||||||
|
|
||||||
out.writeRawData(FBX_BINARY_PROLOG, FBX_BINARY_PROLOG.size());
|
out.writeRawData(FBX_BINARY_PROLOG, FBX_BINARY_PROLOG.size());
|
||||||
auto bytes = QByteArray(FBX_HEADER_BYTES_BEFORE_VERSION - FBX_BINARY_PROLOG.size(), '\0');
|
out.writeRawData("\0\x1a", 3); // Blender needs this header component.
|
||||||
out.writeRawData(bytes, bytes.size());
|
|
||||||
|
|
||||||
#ifdef USE_FBX_2016_FORMAT
|
#ifdef USE_FBX_2016_FORMAT
|
||||||
out << FBX_VERSION_2016;
|
out << FBX_VERSION_2016;
|
||||||
|
|
Loading…
Reference in a new issue