summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 2c743d596e..8b335d57d7 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1441,6 +1441,11 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
mAskedTextureHeights = false;
mConfirmedTextureHeights = false;
+ if (!mRegionChangedSlot.connected())
+ {
+ mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLPanelRegionTerrainInfo::onRegionChanged,this));
+ }
+
refresh();
return LLPanelRegionInfo::postBuild();
@@ -1449,8 +1454,7 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
// virtual
void LLPanelRegionTerrainInfo::refresh()
{
- // For simplicity, require restart
- static BOOL feature_pbr_terrain_enabled = gSavedSettings.getBOOL("RenderTerrainPBREnabled");
+ static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false);
LLTextBox* texture_text = getChild<LLTextBox>("detail_texture_text");
if (texture_text) { texture_text->setVisible(!feature_pbr_terrain_enabled); }
@@ -1512,6 +1516,27 @@ void LLPanelRegionTerrainInfo::onSelectMaterialType()
}
}
+void LLPanelRegionTerrainInfo::onRegionChanged()
+{
+ LLViewerRegion *region = gAgent.getRegion();
+ if (!region) { return; }
+
+ if (region->simulatorFeaturesReceived())
+ {
+ onSimulatorFeaturesReceived(region->getRegionID(), region);
+ }
+ else
+ {
+ // See "RenderTerrainPBREnabled" in LLViewerRegion::setSimulatorFeatures
+ region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLPanelRegionTerrainInfo::onSimulatorFeaturesReceived,this,_1, _2));
+ }
+}
+
+void LLPanelRegionTerrainInfo::onSimulatorFeaturesReceived(const LLUUID& region_id, LLViewerRegion* regionp)
+{
+ refresh();
+}
+
// virtual
bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
@@ -1568,6 +1593,9 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
LL_DEBUGS() << "no region set" << LL_ENDL;
getChild<LLUICtrl>("region_text")->setValue(LLSD(""));
}
+
+ // Update visibility of terrain swatches, etc
+ refresh();
getChildView("download_raw_btn")->setEnabled(owner_or_god);
getChildView("upload_raw_btn")->setEnabled(owner_or_god);