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/llfloatermodelpreview.cpp | 7 + indra/newview/llfloatermodelpreview.h | 1 + indra/newview/llfloatermodelwizard.cpp | 146 ++-- indra/newview/llfloatermodelwizard.h | 12 +- .../skins/default/xui/en/floater_model_wizard.xml | 771 ++++++++------------- 5 files changed, 390 insertions(+), 547 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 9721fc9224..06a1225905 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -544,6 +544,13 @@ void LLFloaterModelPreview::loadModel(S32 lod) (new LLMeshFilePicker(mModelPreview, lod))->getFile(); } +void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name) +{ + mModelPreview->mLoading = true; + + mModelPreview->loadModel(file_name, lod); +} + //static void LLFloaterModelPreview::onImportScaleCommit(LLUICtrl*,void* userdata) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index ccd6fef953..d78135779e 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -185,6 +185,7 @@ public: void updateResourceCost(); void loadModel(S32 lod); + void loadModel(S32 lod, const std::string& file_name); void onViewOptionChecked(const LLSD& userdata); bool isViewOptionChecked(const LLSD& userdata); 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); +} diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index b166d26295..c32977f4b0 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -66,7 +66,6 @@ public: void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); void modelLoadedCallback(); - void onPhysicsChanged(); void initDecompControls(); LLPhysicsDecomp::decomp_params mDecompParams; @@ -80,13 +79,15 @@ private: CHOOSE_FILE = 0, OPTIMIZE, PHYSICS, - PHYSICS2, REVIEW, UPLOAD }; void setState(int state); void updateButtons(); + void onClickSwitchToAdvanced(); + void onClickRecalculateGeometry(); + void onClickRecalculatePhysics(); void onClickCancel(); void onClickBack(); void onClickNext(); @@ -94,7 +95,6 @@ private: bool onEnableBack(); void loadModel(); void onPreviewLODCommit(LLUICtrl*); - void onAccuracyPerformance(const LLSD& data); void onUpload(); LLModelPreview* mModelPreview; @@ -106,7 +106,11 @@ private: U32 mLastEnabledState; - + LLButton* mRecalculateGeometryBtn; + LLButton* mRecalculatePhysicsBtn; + LLButton* mRecalculatingPhysicsBtn; + LLButton* mCalculateWeightsBtn; + LLButton* mCalculatingWeightsBtn; }; 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 c3f7b70ca7..1d6ded5391 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -45,24 +45,6 @@ - - Filename: + width="320"> + Choose model file to upload + width="230" /> - Model Preview: + left="10" + name="Cache location" + width="320"> + Second Life supports COLLADA (.dae) files @@ -225,7 +220,7 @@ top_pad="10" width="130" height="14" - left="340" + left_delta="0" text_color="White" word_wrap="true"> Dimensions (meters): @@ -238,15 +233,7 @@ text_color="White" name="dimensions" left_delta="0"> - X: Y: Z: - - - | | + X Y Z - - Note: - - -Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/openfloater/upload_model Advanced Mesh Import Window] . - + + WARNING: + + + 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 + @@ -291,7 +281,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="388" top_delta="0" name="optimize_panel" - visible="false" + visible="true" width="535" left="0"> - Optimize + Optimize model - This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. + We have optimized the model for performance. Adjust it further if you wish. - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. + Performance + Faster rendering +Less detail +Lower prim weight + Accuracy + Slower rendering +More detail +Higher prim weight - - ' - - - - - - Resource Cost: [COST] - - Dimensions (meters): - - - X: Y: Z: - - - | | + + ' + + ' + + + + Geometry preview - - - + + + + + High detail + + + Medium detail + + + Low detail + + + Lowest detail + + @@ -549,7 +512,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se font="SansSerifBig" text_color="White" layout="topleft"> - Physics + Adjust physics - The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: + We will create a shape for the outer hull of the model. Adjust the shape's detail level as needed for the intended purpose of your model. - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. + Performance + Faster rendering +Less detail +Lower prim weight + Accuracy + Slower rendering +More detail +Higher prim weight - ' ' ' ' ' ' ' ' ' ' ' - Recommended for solid objects - Recommended for buildings - Recommended for vehicles - - - - - Resource Cost: [COST] - - - - - - - - Physics - - - - Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. - - - - Model Preview: + top="25" + width="22" /> + Examples: +Moving objects +Flying objects +Vehicles + Examples: +Small static objects +Less detailed objects +Simple furniture + Examples: +Static objects +Detailed objects +Buildings + + + + Physics preview - + + + - High + High detail - Medium + Medium detail - Low + Low detail - Lowest + Lowest detail - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - Resource Cost: [COST] - + - - Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. - - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - + name="content" + bg_opaque_color="DkGray2" + background_visible="true" + background_opaque="true"> + Impact to parcel/region: [EQUIV] prim equivalents + + Your account will be charged an upload fee of L$ [FEE]. + + By clicking the upload button, you confirm that you have the appropriate rights to the material contained in the model. + - Resource Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Physics Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Upload Fee: - This is the amount the upload will cost. - - I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] @@ -954,44 +721,76 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="10" font="SansSerifBig" layout="topleft"> - Upload Complete! + Upload complete - Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. + left="25"> + Your model has been uploaded. + + + You will find it in the Objects folder in your inventory. + + Your account has been charged L$ [FEE]. -