summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2011-07-01 16:39:49 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2011-07-01 16:39:49 -0400
commit8accd2cc045e016d6198f13b27001b7b31028da7 (patch)
treeed8a5563ce2802a897f0fca7599d4874c8615bc5
parent1716b8428f88989b2b8898e27cc137e7746a4805 (diff)
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.
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp25
-rw-r--r--indra/newview/llfloatermodelpreview.h4
-rw-r--r--indra/newview/llfloatermodelwizard.cpp19
-rwxr-xr-xindra/newview/llmeshrepository.cpp13
-rw-r--r--indra/newview/llmeshrepository.h6
5 files changed, 41 insertions, 26 deletions
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<LLWholeModelFeeObserver>(), 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<LLWholeModelFeeObserver>(), 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<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> 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<LLModelInstance>& 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<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> 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<LLViewerFetchedTexture*, LLTextureUploadData> 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<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
~LLMeshUploadThread();
void uploadTexture(LLTextureUploadData& data);
@@ -505,7 +506,8 @@ public:
LLSD& getMeshHeader(const LLUUID& mesh_id);
void uploadModel(std::vector<LLModelInstance>& 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<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
S32 getMeshSize(const LLUUID& mesh_id, S32 lod);