diff options
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 32 |
1 files changed, 21 insertions, 11 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); } |