refuse to re-bake an already baked FBX

This commit is contained in:
Stephen Birarda 2017-09-14 16:00:20 -07:00
parent 9816070e70
commit 2a62bac4f9
3 changed files with 8 additions and 1 deletions

View file

@ -301,6 +301,11 @@ void FBXBaker::rewriteAndBakeSceneModels() {
auto extractedMesh = FBXReader::extractMesh(objectChild, meshIndex);
auto& mesh = extractedMesh.mesh;
if (mesh.wasCompressed) {
handleError("Cannot re-bake a file that contains compressed mesh");
return;
}
Q_ASSERT(mesh.normals.size() == 0 || mesh.normals.size() == mesh.vertices.size());
Q_ASSERT(mesh.colors.size() == 0 || mesh.colors.size() == mesh.vertices.size());
Q_ASSERT(mesh.texCoords.size() == 0 || mesh.texCoords.size() == mesh.vertices.size());
@ -529,7 +534,7 @@ void FBXBaker::rewriteAndBakeSceneTextures() {
if (textureFileInfo.suffix() == BAKED_TEXTURE_EXT.mid(1)) {
// re-baking an FBX that already references baked textures is a fail
// so we add an error and return from here
handleError("Cannot re-bake a partially baked FBX file that references baked KTX textures");
handleError("Cannot re-bake a file that references compressed textures");
return;
}

View file

@ -234,6 +234,7 @@ public:
unsigned int meshIndex; // the order the meshes appeared in the object file
model::MeshPointer _mesh;
bool wasCompressed { false };
};
class ExtractedMesh {

View file

@ -338,6 +338,7 @@ ExtractedMesh FBXReader::extractMesh(const FBXNode& object, unsigned int& meshIn
}
} else if (child.name == "DracoMesh") {
isDracoMesh = true;
data.extracted.mesh.wasCompressed = true;
// load the draco mesh from the FBX and create a draco::Mesh
draco::Decoder decoder;