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