From 8accd2cc045e016d6198f13b27001b7b31028da7 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 1 Jul 2011 16:39:49 -0400 Subject: SH-1725 SH-1726 FIX mesh upload wizard & advanced don't handle upload errors gracefully Restructured the code to be a bit cleaner, now have callbacks with appropriate functionality in both the wizard and advanced uploaders. If the upload fails, it requires the user to re-submit the recalculate request. --- indra/newview/llfloatermodelpreview.cpp | 25 +++++++++++++++++-------- indra/newview/llfloatermodelpreview.h | 4 ++++ indra/newview/llfloatermodelwizard.cpp | 19 +++++++------------ indra/newview/llmeshrepository.cpp | 13 +++++++++---- indra/newview/llmeshrepository.h | 6 ++++-- 5 files changed, 41 insertions(+), 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a79f3404cb..7af288be24 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -572,12 +572,10 @@ void LLFloaterModelPreview::onClickCalculateBtn() bool upload_joint_positions = childGetValue("upload_joints").asBoolean(); mUploadModelUrl.clear(); - LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, - childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mUploadModelUrl, false); - thread->setFeeObserverHandle(getWholeModelFeeObserverHandle()); - - gMeshRepo.mUploadWaitList.push_back(thread); + gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mUploadModelUrl, false, + getWholeModelFeeObserverHandle()); toggleCalculateButton(false); mUploadBtn->setEnabled(false); @@ -5352,9 +5350,8 @@ void LLFloaterModelPreview::onUpload(void* user_data) mp->mModelPreview->saveUploadData(upload_skinweights, upload_joint_positions); gMeshRepo.uploadModel(mp->mModelPreview->mUploadData, mp->mModelPreview->mPreviewScale, - mp->childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mp->mUploadModelUrl); - - mp->closeFloater(false); + mp->childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mp->mUploadModelUrl, + true, LLHandle(), mp->getWholeModelUploadObserverHandle()); } @@ -5458,6 +5455,18 @@ void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std: llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; } +/*virtual*/ +void LLFloaterModelPreview::onModelUploadSuccess() +{ + closeFloater(false); +} + +/*virtual*/ +void LLFloaterModelPreview::onModelUploadFailure() +{ + toggleCalculateButton(true); +} + S32 LLFloaterModelPreview::DecompRequest::statusCallback(const char* status, S32 p1, S32 p2) { if (mContinue) diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index eccc9ce1b6..119c593221 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -206,6 +206,10 @@ public: /*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason); + /*virtual*/ void onModelUploadSuccess(); + + /*virtual*/ void onModelUploadFailure(); + protected: friend class LLModelPreview; friend class LLMeshFilePicker; diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 71baa0fa76..230a0b9ef3 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -271,12 +271,9 @@ void LLFloaterModelWizard::onClickCalculateUploadFee() mModelPreview->rebuildUploadData(); mUploadModelUrl.clear(); - LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, - true, false, false, mUploadModelUrl, false); - thread->setFeeObserverHandle(getWholeModelFeeObserverHandle()); - - gMeshRepo.mUploadWaitList.push_back(thread); + gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + true, false, false, mUploadModelUrl, false, getWholeModelFeeObserverHandle()); } void LLFloaterModelWizard::loadModel() @@ -524,7 +521,8 @@ void LLFloaterModelWizard::onModelUploadSuccess() /*virtual*/ void LLFloaterModelWizard::onModelUploadFailure() { - + // Failure. Make the user recalculate fees + setState(PHYSICS); } //static @@ -708,12 +706,9 @@ void LLFloaterModelWizard::onUpload() { mModelPreview->rebuildUploadData(); - LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, - true, false, false, mUploadModelUrl, true); - - thread->setUploadObserverHandle(getWholeModelUploadObserverHandle()); - - gMeshRepo.mUploadWaitList.push_back(thread); + gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + true, false, false, mUploadModelUrl, true, + LLHandle(), getWholeModelUploadObserverHandle()); } void LLFloaterModelWizard::onPreviewLODCommit(LLUICtrl* ctrl) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index ff6c33ac27..689ef407f8 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1410,11 +1410,14 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 } LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload) + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload, + LLHandle fee_observer, LLHandle upload_observer) : LLThread("mesh upload"), mDiscarded(FALSE), mDoUpload(do_upload), - mWholeModelUploadURL(upload_url) + mWholeModelUploadURL(upload_url), + mFeeObserverHandle(fee_observer), + mUploadObserverHandle(upload_observer) { mInstanceList = data; mUploadTextures = upload_textures; @@ -2896,9 +2899,11 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id) void LLMeshRepository::uploadModel(std::vector& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload) + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload, + LLHandle fee_observer, LLHandle upload_observer) { - LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures, upload_skin, upload_joints, upload_url, do_upload); + LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures, upload_skin, upload_joints, upload_url, + do_upload, fee_observer, upload_observer); mUploadWaitList.push_back(thread); } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index df342facc0..3597b96e13 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -413,7 +413,8 @@ public: std::map mTextureMap; LLMeshUploadThread(instance_list& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true); + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true, + LLHandle fee_observer= (LLHandle()), LLHandle upload_observer = (LLHandle())); ~LLMeshUploadThread(); void uploadTexture(LLTextureUploadData& data); @@ -505,7 +506,8 @@ public: LLSD& getMeshHeader(const LLUUID& mesh_id); void uploadModel(std::vector& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true); + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true, + LLHandle fee_observer= (LLHandle()), LLHandle upload_observer = (LLHandle())); S32 getMeshSize(const LLUUID& mesh_id, S32 lod); -- cgit v1.2.3