From 55c220779223682260c5299ec13c17d19bf6ca4e Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 31 Aug 2011 17:02:15 +0300 Subject: SH-2309 WIP Priority modifications to mesh uploader UI Made next changes according to the last version of UI spec: - Modified Upload Options tab - Modified Physics tab - Modified the floater overall --- indra/newview/llfloatermodelpreview.cpp | 100 ++-- indra/newview/llfloatermodelpreview.h | 2 - indra/newview/skins/default/colors.xml | 3 + .../skins/default/xui/en/floater_model_preview.xml | 588 ++++++++++++++------- 4 files changed, 474 insertions(+), 219 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index dd652b32a7..276f513abf 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -431,7 +431,6 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("pelvis_offset", onPelvisOffsetCommit, this); childSetCommitCallback("lod_file_or_limit", refresh, this); - childSetCommitCallback("physics_load_radio", onPhysicsLoadRadioCommit, this); //childSetCommitCallback("physics_optimize", refresh, this); //childSetCommitCallback("physics_use_hull", refresh, this); @@ -640,29 +639,6 @@ void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata ) fp->mModelPreview->refresh(); } -//static -void LLFloaterModelPreview::onPhysicsLoadRadioCommit( LLUICtrl*, void *userdata) -{ - LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; - if (fmp) - { - if (fmp->childGetValue("physics_use_lod").asBoolean()) - { - onPhysicsUseLOD(NULL,NULL); - } - if (fmp->childGetValue("physics_load_from_file").asBoolean()) - { - - } - LLModelPreview *model_preview = fmp->mModelPreview; - if (model_preview) - { - model_preview->refresh(); - model_preview->updateStatusMessages(); - } - } -} - //static void LLFloaterModelPreview::onUploadJointsCommit(LLUICtrl*,void* userdata) { @@ -935,16 +911,20 @@ void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data) if (name == "Simplify Method") { - if (ctrl->getValue().asInteger() == 0) - { - sInstance->childSetVisible("Retain%", true); - sInstance->childSetVisible("Detail Scale", false); - } - else + bool show_retain = false; + bool show_detail = true; + + if (ctrl->getValue().asInteger() == 0) { - sInstance->childSetVisible("Retain%", false); - sInstance->childSetVisible("Detail Scale", true); + show_retain = true; + show_detail = false; } + + sInstance->childSetVisible("Retain%", show_retain); + sInstance->childSetVisible("Retain%_label", show_retain); + + sInstance->childSetVisible("Detail Scale", show_detail); + sInstance->childSetVisible("Detail Scale label", show_detail); } } } @@ -1001,13 +981,35 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata) void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) { S32 which_mode = 3; + static S32 previous_mode = which_mode; + LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo"); if (iface) { which_mode = iface->getFirstSelectedIndex(); } - sInstance->mModelPreview->setPhysicsFromLOD(which_mode); + S32 file_mode = iface->getItemCount() - 1; + bool file_browse = which_mode == file_mode; + bool lod_to_file = file_browse && (previous_mode != file_mode); + bool file_to_lod = !file_browse && (previous_mode == file_mode); + + if (!lod_to_file) + { + sInstance->mModelPreview->setPhysicsFromLOD(which_mode); + } + + if (lod_to_file || file_to_lod) + { + LLModelPreview *model_preview = sInstance->mModelPreview; + if (model_preview) + { + model_preview->refresh(); + model_preview->updateStatusMessages(); + } + } + + previous_mode = which_mode; } //static @@ -1099,8 +1101,9 @@ void LLFloaterModelPreview::initDecompControls() mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mFloat); //llinfos << "Type: float, Default: " << param[i].mDefault.mFloat << llendl; - LLSliderCtrl* slider = getChild(name); - if (slider) + + LLUICtrl* ctrl = getChild(name); + if (LLSliderCtrl* slider = dynamic_cast(ctrl)) { slider->setMinValue(param[i].mDetails.mRange.mLow.mFloat); slider->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat); @@ -1108,14 +1111,23 @@ void LLFloaterModelPreview::initDecompControls() slider->setValue(param[i].mDefault.mFloat); slider->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } + else if (LLSpinCtrl* spinner = dynamic_cast(ctrl)) + { + spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat); + spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat); + spinner->setIncrement(param[i].mDetails.mRange.mDelta.mFloat); + spinner->setValue(param[i].mDefault.mFloat); + spinner->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); + } } else if (param[i].mType == LLCDParam::LLCD_INTEGER) { mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue); //llinfos << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << llendl; - LLSliderCtrl* slider = getChild(name); - if (slider) + + LLUICtrl* ctrl = getChild(name); + if (LLSliderCtrl* slider = dynamic_cast(ctrl)) { slider->setMinValue(param[i].mDetails.mRange.mLow.mIntOrEnumValue); slider->setMaxValue(param[i].mDetails.mRange.mHigh.mIntOrEnumValue); @@ -1123,6 +1135,16 @@ void LLFloaterModelPreview::initDecompControls() slider->setValue(param[i].mDefault.mIntOrEnumValue); slider->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } + else if (LLComboBox* combo_box = dynamic_cast(ctrl)) + { + for(int k = param[i].mDetails.mRange.mLow.mIntOrEnumValue; k<=param[i].mDetails.mRange.mHigh.mIntOrEnumValue; k+=param[i].mDetails.mRange.mDelta.mIntOrEnumValue) + { + std::string name = llformat("%.1d", k); + combo_box->add(name, k, ADD_BOTTOM, true); + } + combo_box->setValue(param[i].mDefault.mIntOrEnumValue); + combo_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); + } } else if (param[i].mType == LLCDParam::LLCD_BOOLEAN) { @@ -4528,15 +4550,13 @@ void LLModelPreview::updateStatusMessages() } } - if (mFMP->childGetValue("physics_load_from_file").asBoolean()) + if (mFMP->childGetValue("physics_lod_combo").asString() == "From file") { - mFMP->childDisable("physics_lod_combo"); mFMP->childEnable("physics_file"); mFMP->childEnable("physics_browse"); } else { - mFMP->childEnable("physics_lod_combo"); mFMP->childDisable("physics_file"); mFMP->childDisable("physics_browse"); } diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 9bc8207613..a8fd02443e 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -217,8 +217,6 @@ protected: static void onPelvisOffsetCommit(LLUICtrl*, void*); static void onUploadJointsCommit(LLUICtrl*,void*); static void onUploadSkinCommit(LLUICtrl*,void*); - - static void onPhysicsLoadRadioCommit(LLUICtrl*,void *data); static void onPreviewLODCommit(LLUICtrl*,void*); diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index 31b6fc77f5..041b72a28e 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -84,6 +84,9 @@ name="LtYellow" value="1 1 .79 1" /> + Idle @@ -33,7 +33,7 @@ left="3" name="left_panel" top_pad="10" - width="530"> + width="630"> Model name: @@ -83,8 +84,8 @@ - + @@ -95,7 +96,7 @@ top_pad="15" left="0" height="300" - width="525" + width="625" name="import_tab" tab_position="top"> @@ -260,150 +261,356 @@ - - - PHYSICS GEOMETRY - - - - - - - - - - Lowest - - - Low - - - Medium - - - High - - - - -