diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-01-26 09:34:03 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-01-26 09:34:03 +0200 |
commit | ca5026c60db679c6ee4f64f460bcc96c0ad03e2e (patch) | |
tree | e0da4ae3cd72dcdca8eea4f86f7638b31bb12780 /indra/newview/llfloaterregioninfo.cpp | |
parent | ec7f17d5b0f8269da11941476c3c5801e480c849 (diff) |
MAINT-6082 Value checks for Viewer terrain Elevation Ranges
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 16566bea73..df5b226d98 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1184,6 +1184,22 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes() return TRUE; } +BOOL LLPanelRegionTerrainInfo::validateTextureHeights() +{ + for (S32 i = 0; i < CORNER_COUNT; ++i) + { + std::string low = llformat("height_start_spin_%d", i); + std::string high = llformat("height_range_spin_%d", i); + + if (getChild<LLUICtrl>(low)->getValue().asReal() > getChild<LLUICtrl>(high)->getValue().asReal()) + { + return FALSE; + } + } + + return TRUE; +} + ///////////////////////////////////////////////////////////////////////////// // LLPanelRegionTerrainInfo ///////////////////////////////////////////////////////////////////////////// @@ -1216,6 +1232,9 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("upload_raw_btn", onClickUploadRaw, this); childSetAction("bake_terrain_btn", onClickBakeTerrain, this); + mAskedTextureHeights = false; + mConfirmedTextureHeights = false; + return LLPanelRegionInfo::postBuild(); } @@ -1298,6 +1317,21 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() return FALSE; } + // Check if terrain Elevation Ranges are correct + if (gSavedSettings.getBOOL("RegionCheckTextureHeights") && !validateTextureHeights()) + { + if (!mAskedTextureHeights) + { + LLNotificationsUtil::add("ConfirmTextureHeights", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackTextureHeights, this, _1, _2)); + mAskedTextureHeights = true; + return FALSE; + } + else if (!mConfirmedTextureHeights) + { + return FALSE; + } + } + LLTextureCtrl* texture_ctrl; std::string id_str; LLMessageSystem* msg = gMessageSystem; @@ -1338,6 +1372,29 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() return TRUE; } +bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // ok + { + mConfirmedTextureHeights = true; + } + else if (option == 1) // cancel + { + mConfirmedTextureHeights = false; + } + else if (option == 2) // don't ask + { + gSavedSettings.setBOOL("RegionCheckTextureHeights", FALSE); + mConfirmedTextureHeights = true; + } + + onBtnSet(); + + mAskedTextureHeights = false; + return false; +} + // static void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) { |