From 2cbf4a15df940d92d38003d302e61fda14e1dc51 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 9 Feb 2024 12:34:02 -0800 Subject: secondlife/viewer#773: Fix RenderTerrainPBREnabled requiring restart and respect simulator feature PBRTerrainEnabled --- indra/newview/llfloaterregioninfo.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') 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 feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); LLTextBox* texture_text = getChild("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("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); -- cgit v1.2.3