diff options
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloatermodeluploadbase.h | 6 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.h | 4 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.h | 7 | ||||
-rw-r--r-- | indra/newview/lluploadfloaterobservers.h | 18 |
7 files changed, 71 insertions, 13 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 7587cf0459..a79f3404cb 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -575,7 +575,7 @@ void LLFloaterModelPreview::onClickCalculateBtn() LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mUploadModelUrl, false); - thread->setObserverHandle(getWholeModelFeeObserverHandle()); + thread->setFeeObserverHandle(getWholeModelFeeObserverHandle()); gMeshRepo.mUploadWaitList.push_back(thread); diff --git a/indra/newview/llfloatermodeluploadbase.h b/indra/newview/llfloatermodeluploadbase.h index bb5e710273..6d1282dbd6 100644 --- a/indra/newview/llfloatermodeluploadbase.h +++ b/indra/newview/llfloatermodeluploadbase.h @@ -29,7 +29,7 @@ #include "lluploadfloaterobservers.h" -class LLFloaterModelUploadBase : public LLFloater, public LLUploadPermissionsObserver, public LLWholeModelFeeObserver +class LLFloaterModelUploadBase : public LLFloater, public LLUploadPermissionsObserver, public LLWholeModelFeeObserver, public LLWholeModelUploadObserver { public: @@ -45,6 +45,10 @@ public: virtual void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) = 0; + virtual void onModelUploadSuccess() {}; + + virtual void onModelUploadFailure() {}; + protected: // requests agent's permissions to upload model diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 254c54ad2a..71baa0fa76 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -274,7 +274,7 @@ void LLFloaterModelWizard::onClickCalculateUploadFee() LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, true, false, false, mUploadModelUrl, false); - thread->setObserverHandle(getWholeModelFeeObserverHandle()); + thread->setFeeObserverHandle(getWholeModelFeeObserverHandle()); gMeshRepo.mUploadWaitList.push_back(thread); } @@ -514,6 +514,19 @@ void LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(U32 status, const std:: llwarns << "LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; } +/*virtual*/ +void LLFloaterModelWizard::onModelUploadSuccess() +{ + // success! + setState(UPLOAD); +} + +/*virtual*/ +void LLFloaterModelWizard::onModelUploadFailure() +{ + +} + //static void LLFloaterModelWizard::executePhysicsStage(std::string stage_name) { @@ -695,11 +708,12 @@ void LLFloaterModelWizard::onUpload() { mModelPreview->rebuildUploadData(); - gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, true, false, false, mUploadModelUrl, true); - - setState(UPLOAD); - + + thread->setUploadObserverHandle(getWholeModelUploadObserverHandle()); + + gMeshRepo.mUploadWaitList.push_back(thread); } void LLFloaterModelWizard::onPreviewLODCommit(LLUICtrl* ctrl) diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index 7057189f86..ea60cf5db8 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -80,6 +80,10 @@ public: /*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason); + /*virtual*/ void onModelUploadSuccess(); + + /*virtual*/ void onModelUploadFailure(); + const LLRect& getPreviewRect() const { return mPreviewRect; } LLPhysicsDecomp::decomp_params mDecompParams; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 31c2d34b8d..ff6c33ac27 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -612,11 +612,13 @@ class LLWholeModelUploadResponder: public LLCurl::Responder { LLMeshUploadThread* mThread; LLSD mModelData; + LLHandle<LLWholeModelUploadObserver> mObserverHandle; public: - LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& model_data): + LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& model_data, LLHandle<LLWholeModelUploadObserver> observer_handle): mThread(thread), - mModelData(model_data) + mModelData(model_data), + mObserverHandle(observer_handle) { } virtual void completed(U32 status, @@ -633,6 +635,9 @@ public: mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num)); llinfos << "LLWholeModelUploadResponder content: " << cc << llendl; + + LLWholeModelUploadObserver* observer = mObserverHandle.get(); + // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. if (isGoodStatus(status) && @@ -641,12 +646,22 @@ public: llinfos << "upload succeeded" << llendl; mModelData["asset_type"] = "object"; gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData,cc)); + + if (observer) + { + observer->onModelUploadSuccess(); + } } else { llwarns << "upload failed" << llendl; std::string model_name = mModelData["name"].asString(); log_upload_error(status,cc,"upload",model_name); + + if (observer) + { + observer->onModelUploadFailure(); + } } } }; @@ -1741,7 +1756,7 @@ void LLMeshUploadThread::doWholeModelUpload() dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num)); LLCurlRequest::headers_t headers; mCurlRequest->post(mWholeModelUploadURL, headers, body, - new LLWholeModelUploadResponder(this, full_model_data), mMeshUploadTimeOut); + new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle), mMeshUploadTimeOut); do { mCurlRequest->process(); @@ -1770,7 +1785,7 @@ void LLMeshUploadThread::requestWholeModelFee() mPendingUploads++; LLCurlRequest::headers_t headers; mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, - new LLWholeModelFeeResponder(this,model_data, mObserverHandle), mMeshUploadTimeOut); + new LLWholeModelFeeResponder(this,model_data, mFeeObserverHandle), mMeshUploadTimeOut); do { diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 03993c6f2c..df342facc0 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -447,10 +447,13 @@ public: LLQuaternion& result_rot, LLVector3& result_scale); - void setObserverHandle(LLHandle<LLWholeModelFeeObserver> observer_handle) { mObserverHandle = observer_handle; } + void setFeeObserverHandle(LLHandle<LLWholeModelFeeObserver> observer_handle) { mFeeObserverHandle = observer_handle; } + void setUploadObserverHandle(LLHandle<LLWholeModelUploadObserver> observer_handle) { mUploadObserverHandle = observer_handle; } private: - LLHandle<LLWholeModelFeeObserver> mObserverHandle; + LLHandle<LLWholeModelFeeObserver> mFeeObserverHandle; + LLHandle<LLWholeModelUploadObserver> mUploadObserverHandle; + bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded }; diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h index fb4be72378..c912c9755a 100644 --- a/indra/newview/lluploadfloaterobservers.h +++ b/indra/newview/lluploadfloaterobservers.h @@ -62,6 +62,24 @@ protected: LLRootHandle<LLWholeModelFeeObserver> mWholeModelFeeObserverHandle; }; + +class LLWholeModelUploadObserver +{ +public: + LLWholeModelUploadObserver() { mWholeModelUploadObserverHandle.bind(this); } + virtual ~LLWholeModelUploadObserver() {} + + virtual void onModelUploadSuccess() = 0; + + virtual void onModelUploadFailure() = 0; + + LLHandle<LLWholeModelUploadObserver> getWholeModelUploadObserverHandle() const { return mWholeModelUploadObserverHandle; } + +protected: + LLRootHandle<LLWholeModelUploadObserver> mWholeModelUploadObserverHandle; +}; + + class LLUploadModelPremissionsResponder : public LLHTTPClient::Responder { public: |