summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2024-03-08 15:13:35 -0800
committerCosmic Linden <cosmic@lindenlab.com>2024-03-08 15:14:07 -0800
commitb4eb144f14eaaa69783a268776aa890bed6cd7fe (patch)
treec33a77f79ec6b92edf7fa48da34245be8a0c0a41 /indra/newview
parent7f2e3d0f278f55d8c831273547e49077764c9f14 (diff)
secondlife/viewer#712: Consolidate accesses to texture_detail_* and material_detail_* controls
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp40
-rw-r--r--indra/newview/llfloaterregioninfo.h3
2 files changed, 18 insertions, 25 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index c6d8317128..f71cbf61fc 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1324,9 +1324,7 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes()
static const S32 MAX_TERRAIN_TEXTURE_SIZE = 1024;
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- std::string buffer;
- buffer = llformat("texture_detail_%d", i);
- LLTextureCtrl* texture_ctrl = findChild<LLTextureCtrl>(buffer);
+ LLTextureCtrl* texture_ctrl = mTextureDetailCtrl[i];
if (!texture_ctrl) continue;
LLUUID image_asset_id = texture_ctrl->getImageAssetID();
@@ -1418,11 +1416,13 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
{
buffer = llformat("texture_detail_%d", i);
initCtrl(buffer);
+ mTextureDetailCtrl[i] = findChild<LLTextureCtrl>(buffer);
}
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
buffer = llformat("material_detail_%d", i);
initCtrl(buffer);
+ mMaterialDetailCtrl[i] = findChild<LLTextureCtrl>(buffer);
}
for(S32 i = 0; i < CORNER_COUNT; ++i)
@@ -1457,12 +1457,9 @@ void LLPanelRegionTerrainInfo::updateForMaterialType()
const bool show_material_controls = material_type == LLTerrainMaterials::Type::PBR;
// Toggle visibility of correct swatches
- std::string buffer;
- LLTextureCtrl* texture_ctrl;
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- buffer = llformat("texture_detail_%d", i);
- texture_ctrl = findChild<LLTextureCtrl>(buffer);
+ LLTextureCtrl* texture_ctrl = mTextureDetailCtrl[i];
if (texture_ctrl)
{
texture_ctrl->setVisible(show_texture_controls);
@@ -1470,11 +1467,10 @@ void LLPanelRegionTerrainInfo::updateForMaterialType()
}
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- buffer = llformat("material_detail_%d", i);
- texture_ctrl = findChild<LLTextureCtrl>(buffer);
- if (texture_ctrl)
+ LLTextureCtrl* material_ctrl = mMaterialDetailCtrl[i];
+ if (material_ctrl)
{
- texture_ctrl->setVisible(show_material_controls);
+ material_ctrl->setVisible(show_material_controls);
}
}
@@ -1538,14 +1534,11 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled);
}
- LLTextureCtrl* asset_ctrl;
- std::string buffer;
if (set_texture_swatches)
{
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- buffer = llformat("texture_detail_%d", i);
- asset_ctrl = findChild<LLTextureCtrl>(buffer);
+ LLTextureCtrl* asset_ctrl = mTextureDetailCtrl[i];
if(asset_ctrl)
{
LL_DEBUGS() << "Detail Texture " << i << ": "
@@ -1559,8 +1552,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- buffer = llformat("material_detail_%d", i);
- asset_ctrl = findChild<LLTextureCtrl>(buffer);
+ LLTextureCtrl* asset_ctrl = mMaterialDetailCtrl[i];
if(asset_ctrl)
{
LL_DEBUGS() << "Detail Material " << i << ": "
@@ -1574,8 +1566,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- buffer = llformat("texture_detail_%d", i);
- asset_ctrl = findChild<LLTextureCtrl>(buffer);
+ LLTextureCtrl* asset_ctrl = mTextureDetailCtrl[i];
if(asset_ctrl)
{
asset_ctrl->setImageAssetID(mLastSetTextures[i]);
@@ -1586,8 +1577,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- buffer = llformat("material_detail_%d", i);
- asset_ctrl = findChild<LLTextureCtrl>(buffer);
+ LLTextureCtrl* asset_ctrl = mMaterialDetailCtrl[i];
if(asset_ctrl)
{
asset_ctrl->setImageAssetID(mLastSetMaterials[i]);
@@ -1595,6 +1585,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
}
}
+ std::string buffer;
for(S32 i = 0; i < CORNER_COUNT; ++i)
{
buffer = llformat("height_start_spin_%d", i);
@@ -1661,7 +1652,6 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
}
}
- LLTextureCtrl* asset_ctrl;
std::string id_str;
LLMessageSystem* msg = gMessageSystem;
@@ -1670,15 +1660,15 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
const LLTerrainMaterials::Type material_type = mMaterialTypeCtrl ? material_type_from_ctrl(mMaterialTypeCtrl) : LLTerrainMaterials::Type::TEXTURE;
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
+ LLTextureCtrl* asset_ctrl;
if (material_type == LLTerrainMaterials::Type::PBR)
{
- buffer = llformat("material_detail_%d", i);
+ asset_ctrl = mMaterialDetailCtrl[i];
}
else
{
- buffer = llformat("texture_detail_%d", i);
+ asset_ctrl = mTextureDetailCtrl[i];
}
- asset_ctrl = findChild<LLTextureCtrl>(buffer);
if (!asset_ctrl) { continue; }
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index a38344c861..99774e5db3 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -56,6 +56,7 @@ class LLRadioGroup;
class LLSliderCtrl;
class LLSpinCtrl;
class LLTextBox;
+class LLTextureCtrl;
class LLPanelRegionGeneralInfo;
class LLPanelRegionDebugInfo;
@@ -273,6 +274,8 @@ private:
bool mConfirmedTextureHeights;
bool mAskedTextureHeights;
LLCheckBoxCtrl* mMaterialTypeCtrl = nullptr;
+ LLTextureCtrl* mTextureDetailCtrl[LLTerrainMaterials::ASSET_COUNT];
+ LLTextureCtrl* mMaterialDetailCtrl[LLTerrainMaterials::ASSET_COUNT];
LLUUID mLastSetTextures[LLTerrainMaterials::ASSET_COUNT];
LLUUID mLastSetMaterials[LLTerrainMaterials::ASSET_COUNT];
};