summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2024-03-01 17:26:24 -0800
committerCosmic Linden <cosmic@lindenlab.com>2024-03-01 17:26:24 -0800
commit94c5baeb6146598a9a280e27e584c241b7b3b9e0 (patch)
treec2d4d581a12e9bf8cb034f18f200ffb89fcbce60 /indra
parent0cb9e7f7e5bd02ded8b9f2bd9cd6c57a70187dcc (diff)
secondlife/viewer#712: Use checkbox to make it more obvious that only one set of terrain assets is preserved. Clean up enums.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp56
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_terrain.xml45
2 files changed, 46 insertions, 55 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index a865ad19d3..6e8e37621e 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -602,24 +602,14 @@ LLPanelRegionEnvironment* LLFloaterRegionInfo::getPanelEnvironment()
return panel;
}
-enum class TerrainMaterialType
+LLTerrainMaterials::Type material_type_from_ctrl(LLCheckBoxCtrl* ctrl)
{
- TEXTURE,
- PBR_MATERIAL,
- COUNT
-};
+ return ctrl->get() ? LLTerrainMaterials::Type::PBR : LLTerrainMaterials::Type::TEXTURE;
+}
-TerrainMaterialType material_type_from_index(S32 index)
+void material_type_to_ctrl(LLCheckBoxCtrl* ctrl, LLTerrainMaterials::Type new_type)
{
- if (index == 0)
- {
- return TerrainMaterialType::TEXTURE;
- }
- if (index == 1)
- {
- return TerrainMaterialType::PBR_MATERIAL;
- }
- return TerrainMaterialType::COUNT;
+ ctrl->set(new_type == LLTerrainMaterials::Type::PBR);
}
// static
@@ -1324,11 +1314,11 @@ void LLPanelRegionDebugInfo::onClickDebugConsole(void* data)
BOOL LLPanelRegionTerrainInfo::validateTextureSizes()
{
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
if (material_type_ctrl)
{
- const TerrainMaterialType material_type = material_type_from_index(material_type_ctrl->getCurrentIndex());
- const bool is_material_selected = material_type == TerrainMaterialType::PBR_MATERIAL;
+ const LLTerrainMaterials::Type material_type = material_type_from_ctrl(material_type_ctrl);
+ const bool is_material_selected = material_type == LLTerrainMaterials::Type::PBR;
if (is_material_selected) { return TRUE; }
}
@@ -1466,11 +1456,11 @@ void LLPanelRegionTerrainInfo::onSelectMaterialType()
void LLPanelRegionTerrainInfo::updateForMaterialType()
{
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
if (!material_type_ctrl) { return; }
- const TerrainMaterialType material_type = material_type_from_index(material_type_ctrl->getCurrentIndex());
- const bool show_texture_controls = material_type == TerrainMaterialType::TEXTURE;
- const bool show_material_controls = material_type == TerrainMaterialType::PBR_MATERIAL;
+ const LLTerrainMaterials::Type material_type = material_type_from_ctrl(material_type_ctrl);
+ const bool show_texture_controls = material_type == LLTerrainMaterials::Type::TEXTURE;
+ const bool show_material_controls = material_type == LLTerrainMaterials::Type::PBR;
// Toggle visibility of correct swatches
std::string buffer;
@@ -1493,6 +1483,12 @@ void LLPanelRegionTerrainInfo::updateForMaterialType()
texture_ctrl->setVisible(show_material_controls);
}
}
+
+ // Toggle visibility of labels
+ LLUICtrl* texture_label = getChild<LLUICtrl>("detail_texture_text");
+ if (texture_label) { texture_label->setVisible(show_texture_controls); }
+ LLUICtrl* material_label = getChild<LLUICtrl>("detail_material_text");
+ if (material_label) { material_label->setVisible(show_material_controls); }
}
void LLPanelRegionTerrainInfo::onRegionChanged()
@@ -1538,9 +1534,6 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
const bool textures_ready = compp->texturesReady(false, false);
const bool materials_ready = feature_pbr_terrain_enabled && compp->materialsReady(false, false);
- LLTextBox* texture_text = getChild<LLTextBox>("detail_texture_text");
- if (texture_text) { texture_text->setVisible(!feature_pbr_terrain_enabled); }
-
bool set_texture_swatches;
bool set_material_swatches;
bool reset_texture_swatches;
@@ -1565,9 +1558,10 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
reset_material_swatches = !set_material_swatches;
}
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
- if (material_type_ctrl) { material_type_ctrl->setCurrentByIndex(S32(material_type)); }
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
+ if (material_type_ctrl) { material_type_to_ctrl(material_type_ctrl, material_type); }
updateForMaterialType();
+ material_type_ctrl->setVisible(feature_pbr_terrain_enabled);
LLTextureCtrl* asset_ctrl;
std::string buffer;
@@ -1698,11 +1692,11 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
// Send either material IDs instead of texture IDs depending on
// terrain_material_type - they both occupy the same slot.
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
- const TerrainMaterialType material_type = material_type_ctrl ? material_type_from_index(material_type_ctrl->getCurrentIndex()) : TerrainMaterialType::TEXTURE;
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
+ const LLTerrainMaterials::Type material_type = material_type_ctrl ? material_type_from_ctrl(material_type_ctrl) : LLTerrainMaterials::Type::TEXTURE;
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- if (material_type == TerrainMaterialType::PBR_MATERIAL)
+ if (material_type == LLTerrainMaterials::Type::PBR)
{
buffer = llformat("material_detail_%d", i);
}
@@ -1720,7 +1714,7 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
strings.push_back(buffer);
// Store asset for later terrain editing
- if (material_type == TerrainMaterialType::PBR_MATERIAL)
+ if (material_type == LLTerrainMaterials::Type::PBR)
{
mLastSetMaterials[i] = tmp_id;
}
diff --git a/indra/newview/skins/default/xui/en/panel_region_terrain.xml b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
index 88855ab739..f8d2c90d0a 100644
--- a/indra/newview/skins/default/xui/en/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
@@ -76,33 +76,17 @@
left="8"
top="30"
width="460" />
- <combo_box
- layout="topleft"
- left="10"
- top="105"
- follows="left|top"
- name="terrain_material_type"
- width="170">
- <combo_box.item
- label="Terrain Textures"
- name="Textures"
- value="Textures" />
- <combo_box.item
- label="Terrain PBR Materials"
- name="PBRMaterials"
- value="PBRMaterials" />
- </combo_box>
<text
type="string"
length="1"
- follows="left|top"
halign="left"
valign="center"
+ follows="left|top"
height="20"
layout="topleft"
name="detail_texture_text"
- top_delta="0"
- left_delta="0"
+ left="10"
+ top="105"
width="170">
Terrain Textures
</text>
@@ -114,12 +98,25 @@
follows="left|top"
height="20"
layout="topleft"
- top_delta="0"
- left_delta="180"
- name="detail_texture_limits_text"
- width="200">
- Maximum size: 1024x1024
+ name="detail_material_text"
+ left="10"
+ top="105"
+ width="170">
+ Terrain Materials
</text>
+ <check_box
+ height="20"
+ halign="left"
+ valign="center"
+ follows="left|top"
+ layout="topleft"
+ top_delta="1"
+ left_delta="180"
+ label="PBR Metallic Roughness"
+ name="terrain_material_type"
+ tool_tip="If checked, use PBR Metallic Roughness materials for terrain. Otherwise, use textures."
+ left_pad="2"
+ width="200" />
<texture_picker
follows="left|top"
height="100"