History

After uploading, refresh the uploaded files so that they are immediately redownloaded.

Andrzej Kapolka committed 12 years ago

Commit 363f5451 parent 3329cb77 files · +79 −23Browse files

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

Unified · Split

interface/src/ModelUploader.cpp+16−9
@@ -49,7 +49,7 @@ static const QString TRANSLATION_Z_FIELD = "tz"; · 48 unmodified lines
4949 static const QString JOINT_FIELD = "joint";
5050 static const QString FREE_JOINT_FIELD = "freeJoint";
5151
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";
5353 static const QString DATA_SERVER_URL = "https://data-web.highfidelity.io";
5454 static const QString MODEL_URL = "/api/v1/models";
5555
@@ -201,12 +201,15 @@ bool ModelUploader::zip() { · 145 unmodified lines
201201 mapping = properties.getMapping();
202202
203203 QByteArray nameField = mapping.value(NAME_FIELD).toByteArray();
204+ QString urlBase;
204205 if (!nameField.isEmpty()) {
205206 QHttpPart textPart;
206207 textPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"model_name\"");
207208 textPart.setBody(nameField);
208209 _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+
210213 } else {
211214 QMessageBox::warning(NULL,
212215 QString("ModelUploader::zip()"),
@@ -218,6 +221,7 @@ bool ModelUploader::zip() { · 5 unmodified lines
218221
219222 QByteArray texdirField = mapping.value(TEXDIR_FIELD).toByteArray();
220223 QString texDir;
224+ _textureBase = urlBase + "/textures/";
221225 if (!texdirField.isEmpty()) {
222226 texDir = basePath + "/" + texdirField;
223227 QFileInfo texInfo(texDir);
@@ -407,6 +411,10 @@ void ModelUploader::processCheck() { · 183 unmodified lines
407411 QString("ModelUploader::processCheck()"),
408412 QString("Your model is now available in the browser."),
409413 QMessageBox::Ok);
414+ Application::getInstance()->getGeometryCache()->refresh(_url);
415+ foreach (const QByteArray& filename, _textureFilenames) {
416+ Application::getInstance()->getTextureCache()->refresh(_textureBase + filename);
417+ }
410418 deleteLater();
411419 break;
412420 case QNetworkReply::ContentNotFoundError:
@@ -428,32 +436,31 @@ void ModelUploader::processCheck() { · 15 unmodified lines
428436 }
429437
430438 bool ModelUploader::addTextures(const QString& texdir, const FBXGeometry& geometry) {
431− QSet<QByteArray> added;
432439 foreach (FBXMesh mesh, geometry.meshes) {
433440 foreach (FBXMeshPart part, mesh.parts) {
434441 if (!part.diffuseTexture.filename.isEmpty() && part.diffuseTexture.content.isEmpty() &&
435− !added.contains(part.diffuseTexture.filename)) {
442+ !_textureFilenames.contains(part.diffuseTexture.filename)) {
436443 if (!addPart(texdir + "/" + part.diffuseTexture.filename,
437444 QString("texture%1").arg(++_texturesCount), true)) {
438445 return false;
439446 }
440− added.insert(part.diffuseTexture.filename);
447+ _textureFilenames.insert(part.diffuseTexture.filename);
441448 }
442449 if (!part.normalTexture.filename.isEmpty() && part.normalTexture.content.isEmpty() &&
443− !added.contains(part.normalTexture.filename)) {
450+ !_textureFilenames.contains(part.normalTexture.filename)) {
444451 if (!addPart(texdir + "/" + part.normalTexture.filename,
445452 QString("texture%1").arg(++_texturesCount), true)) {
446453 return false;
447454 }
448− added.insert(part.normalTexture.filename);
455+ _textureFilenames.insert(part.normalTexture.filename);
449456 }
450457 if (!part.specularTexture.filename.isEmpty() && part.specularTexture.content.isEmpty() &&
451− !added.contains(part.specularTexture.filename)) {
458+ !_textureFilenames.contains(part.specularTexture.filename)) {
452459 if (!addPart(texdir + "/" + part.specularTexture.filename,
453460 QString("texture%1").arg(++_texturesCount), true)) {
454461 return false;
455462 }
456− added.insert(part.specularTexture.filename);
463+ _textureFilenames.insert(part.specularTexture.filename);
457464 }
458465 }
459466 }