Showing the changes to interface/src/ModelUploader.cpp (1 of 7 files). Show all
Unified · Split
| @@ -49,7 +49,7 @@ static const QString TRANSLATION_Z_FIELD = "tz"; · 48 unmodified lines | |||
| 49 | static const QString JOINT_FIELD = "joint"; | 49 | static const QString JOINT_FIELD = "joint"; |
| 50 | static const QString FREE_JOINT_FIELD = "freeJoint"; | 50 | static const QString FREE_JOINT_FIELD = "freeJoint"; |
| 51 | 51 | ||
| 52 | static const QString S3_URL = "http://highfidelity-public.s3-us-west-1.amazonaws.com"; | 52 | static const QString S3_URL = "http://public.highfidelity.io"; |
| 53 | static const QString DATA_SERVER_URL = "https://data-web.highfidelity.io"; | 53 | static const QString DATA_SERVER_URL = "https://data-web.highfidelity.io"; |
| 54 | static const QString MODEL_URL = "/api/v1/models"; | 54 | static const QString MODEL_URL = "/api/v1/models"; |
| 55 | 55 | ||
| @@ -201,12 +201,15 @@ bool ModelUploader::zip() { · 145 unmodified lines | |||
| 201 | mapping = properties.getMapping(); | 201 | mapping = properties.getMapping(); |
| 202 | 202 | ||
| 203 | QByteArray nameField = mapping.value(NAME_FIELD).toByteArray(); | 203 | QByteArray nameField = mapping.value(NAME_FIELD).toByteArray(); |
| 204 | QString urlBase; | ||
| 204 | if (!nameField.isEmpty()) { | 205 | if (!nameField.isEmpty()) { |
| 205 | QHttpPart textPart; | 206 | QHttpPart textPart; |
| 206 | textPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"model_name\""); | 207 | textPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"model_name\""); |
| 207 | textPart.setBody(nameField); | 208 | textPart.setBody(nameField); |
| 208 | _dataMultiPart->append(textPart); | 209 | _dataMultiPart->append(textPart); |
| 209 | _url = S3_URL + "/models/" + MODEL_TYPE_NAMES[_modelType] + "/" + nameField + ".fst"; | 210 | urlBase = S3_URL + "/models/" + MODEL_TYPE_NAMES[_modelType] + "/" + nameField; |
| 211 | _url = urlBase + ".fst"; | ||
| 212 | |||
| 210 | } else { | 213 | } else { |
| 211 | QMessageBox::warning(NULL, | 214 | QMessageBox::warning(NULL, |
| 212 | QString("ModelUploader::zip()"), | 215 | QString("ModelUploader::zip()"), |
| @@ -218,6 +221,7 @@ bool ModelUploader::zip() { · 5 unmodified lines | |||
| 218 | 221 | ||
| 219 | QByteArray texdirField = mapping.value(TEXDIR_FIELD).toByteArray(); | 222 | QByteArray texdirField = mapping.value(TEXDIR_FIELD).toByteArray(); |
| 220 | QString texDir; | 223 | QString texDir; |
| 224 | _textureBase = urlBase + "/textures/"; | ||
| 221 | if (!texdirField.isEmpty()) { | 225 | if (!texdirField.isEmpty()) { |
| 222 | texDir = basePath + "/" + texdirField; | 226 | texDir = basePath + "/" + texdirField; |
| 223 | QFileInfo texInfo(texDir); | 227 | QFileInfo texInfo(texDir); |
| @@ -407,6 +411,10 @@ void ModelUploader::processCheck() { · 183 unmodified lines | |||
| 407 | QString("ModelUploader::processCheck()"), | 411 | QString("ModelUploader::processCheck()"), |
| 408 | QString("Your model is now available in the browser."), | 412 | QString("Your model is now available in the browser."), |
| 409 | QMessageBox::Ok); | 413 | QMessageBox::Ok); |
| 414 | Application::getInstance()->getGeometryCache()->refresh(_url); | ||
| 415 | foreach (const QByteArray& filename, _textureFilenames) { | ||
| 416 | Application::getInstance()->getTextureCache()->refresh(_textureBase + filename); | ||
| 417 | } | ||
| 410 | deleteLater(); | 418 | deleteLater(); |
| 411 | break; | 419 | break; |
| 412 | case QNetworkReply::ContentNotFoundError: | 420 | case QNetworkReply::ContentNotFoundError: |
| @@ -428,32 +436,31 @@ void ModelUploader::processCheck() { · 15 unmodified lines | |||
| 428 | } | 436 | } |
| 429 | 437 | ||
| 430 | bool ModelUploader::addTextures(const QString& texdir, const FBXGeometry& geometry) { | 438 | bool ModelUploader::addTextures(const QString& texdir, const FBXGeometry& geometry) { |
| 431 | QSet<QByteArray> added; | ||
| 432 | foreach (FBXMesh mesh, geometry.meshes) { | 439 | foreach (FBXMesh mesh, geometry.meshes) { |
| 433 | foreach (FBXMeshPart part, mesh.parts) { | 440 | foreach (FBXMeshPart part, mesh.parts) { |
| 434 | if (!part.diffuseTexture.filename.isEmpty() && part.diffuseTexture.content.isEmpty() && | 441 | if (!part.diffuseTexture.filename.isEmpty() && part.diffuseTexture.content.isEmpty() && |
| 435 | !added.contains(part.diffuseTexture.filename)) { | 442 | !_textureFilenames.contains(part.diffuseTexture.filename)) { |
| 436 | if (!addPart(texdir + "/" + part.diffuseTexture.filename, | 443 | if (!addPart(texdir + "/" + part.diffuseTexture.filename, |
| 437 | QString("texture%1").arg(++_texturesCount), true)) { | 444 | QString("texture%1").arg(++_texturesCount), true)) { |
| 438 | return false; | 445 | return false; |
| 439 | } | 446 | } |
| 440 | added.insert(part.diffuseTexture.filename); | 447 | _textureFilenames.insert(part.diffuseTexture.filename); |
| 441 | } | 448 | } |
| 442 | if (!part.normalTexture.filename.isEmpty() && part.normalTexture.content.isEmpty() && | 449 | if (!part.normalTexture.filename.isEmpty() && part.normalTexture.content.isEmpty() && |
| 443 | !added.contains(part.normalTexture.filename)) { | 450 | !_textureFilenames.contains(part.normalTexture.filename)) { |
| 444 | if (!addPart(texdir + "/" + part.normalTexture.filename, | 451 | if (!addPart(texdir + "/" + part.normalTexture.filename, |
| 445 | QString("texture%1").arg(++_texturesCount), true)) { | 452 | QString("texture%1").arg(++_texturesCount), true)) { |
| 446 | return false; | 453 | return false; |
| 447 | } | 454 | } |
| 448 | added.insert(part.normalTexture.filename); | 455 | _textureFilenames.insert(part.normalTexture.filename); |
| 449 | } | 456 | } |
| 450 | if (!part.specularTexture.filename.isEmpty() && part.specularTexture.content.isEmpty() && | 457 | if (!part.specularTexture.filename.isEmpty() && part.specularTexture.content.isEmpty() && |
| 451 | !added.contains(part.specularTexture.filename)) { | 458 | !_textureFilenames.contains(part.specularTexture.filename)) { |
| 452 | if (!addPart(texdir + "/" + part.specularTexture.filename, | 459 | if (!addPart(texdir + "/" + part.specularTexture.filename, |
| 453 | QString("texture%1").arg(++_texturesCount), true)) { | 460 | QString("texture%1").arg(++_texturesCount), true)) { |
| 454 | return false; | 461 | return false; |
| 455 | } | 462 | } |
| 456 | added.insert(part.specularTexture.filename); | 463 | _textureFilenames.insert(part.specularTexture.filename); |
| 457 | } | 464 | } |
| 458 | } | 465 | } |
| 459 | } | 466 | } |