From d625706d84cbb69d99497d3ee328105907867181 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 22 Jun 2011 19:31:03 +0300 Subject: SH-1725 WIP Floater upload model wizard update: - XUI changed according to latest mockups - Added switching to advanced upload floater - Added "Recalculate geometry" and "Recalculate physics" buttons --- indra/newview/llfloatermodelwizard.cpp | 146 ++++++++++++++++++++------------- 1 file changed, 89 insertions(+), 57 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 707c8288df..61b8032625 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -46,12 +46,18 @@ static const std::string stateNames[]={ "choose_file", "optimize", "physics", - "physics2", "review", "upload"}; +static void swap_controls(LLUICtrl* first_ctrl, LLUICtrl* second_ctrl, bool first_ctr_visible); + LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) : LLFloater(key) + ,mRecalculateGeometryBtn(NULL) + ,mRecalculatePhysicsBtn(NULL) + ,mRecalculatingPhysicsBtn(NULL) + ,mCalculateWeightsBtn(NULL) + ,mCalculatingWeightsBtn(NULL) { mLastEnabledState = CHOOSE_FILE; sInstance = this; @@ -59,7 +65,6 @@ LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) mCommitCallbackRegistrar.add("Wizard.Choose", boost::bind(&LLFloaterModelWizard::setState, this, CHOOSE_FILE)); mCommitCallbackRegistrar.add("Wizard.Optimize", boost::bind(&LLFloaterModelWizard::setState, this, OPTIMIZE)); mCommitCallbackRegistrar.add("Wizard.Physics", boost::bind(&LLFloaterModelWizard::setState, this, PHYSICS)); - mCommitCallbackRegistrar.add("Wizard.Physics2", boost::bind(&LLFloaterModelWizard::setState, this, PHYSICS2)); mCommitCallbackRegistrar.add("Wizard.Review", boost::bind(&LLFloaterModelWizard::setState, this, REVIEW)); mCommitCallbackRegistrar.add("Wizard.Upload", boost::bind(&LLFloaterModelWizard::setState, this, UPLOAD)); } @@ -91,6 +96,8 @@ void LLFloaterModelWizard::setState(int state) getChildView("next")->setVisible(true); getChildView("upload")->setVisible(false); getChildView("cancel")->setVisible(true); + mCalculateWeightsBtn->setVisible(false); + mCalculatingWeightsBtn->setVisible(false); } if (state == OPTIMIZE) @@ -108,6 +115,8 @@ void LLFloaterModelWizard::setState(int state) getChildView("next")->setVisible(true); getChildView("upload")->setVisible(false); getChildView("cancel")->setVisible(true); + mCalculateWeightsBtn->setVisible(false); + mCalculatingWeightsBtn->setVisible(false); } if (state == PHYSICS) @@ -119,30 +128,14 @@ void LLFloaterModelWizard::setState(int state) mModelPreview->mViewOption["show_physics"] = true; - getChildView("next")->setVisible(true); - getChildView("upload")->setVisible(false); - getChildView("close")->setVisible(false); - getChildView("back")->setVisible(true); - getChildView("back")->setEnabled(true); - getChildView("cancel")->setVisible(true); - } - - if (state == PHYSICS2) - { - if (mLastEnabledState < state) - { - executePhysicsStage("Decompose"); - } - - mModelPreview->mViewOption["show_physics"] = true; - - getChildView("next")->setVisible(true); - getChildView("next")->setEnabled(true); + getChildView("next")->setVisible(false); getChildView("upload")->setVisible(false); getChildView("close")->setVisible(false); getChildView("back")->setVisible(true); getChildView("back")->setEnabled(true); getChildView("cancel")->setVisible(true); + mCalculateWeightsBtn->setVisible(true); + mCalculatingWeightsBtn->setVisible(false); } if (state == REVIEW) @@ -156,6 +149,8 @@ void LLFloaterModelWizard::setState(int state) getChildView("back")->setEnabled(true); getChildView("upload")->setVisible(true); getChildView("cancel")->setVisible(true); + mCalculateWeightsBtn->setVisible(false); + mCalculatingWeightsBtn->setVisible(false); } if (state == UPLOAD) @@ -165,6 +160,8 @@ void LLFloaterModelWizard::setState(int state) getChildView("back")->setVisible(false); getChildView("upload")->setVisible(false); getChildView("cancel")->setVisible(false); + mCalculateWeightsBtn->setVisible(false); + mCalculatingWeightsBtn->setVisible(false); } updateButtons(); @@ -198,18 +195,48 @@ void LLFloaterModelWizard::updateButtons() button->setEnabled(FALSE); } } +} - LLButton *physics_button = getChild(stateNames[PHYSICS]+"_btn"); - - if (mState == PHYSICS2) +void LLFloaterModelWizard::onClickSwitchToAdvanced() +{ + LLFloaterModelPreview* floater_preview = LLFloaterReg::getTypedInstance("upload_model"); + if (!floater_preview) { - physics_button->setVisible(false); + llwarns << "FLoater model preview not found." << llendl; + return; } - else + + // Open floater model preview + floater_preview->openFloater(); + + // Close the wizard + closeFloater(); + + std::string filename = getChild("lod_file")->getValue().asString(); + if (!filename.empty()) { - physics_button->setVisible(true); + // Re-load the model to the floater model preview if it has been loaded + // into the wizard. + floater_preview->loadModel(3, filename); } +} + +void LLFloaterModelWizard::onClickRecalculateGeometry() +{ + S32 val = getChild("accuracy_slider")->getValue().asInteger(); + + mModelPreview->genLODs(-1, NUM_LOD - val); + mModelPreview->refresh(); +} + +void LLFloaterModelWizard::onClickRecalculatePhysics() +{ + // Hide the "Recalculate physics" button and show the "Recalculating..." + // button instead. + swap_controls(mRecalculatePhysicsBtn, mRecalculatingPhysicsBtn, false); + + executePhysicsStage("Decompose"); } void LLFloaterModelWizard::loadModel() @@ -471,6 +498,11 @@ void LLFloaterModelWizard::DecompRequest::completed() { executePhysicsStage("Simplify"); } + else + { + // Decomp request is complete so we can enable the "Recalculate physics" button again. + swap_controls(sInstance->mRecalculatePhysicsBtn, sInstance->mRecalculatingPhysicsBtn, true); + } } @@ -488,10 +520,22 @@ BOOL LLFloaterModelWizard::postBuild() getChild("next")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickNext, this)); getChild("preview_lod_combo")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onPreviewLODCommit, this, _1)); getChild("preview_lod_combo2")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onPreviewLODCommit, this, _1)); - getChild("preview_lod_combo3")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onPreviewLODCommit, this, _1)); - getChild("accuracy_slider")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onAccuracyPerformance, this, _2)); getChild("upload")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onUpload, this)); - getChild("physics_slider")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onPhysicsChanged, this)); + getChild("switch_to_advanced")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickSwitchToAdvanced, this)); + + mRecalculateGeometryBtn = getChild("recalculate_geometry_btn"); + mRecalculateGeometryBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickRecalculateGeometry, this)); + + mRecalculatePhysicsBtn = getChild("recalculate_physics_btn"); + mRecalculatePhysicsBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickRecalculatePhysics, this)); + + mRecalculatingPhysicsBtn = getChild("recalculating_physics_btn"); + + mCalculateWeightsBtn = getChild("calculate"); + // *TODO: Change the callback to upload fee request. + mCalculateWeightsBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickNext, this)); + + mCalculatingWeightsBtn = getChild("calculating"); LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; @@ -532,22 +576,19 @@ void LLFloaterModelWizard::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F panel->childSetText("dimension_x", llformat("%.1f", x)); panel->childSetText("dimension_y", llformat("%.1f", y)); panel->childSetText("dimension_z", llformat("%.1f", z)); - panel->childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); - panel->childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); } } + + childSetTextArg("review_prim_equiv", "[EQUIV]", llformat("%d", mModelPreview->mResourceCost)); + + // *TODO: Get the actual upload fee. + childSetTextArg("review_fee", "[FEE]", llformat("%d", 0)); + childSetTextArg("charged_fee", "[FEE]", llformat("%d", 0)); } void LLFloaterModelWizard::modelLoadedCallback() { mLastEnabledState = CHOOSE_FILE; - getChild("confirm_checkbox")->set(FALSE); - updateButtons(); -} - -void LLFloaterModelWizard::onPhysicsChanged() -{ - mLastEnabledState = PHYSICS; updateButtons(); } @@ -562,16 +603,6 @@ void LLFloaterModelWizard::onUpload() } -void LLFloaterModelWizard::onAccuracyPerformance(const LLSD& data) -{ - int val = (int) data.asInteger(); - - mModelPreview->genLODs(-1, NUM_LOD-val); - - mModelPreview->refresh(); -} - - void LLFloaterModelWizard::onPreviewLODCommit(LLUICtrl* ctrl) { if (!mModelPreview) @@ -601,11 +632,6 @@ void LLFloaterModelWizard::refresh() getChildView("next")->setEnabled(model_loaded); } - if (mState == REVIEW) - { - getChildView("upload")->setEnabled(getChild("confirm_checkbox")->getValue().asBoolean()); - } - } void LLFloaterModelWizard::draw() @@ -613,12 +639,11 @@ void LLFloaterModelWizard::draw() refresh(); LLFloater::draw(); - LLRect r = getRect(); - - mModelPreview->update(); if (mModelPreview) { + mModelPreview->update(); + gGL.color3f(1.f, 1.f, 1.f); gGL.getTexUnit(0)->bind(mModelPreview); @@ -652,3 +677,10 @@ void LLFloaterModelWizard::draw() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } + +// static +void swap_controls(LLUICtrl* first_ctrl, LLUICtrl* second_ctrl, bool first_ctr_visible) +{ + first_ctrl->setVisible(first_ctr_visible); + second_ctrl->setVisible(!first_ctr_visible); +} -- cgit v1.2.3 From c5a60ba865e593d4028fcf22322c07b6aa7f94ce Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 28 Jun 2011 18:14:17 +0300 Subject: SH-1725 WIP Fixed model preview panels cursor change. --- indra/newview/llfloatermodelwizard.cpp | 55 ++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 22 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 61b8032625..32b8850803 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -58,6 +58,9 @@ LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) ,mRecalculatingPhysicsBtn(NULL) ,mCalculateWeightsBtn(NULL) ,mCalculatingWeightsBtn(NULL) + ,mChooseFilePreviewPanel(NULL) + ,mOptimizePreviewPanel(NULL) + ,mPhysicsPreviewPanel(NULL) { mLastEnabledState = CHOOSE_FILE; sInstance = this; @@ -86,10 +89,14 @@ void LLFloaterModelWizard::setState(int state) } } + LLView* current_preview_panel = NULL; + if (state == CHOOSE_FILE) { mModelPreview->mViewOption["show_physics"] = false; + current_preview_panel = mChooseFilePreviewPanel; + getChildView("close")->setVisible(false); getChildView("back")->setVisible(true); getChildView("back")->setEnabled(false); @@ -109,6 +116,8 @@ void LLFloaterModelWizard::setState(int state) mModelPreview->mViewOption["show_physics"] = false; + current_preview_panel = mOptimizePreviewPanel; + getChildView("back")->setVisible(true); getChildView("back")->setEnabled(true); getChildView("close")->setVisible(false); @@ -128,6 +137,8 @@ void LLFloaterModelWizard::setState(int state) mModelPreview->mViewOption["show_physics"] = true; + current_preview_panel = mPhysicsPreviewPanel; + getChildView("next")->setVisible(false); getChildView("upload")->setVisible(false); getChildView("close")->setVisible(false); @@ -164,6 +175,20 @@ void LLFloaterModelWizard::setState(int state) mCalculatingWeightsBtn->setVisible(false); } + if (current_preview_panel) + { + LLRect rect; + current_preview_panel->localRectToOtherView(current_preview_panel->getLocalRect(), &rect, this); + + // Reduce the preview rect by 1 px to fit the borders + rect.stretch(-1); + + if (rect != mPreviewRect) + { + mPreviewRect = rect; + mModelPreview->refresh(); + } + } updateButtons(); } @@ -508,8 +533,6 @@ void LLFloaterModelWizard::DecompRequest::completed() BOOL LLFloaterModelWizard::postBuild() { - LLView* preview_panel = getChildView("preview_panel"); - childSetValue("import_scale", (F32) 0.67335826); getChild("browse")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this)); @@ -537,13 +560,14 @@ BOOL LLFloaterModelWizard::postBuild() mCalculatingWeightsBtn = getChild("calculating"); + mChooseFilePreviewPanel = getChild("choose_file_preview_panel"); + mOptimizePreviewPanel = getChild("optimize_preview_panel"); + mPhysicsPreviewPanel = getChild("physics_preview_panel"); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; enable_registrar.add("Next.OnEnable", boost::bind(&LLFloaterModelWizard::onEnableNext, this)); enable_registrar.add("Back.OnEnable", boost::bind(&LLFloaterModelWizard::onEnableBack, this)); - - - mPreviewRect = preview_panel->getRect(); mModelPreview = new LLModelPreview(512, 512, this); mModelPreview->setPreviewTarget(16.f); @@ -648,29 +672,16 @@ void LLFloaterModelWizard::draw() gGL.getTexUnit(0)->bind(mModelPreview); - LLView *view = getChildView(stateNames[mState]+"_panel"); - LLView* preview_panel = view->getChildView("preview_panel"); - - LLRect rect = preview_panel->getRect(); - if (rect != mPreviewRect) - { - mModelPreview->refresh(); - mPreviewRect = preview_panel->getRect(); - } - - LLRect item_rect; - preview_panel->localRectToOtherView(preview_panel->getLocalRect(), &item_rect, this); - gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(item_rect.mLeft, item_rect.mTop-1); + gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop); gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(item_rect.mLeft, item_rect.mBottom); + gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom); gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(item_rect.mRight-1, item_rect.mBottom); + gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(item_rect.mRight-1, item_rect.mTop-1); + gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mTop); } gGL.end(); -- cgit v1.2.3 From 83c277afe8d2f7c3066fe611cda50a8bc22ccc87 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 28 Jun 2011 20:46:52 +0300 Subject: SH-1725 WIP Fixed the physics detail slider value. Inverted the min value to the "performance" end of the slider and the max value to the "accuracy" end. --- indra/newview/llfloatermodelwizard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 32b8850803..9efebbd336 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -458,7 +458,9 @@ void LLFloaterModelWizard::executePhysicsStage(std::string stage_name) { if (sInstance) { - F64 physics_accuracy = sInstance->getChild("physics_slider")->getValue().asReal(); + // Invert the slider value so that "performance" end is giving the least detailed physics, + // and the "accuracy" end is giving the most detailed physics + F64 physics_accuracy = 1 - sInstance->getChild("physics_slider")->getValue().asReal(); sInstance->mDecompParams["Retain%"] = physics_accuracy; -- cgit v1.2.3 From 0528723d0fcd926e2243d543aa51bf5261f09103 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 28 Jun 2011 21:24:17 +0300 Subject: SH-1725 WIP Fixed preview model display on two last wizard steps. --- indra/newview/llfloatermodelwizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 9efebbd336..97b54c4c74 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -666,7 +666,7 @@ void LLFloaterModelWizard::draw() LLFloater::draw(); - if (mModelPreview) + if (mModelPreview && mState < REVIEW) { mModelPreview->update(); -- cgit v1.2.3 From fc6f0f31be53d6adbc8e364ffdd4119943312578 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 29 Jun 2011 17:22:18 +0300 Subject: SH-1726 FIXED (Viewer modifications to advanced model upload to accommodate upload fee & prim equivalency) - Changed XUI according to the spec - Added requesting upload permission, physics weight and fee weight - Split requesting fee and uploading model steps in mesh repository --- indra/newview/llfloatermodelwizard.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 97b54c4c74..3c0ce96864 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -52,7 +52,7 @@ static const std::string stateNames[]={ static void swap_controls(LLUICtrl* first_ctrl, LLUICtrl* second_ctrl, bool first_ctr_visible); LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) - : LLFloater(key) + : LLFloaterModelUploadBase(key) ,mRecalculateGeometryBtn(NULL) ,mRecalculatePhysicsBtn(NULL) ,mRecalculatingPhysicsBtn(NULL) @@ -396,6 +396,13 @@ BOOL LLFloaterModelWizard::handleScrollWheel(S32 x, S32 y, S32 clicks) return TRUE; } + +/*virtual*/ +void LLFloaterModelWizard::onOpen(const LLSD& key) +{ + requestAgentUploadPermissions(); +} + void LLFloaterModelWizard::initDecompControls() { LLSD key; @@ -453,6 +460,15 @@ void LLFloaterModelWizard::initDecompControls() mDecompParams["Simplify Method"] = 0; // set it to retain % } +void LLFloaterModelWizard::onPermReceived(const LLSD& result) +{ +} + +void LLFloaterModelWizard::setPermErrorStatus(U32 status, const std::string& reason) +{ + llwarns << "LLFloaterModelWizard::setPermErrors(" << status << " : " << reason << ")" << llendl; +} + //static void LLFloaterModelWizard::executePhysicsStage(std::string stage_name) { @@ -623,7 +639,7 @@ void LLFloaterModelWizard::onUpload() mModelPreview->rebuildUploadData(); gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, - true, false, false); + true, false, false, mUploadModelUrl, true); setState(UPLOAD); -- cgit v1.2.3 From e4b12b83e8721e0856af0305f6cee46cd6092024 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 29 Jun 2011 22:03:29 +0300 Subject: SH-1725 WIP Added upload permissions and fee requests to Upload Model Wizard. - Enabled warning for users without upload permissions. - Enabled "Calculate weights & fee" button. - Temporarily enabled to upload meshes if upload permission capability request has failed. --- indra/newview/llfloatermodelwizard.cpp | 59 ++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 3c0ce96864..4482d02ca3 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -162,6 +162,8 @@ void LLFloaterModelWizard::setState(int state) getChildView("cancel")->setVisible(true); mCalculateWeightsBtn->setVisible(false); mCalculatingWeightsBtn->setVisible(false); + + getChildView("upload")->setEnabled(mHasUploadPerm); } if (state == UPLOAD) @@ -264,6 +266,21 @@ void LLFloaterModelWizard::onClickRecalculatePhysics() executePhysicsStage("Decompose"); } +void LLFloaterModelWizard::onClickCalculateUploadFee() +{ + swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, false); + + mModelPreview->rebuildUploadData(); + + mUploadModelUrl.clear(); + LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + true, false, false, mUploadModelUrl, false); + + thread->setObserverHandle(getWholeModelFeeObserverHandle()); + + gMeshRepo.mUploadWaitList.push_back(thread); +} + void LLFloaterModelWizard::loadModel() { mModelPreview->mLoading = TRUE; @@ -460,13 +477,42 @@ void LLFloaterModelWizard::initDecompControls() mDecompParams["Simplify Method"] = 0; // set it to retain % } -void LLFloaterModelWizard::onPermReceived(const LLSD& result) +/*virtual*/ +void LLFloaterModelWizard::onPermissionsReceived(const LLSD& result) +{ + std::string upload_status = result["mesh_upload_status"].asString(); + mHasUploadPerm = "valid" == upload_status; + + getChildView("upload")->setEnabled(mHasUploadPerm); + getChildView("warning_label")->setVisible(mHasUploadPerm); + getChildView("warning_text")->setVisible(mHasUploadPerm); +} + +/*virtual*/ +void LLFloaterModelWizard::setPermissonsErrorStatus(U32 status, const std::string& reason) { + llwarns << "LLFloaterModelWizard::setPermissonsErrorStatus(" << status << " : " << reason << ")" << llendl; } -void LLFloaterModelWizard::setPermErrorStatus(U32 status, const std::string& reason) +/*virtual*/ +void LLFloaterModelWizard::onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) { - llwarns << "LLFloaterModelWizard::setPermErrors(" << status << " : " << reason << ")" << llendl; + swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); + + mUploadModelUrl = upload_url; + + childSetTextArg("review_fee", "[FEE]", llformat("%d", fee)); + childSetTextArg("charged_fee", "[FEE]", llformat("%d", fee)); + + setState(llmin((int) UPLOAD, mState+1)); +} + +/*virtual*/ +void LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) +{ + swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); + + llwarns << "LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; } //static @@ -573,8 +619,7 @@ BOOL LLFloaterModelWizard::postBuild() mRecalculatingPhysicsBtn = getChild("recalculating_physics_btn"); mCalculateWeightsBtn = getChild("calculate"); - // *TODO: Change the callback to upload fee request. - mCalculateWeightsBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickNext, this)); + mCalculateWeightsBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickCalculateUploadFee, this)); mCalculatingWeightsBtn = getChild("calculating"); @@ -622,10 +667,6 @@ void LLFloaterModelWizard::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F } childSetTextArg("review_prim_equiv", "[EQUIV]", llformat("%d", mModelPreview->mResourceCost)); - - // *TODO: Get the actual upload fee. - childSetTextArg("review_fee", "[FEE]", llformat("%d", 0)); - childSetTextArg("charged_fee", "[FEE]", llformat("%d", 0)); } void LLFloaterModelWizard::modelLoadedCallback() -- cgit v1.2.3 From 6baafbd549d7a0bddacb5a30b7d9336c5afbcbaf Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Thu, 30 Jun 2011 15:01:47 +0300 Subject: SH-1725 WIP Fixed displaying upload permissions warning --- indra/newview/llfloatermodelwizard.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 4482d02ca3..a3db22dbc6 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -481,11 +481,12 @@ 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)); 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*/ -- cgit v1.2.3 From 93d6c921c9ca45241983096a4eb8b199c347d59c Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Thu, 30 Jun 2011 16:37:43 +0300 Subject: SH-1725 WIP Fixed "Upload" button to be enabled only after recalculating the upload fee and weight. --- indra/newview/llfloatermodelwizard.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index a3db22dbc6..f0e4e99d82 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) @@ -484,7 +482,6 @@ void LLFloaterModelWizard::onPermissionsReceived(const LLSD& result) // BAP HACK: handle "" for case that MeshUploadFlag cap is broken. mHasUploadPerm = (("" == upload_status) || ("valid" == upload_status)); - getChildView("upload")->setEnabled(mHasUploadPerm); getChildView("warning_label")->setVisible(!mHasUploadPerm); getChildView("warning_text")->setVisible(!mHasUploadPerm); } @@ -500,6 +497,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)); @@ -513,6 +514,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; } @@ -637,6 +641,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(); @@ -676,6 +681,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(); -- cgit v1.2.3 From 87458cd714cd5b12057b8f61dfc8000df176458f Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 30 Jun 2011 19:12:27 +0300 Subject: SH-1725 WIP Fixed model wizard making multiple calls to upload permissions check. Fixed truncated warning text. --- indra/newview/llfloatermodelwizard.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index f0e4e99d82..254c54ad2a 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -412,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; @@ -654,6 +648,8 @@ BOOL LLFloaterModelWizard::postBuild() initDecompControls(); + requestAgentUploadPermissions(); + return TRUE; } -- cgit v1.2.3 From 17060f4e92b12ab74a1b570cd9ee4d1543fb23d1 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Thu, 30 Jun 2011 15:55:19 -0400 Subject: SH-1332 Remaining mesh wizard upload work adding observer classes for the upload step so we don't move to success state until upload succeeds. --- indra/newview/llfloatermodelwizard.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 4482d02ca3..8cfd04e461 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -276,7 +276,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); } @@ -483,6 +483,8 @@ void LLFloaterModelWizard::onPermissionsReceived(const LLSD& result) std::string upload_status = result["mesh_upload_status"].asString(); mHasUploadPerm = "valid" == upload_status; + mHasUploadPerm = true; + getChildView("upload")->setEnabled(mHasUploadPerm); getChildView("warning_label")->setVisible(mHasUploadPerm); getChildView("warning_text")->setVisible(mHasUploadPerm); @@ -515,6 +517,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) { @@ -679,11 +694,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) -- cgit v1.2.3 From 51dcb8476df521da73e935ea0d7ea5ad3b08d288 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 1 Jul 2011 16:36:25 +0300 Subject: SH-1964 FIXED switching to "Review" wizard step upon fee request success and to "Physics" step upon failure. Fixed disabling the final wizard step upon upload failure. --- indra/newview/llfloatermodelwizard.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 71baa0fa76..ad264399d8 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -500,7 +500,7 @@ void LLFloaterModelWizard::onModelPhysicsFeeReceived(F64 physics, S32 fee, std:: childSetTextArg("review_fee", "[FEE]", llformat("%d", fee)); childSetTextArg("charged_fee", "[FEE]", llformat("%d", fee)); - setState(llmin((int) UPLOAD, mState+1)); + setState(REVIEW); } /*virtual*/ @@ -512,6 +512,8 @@ void LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(U32 status, const std:: modelChangedCallback(); llwarns << "LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; + + setState(PHYSICS); } /*virtual*/ @@ -524,7 +526,13 @@ void LLFloaterModelWizard::onModelUploadSuccess() /*virtual*/ void LLFloaterModelWizard::onModelUploadFailure() { - + // Disable the "Upload complete" step if it has been previously enabled. + if (mLastEnabledState > REVIEW) + { + mLastEnabledState = REVIEW; + } + + updateButtons(); } //static -- cgit v1.2.3 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/llfloatermodelwizard.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') 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) -- cgit v1.2.3 From 5f17754a39c94c90be98313d52efab18e3cfc789 Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Tue, 5 Jul 2011 21:21:26 +0300 Subject: SH-1965 FIXED recalculating physics in model upload wizard before requesting the upload fee. --- indra/newview/llfloatermodelwizard.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index ae6b1dd85b..7efcdb6145 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -133,6 +133,10 @@ void LLFloaterModelWizard::setState(int state) if (mLastEnabledState < state) { mModelPreview->setPhysicsFromLOD(1); + + // Trigger the recalculate physics when first entering + // the Physics step. + onClickRecalculatePhysics(); } mModelPreview->mViewOption["show_physics"] = true; -- cgit v1.2.3 From 7029c8ff534419a3bcfd0e5fc39a4739e4cdc19c Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sat, 9 Jul 2011 14:58:14 -0700 Subject: Fix for SH-2028. Also fixed layout issues with new upload warning and upload price text when floater is resized. --- indra/newview/llfloatermodelwizard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermodelwizard.cpp') diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 7efcdb6145..b517b78e5a 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -488,7 +488,7 @@ void LLFloaterModelWizard::setPermissonsErrorStatus(U32 status, const std::strin } /*virtual*/ -void LLFloaterModelWizard::onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) +void LLFloaterModelWizard::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) { swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); @@ -498,6 +498,7 @@ void LLFloaterModelWizard::onModelPhysicsFeeReceived(F64 physics, S32 fee, std:: mUploadModelUrl = upload_url; + S32 fee = result["upload_price"].asInteger(); childSetTextArg("review_fee", "[FEE]", llformat("%d", fee)); childSetTextArg("charged_fee", "[FEE]", llformat("%d", fee)); -- cgit v1.2.3