diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloatermodeluploadbase.h | 14 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.h | 3 | ||||
-rw-r--r-- | indra/newview/lluploadfloaterobservers.h | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_preview.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_wizard.xml | 5 |
8 files changed, 68 insertions, 40 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 38ccd0d682..a79f3404cb 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -397,6 +397,10 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("border_mode", onLODParamCommit, this); childSetCommitCallback("share_tolerance", onLODParamCommit, this); + childSetCommitCallback("upload_skin", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL); + childSetCommitCallback("upload_joints", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL); + childSetCommitCallback("upload_textures", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL); + childSetTextArg("status", "[STATUS]", getString("status_idle")); //childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount)); @@ -445,6 +449,7 @@ BOOL LLFloaterModelPreview::postBuild() mModelPreview = new LLModelPreview(512, 512, this ); mModelPreview->setPreviewTarget(16.f); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); + mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1)); //set callbacks for left click on line editor rows for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) @@ -561,8 +566,6 @@ void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name) void LLFloaterModelPreview::onClickCalculateBtn() { - childSetTextArg("weights", "[EQ]", llformat("%d", mModelPreview->mResourceCost)); - mModelPreview->rebuildUploadData(); bool upload_skinweights = childGetValue("upload_skin").asBoolean(); @@ -577,6 +580,7 @@ void LLFloaterModelPreview::onClickCalculateBtn() gMeshRepo.mUploadWaitList.push_back(thread); toggleCalculateButton(false); + mUploadBtn->setEnabled(false); } //static @@ -653,9 +657,6 @@ void LLFloaterModelPreview::onUploadSkinCommit(LLUICtrl*,void* userdata) { return; } - - fp->toggleCalculateButton(true); - fp->mModelPreview->refresh(); fp->mModelPreview->resetPreviewTarget(); fp->mModelPreview->clearBuffers(); @@ -685,7 +686,6 @@ void LLFloaterModelPreview::onGenerateNormalsCommit(LLUICtrl* ctrl, void* userda { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; - fp->toggleCalculateButton(true); fp->mModelPreview->generateNormals(); } @@ -710,7 +710,6 @@ void LLFloaterModelPreview::onLODParamCommit(LLUICtrl* ctrl, void* userdata) { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; - fp->toggleCalculateButton(true); fp->mModelPreview->onLODParamCommit(false); } @@ -718,7 +717,6 @@ void LLFloaterModelPreview::onLODParamCommit(LLUICtrl* ctrl, void* userdata) void LLFloaterModelPreview::onLODParamCommitTriangleLimit(LLUICtrl* ctrl, void* userdata) { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; - fp->toggleCalculateButton(true); fp->mModelPreview->onLODParamCommit(true); } @@ -750,7 +748,7 @@ void LLFloaterModelPreview::draw() } } - childSetEnabled("ok_btn", mHasUploadPerm); + childSetEnabled("ok_btn", mHasUploadPerm && !mUploadModelUrl.empty()); childSetTextArg("prim_cost", "[PRIM_COST]", llformat("%d", mModelPreview->mResourceCost)); childSetTextArg("description_label", "[TEXTURES]", llformat("%d", mModelPreview->mTextureSet.size())); @@ -4472,6 +4470,8 @@ void LLModelPreview::updateStatusMessages() crease->forceSetValue(mRequestedCreaseAngle[mPreviewLOD]); } + mModelUpdatedSignal(true); + } void LLModelPreview::setPreviewTarget(F32 distance) @@ -5421,11 +5421,17 @@ void LLFloaterModelPreview::setStatusMessage(const std::string& msg) mStatusMessage = msg; } +void LLFloaterModelPreview::toggleCalculateButton() +{ + toggleCalculateButton(true); +} + void LLFloaterModelPreview::toggleCalculateButton(bool visible) { mCalculateBtn->setVisible(visible); mUploadBtn->setVisible(!visible); - mUploadBtn->setEnabled(mHasUploadPerm); + //mUploadBtn->setEnabled(mHasUploadPerm); + mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty()); if (visible) { @@ -5439,13 +5445,16 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) void LLFloaterModelPreview::onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) { mUploadModelUrl = upload_url; + childSetTextArg("weights", "[EQ]", llformat("%d", mModelPreview->mResourceCost)); childSetTextArg("weights", "[PH]", llformat("%.3f", physics)); childSetTextArg("weights", "[FEE]", llformat("%d", fee)); childSetVisible("weights", true); + mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty()); } void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) { + toggleCalculateButton(true); llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; } @@ -5498,7 +5507,8 @@ void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result) // BAP HACK: handle "" for case that MeshUploadFlag cap is broken. mHasUploadPerm = (("" == upload_status) || ("valid" == upload_status)); - mUploadBtn->setEnabled(mHasUploadPerm); + //mUploadBtn->setEnabled(mHasUploadPerm); + mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty()); getChild<LLTextBox>("warning_title")->setVisible(!mHasUploadPerm); getChild<LLTextBox>("warning_message")->setVisible(!mHasUploadPerm); } diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 6d5e46d9e4..eccc9ce1b6 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -273,6 +273,7 @@ protected: private: void onClickCalculateBtn(); + void toggleCalculateButton(); // Toggles between "Calculate weights & fee" and "Upload" buttons. void toggleCalculateButton(bool visible); @@ -297,6 +298,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex { typedef boost::signals2::signal<void (F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)> details_signal_t; typedef boost::signals2::signal<void (void)> model_loaded_signal_t; + typedef boost::signals2::signal<void (bool)> model_updated_signal_t; public: LLModelPreview(S32 width, S32 height, LLFloater* fmp); @@ -356,6 +358,7 @@ public: boost::signals2::connection setDetailsCallback( const details_signal_t::slot_type& cb ){ return mDetailsSignal.connect(cb); } boost::signals2::connection setModelLoadedCallback( const model_loaded_signal_t::slot_type& cb ){ return mModelLoadedSignal.connect(cb); } + boost::signals2::connection setModelUpdatedCallback( const model_updated_signal_t::slot_type& cb ){ return mModelUpdatedSignal.connect(cb); } void setLoadState( U32 state ) { mLoadState = state; } U32 getLoadState() { return mLoadState; } @@ -441,6 +444,7 @@ private: details_signal_t mDetailsSignal; model_loaded_signal_t mModelLoadedSignal; + model_updated_signal_t mModelUpdatedSignal; LLVector3 mModelPivot; bool mHasPivot; diff --git a/indra/newview/llfloatermodeluploadbase.h b/indra/newview/llfloatermodeluploadbase.h index 5671eb1fd0..6d1282dbd6 100644 --- a/indra/newview/llfloatermodeluploadbase.h +++ b/indra/newview/llfloatermodeluploadbase.h @@ -24,8 +24,8 @@ * $/LicenseInfo$ */ -#ifndef LLFLOATERMODELUPLOADBASE_H_ -#define LLFLOATERMODELUPLOADBASE_H_ +#ifndef LL_LLFLOATERMODELUPLOADBASE_H +#define LL_LLFLOATERMODELUPLOADBASE_H #include "lluploadfloaterobservers.h" @@ -37,13 +37,13 @@ public: virtual ~LLFloaterModelUploadBase(){}; - virtual void setPermissonsErrorStatus(U32 status, const std::string& reason){}; + virtual void setPermissonsErrorStatus(U32 status, const std::string& reason) = 0; - virtual void onPermissionsReceived(const LLSD& result){}; + virtual void onPermissionsReceived(const LLSD& result) = 0; - virtual void onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url){}; + virtual void onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) = 0; - virtual void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason){}; + virtual void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) = 0; virtual void onModelUploadSuccess() {}; @@ -58,4 +58,4 @@ protected: bool mHasUploadPerm; }; -#endif /* LLFLOATERMODELUPLOADBASE_H_ */ +#endif /* LL_LLFLOATERMODELUPLOADBASE_H */ diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 8cfd04e461..71baa0fa76 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -162,8 +162,6 @@ void LLFloaterModelWizard::setState(int state) getChildView("cancel")->setVisible(true); mCalculateWeightsBtn->setVisible(false); mCalculatingWeightsBtn->setVisible(false); - - getChildView("upload")->setEnabled(mHasUploadPerm); } if (state == UPLOAD) @@ -414,12 +412,6 @@ BOOL LLFloaterModelWizard::handleScrollWheel(S32 x, S32 y, S32 clicks) } -/*virtual*/ -void LLFloaterModelWizard::onOpen(const LLSD& key) -{ - requestAgentUploadPermissions(); -} - void LLFloaterModelWizard::initDecompControls() { LLSD key; @@ -481,13 +473,11 @@ void LLFloaterModelWizard::initDecompControls() void LLFloaterModelWizard::onPermissionsReceived(const LLSD& result) { std::string upload_status = result["mesh_upload_status"].asString(); - mHasUploadPerm = "valid" == upload_status; + // BAP HACK: handle "" for case that MeshUploadFlag cap is broken. + mHasUploadPerm = (("" == upload_status) || ("valid" == upload_status)); - mHasUploadPerm = true; - - getChildView("upload")->setEnabled(mHasUploadPerm); - getChildView("warning_label")->setVisible(mHasUploadPerm); - getChildView("warning_text")->setVisible(mHasUploadPerm); + getChildView("warning_label")->setVisible(!mHasUploadPerm); + getChildView("warning_text")->setVisible(!mHasUploadPerm); } /*virtual*/ @@ -501,6 +491,10 @@ void LLFloaterModelWizard::onModelPhysicsFeeReceived(F64 physics, S32 fee, std:: { swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); + // Enable the "Upload" buton if we have calculated the upload fee + // and have the permission to upload. + getChildView("upload")->setEnabled(mHasUploadPerm); + mUploadModelUrl = upload_url; childSetTextArg("review_fee", "[FEE]", llformat("%d", fee)); @@ -514,6 +508,9 @@ void LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(U32 status, const std:: { swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); + // Disable the "Review" step if it has been previously enabled. + modelChangedCallback(); + llwarns << "LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; } @@ -651,6 +648,7 @@ BOOL LLFloaterModelWizard::postBuild() mModelPreview->setPreviewTarget(16.f); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelWizard::setDetails, this, _1, _2, _3, _4, _5)); mModelPreview->setModelLoadedCallback(boost::bind(&LLFloaterModelWizard::modelLoadedCallback, this)); + mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelWizard::modelChangedCallback, this)); mModelPreview->mViewOption["show_textures"] = true; center(); @@ -663,6 +661,8 @@ BOOL LLFloaterModelWizard::postBuild() initDecompControls(); + requestAgentUploadPermissions(); + return TRUE; } @@ -690,6 +690,20 @@ void LLFloaterModelWizard::modelLoadedCallback() updateButtons(); } +void LLFloaterModelWizard::modelChangedCallback() +{ + // Don't allow to proceed to the "Review" step if the model has changed + // but the new upload fee hasn't been calculated yet. + if (mLastEnabledState > PHYSICS) + { + mLastEnabledState = PHYSICS; + } + + getChildView("upload")->setEnabled(false); + + updateButtons(); +} + void LLFloaterModelWizard::onUpload() { mModelPreview->rebuildUploadData(); diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index 202463c992..ea60cf5db8 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -65,10 +65,9 @@ public: BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ void onOpen(const LLSD& key); - void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); void modelLoadedCallback(); + void modelChangedCallback(); void initDecompControls(); // shows warning message if agent has no permissions to upload model diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h index 9a38db837c..c912c9755a 100644 --- a/indra/newview/lluploadfloaterobservers.h +++ b/indra/newview/lluploadfloaterobservers.h @@ -24,8 +24,8 @@ * $/LicenseInfo$ */ -#ifndef LLUPLOADFLOATEROBSERVERS_H_ -#define LLUPLOADFLOATEROBSERVERS_H_ +#ifndef LL_LLUPLOADFLOATEROBSERVERS_H +#define LL_LLUPLOADFLOATEROBSERVERS_H #include "llfloater.h" #include "llhttpclient.h" @@ -94,4 +94,4 @@ private: LLHandle<LLUploadPermissionsObserver> mObserverHandle; }; -#endif /* LLUPLOADFLOATEROBSERVERS_H_ */ +#endif /* LL_LLUPLOADFLOATEROBSERVERS_H */ diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index e5f60ea482..7f15de7236 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -93,7 +93,7 @@ top_pad="5" wrap="true" visible="false"> - You will not be able to complete the final upload of this model to the Second Life servers. Find out how to get certifed for mesh model uploads. + You will not be able to complete the final upload of this model to the Second Life servers. [secondlife:///app/floater/learn_more Find out how] to get certifed for mesh model uploads. </text> <tab_container diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 89736363b9..b5a5ff5342 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -264,14 +264,14 @@ WARNING: </text> <text - height="40" + height="50" left="10" name="warning_text" top_pad="0" visible="false" width="320" word_wrap="true"> - You will not be able to complete the final step of uploading this model to the Second Life servers. [secondlife:///app/floater/learn_more Find out how] to set up y + You will not be able to complete the final step of uploading this model to the Second Life servers. [secondlife:///app/floater/learn_more Find out how] to set up your account for mesh model uploads. </text> </panel> </panel> @@ -792,6 +792,7 @@ Buildings</text> name="calculating" label="Calculating... " /> <button + enabled="false" top_delta="0" right="-150" width="90" |