History

Only add each texture once.

Andrzej Kapolka committed 12 years ago

Commit 432df1b1 parent 983a3af1 file · +7 −2Browse files

Showing the changes to interface/src/ModelUploader.cpp (1 of 1 file). Show all

Unified · Split

interface/src/ModelUploader.cpp+7−2
@@ -424,19 +424,24 @@ void ModelUploader::processCheck() { · 423 unmodified lines
424424 }
425425
426426 bool ModelUploader::addTextures(const QString& texdir, const FBXGeometry& geometry) {
427+ QSet<QByteArray> added;
427428 foreach (FBXMesh mesh, geometry.meshes) {
428429 foreach (FBXMeshPart part, mesh.parts) {
429− if (!part.diffuseTexture.filename.isEmpty() && part.diffuseTexture.content.isEmpty()) {
430+ if (!part.diffuseTexture.filename.isEmpty() && part.diffuseTexture.content.isEmpty() &&
431+ !added.contains(part.diffuseTexture.filename)) {
430432 if (!addPart(texdir + "/" + part.diffuseTexture.filename,
431433 QString("texture%1").arg(++_texturesCount), true)) {
432434 return false;
433435 }
436+ added.insert(part.diffuseTexture.filename);
434437 }
435− if (!part.normalTexture.filename.isEmpty() && part.normalTexture.content.isEmpty()) {
438+ if (!part.normalTexture.filename.isEmpty() && part.normalTexture.content.isEmpty() &&
439+ !added.contains(part.normalTexture.filename)) {
436440 if (!addPart(texdir + "/" + part.normalTexture.filename,
437441 QString("texture%1").arg(++_texturesCount), true)) {
438442 return false;
439443 }
444+ added.insert(part.normalTexture.filename);
440445 }
441446 }
442447 }