Merge pull request #15396 from SamGondelman/oven2

Case 22244: Fix oven crash (RC83)
This commit is contained in:
Sam Gondelman 2019-04-18 20:22:36 -07:00 committed by GitHub
commit 2604afa454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -104,13 +104,15 @@ void FBXBaker::rewriteAndBakeSceneModels(const QVector<hfm::Mesh>& meshes, const
int meshIndex = 0;
for (FBXNode& rootChild : _rootNode.children) {
if (rootChild.name == "Objects") {
for (auto object = rootChild.children.begin(); object != rootChild.children.end(); object++) {
auto object = rootChild.children.begin();
while (object != rootChild.children.end()) {
if (object->name == "Geometry") {
if (object->properties.at(2) == "Mesh") {
int meshNum = meshIndexToRuntimeOrder[meshIndex];
replaceMeshNodeWithDraco(*object, dracoMeshes[meshNum], dracoMaterialLists[meshNum]);
meshIndex++;
}
object++;
} else if (object->name == "Model") {
for (FBXNode& modelChild : object->children) {
if (modelChild.name == "Properties60" || modelChild.name == "Properties70") {
@ -136,9 +138,12 @@ void FBXBaker::rewriteAndBakeSceneModels(const QVector<hfm::Mesh>& meshes, const
meshIndex++;
}
}
object++;
} else if (object->name == "Texture" || object->name == "Video") {
// this is an embedded texture, we need to remove it from the FBX
object = rootChild.children.erase(object);
} else {
object++;
}
if (hasErrors()) {

View file

@ -1572,9 +1572,13 @@ void Model::applyMaterialMapping() {
auto& materialMapping = getMaterialMapping();
for (auto& mapping : materialMapping) {
std::set<unsigned int> shapeIDs = getMeshIDsFromMaterialID(QString(mapping.first.c_str()));
auto networkMaterialResource = mapping.second;
if (!networkMaterialResource || shapeIDs.size() == 0) {
if (!networkMaterialResource) {
continue;
}
std::set<unsigned int> shapeIDs = getMeshIDsFromMaterialID(QString(mapping.first.c_str()));
if (shapeIDs.size() == 0) {
continue;
}