summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterregioninfo.cpp83
-rw-r--r--indra/newview/llfloaterregioninfo.h3
-rw-r--r--indra/newview/llpanelface.cpp2
-rw-r--r--indra/newview/lltexturectrl.cpp60
-rw-r--r--indra/newview/lltexturectrl.h32
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_terrain.xml76
6 files changed, 212 insertions, 44 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 49ed58e766..8c795432ea 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1394,12 +1394,20 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
initCtrl("terrain_raise_spin");
initCtrl("terrain_lower_spin");
+ getChild<LLUICtrl>("terrain_material_type")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onSelectMaterialType, this));
+
std::string buffer;
+
for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
{
buffer = llformat("texture_detail_%d", i);
initCtrl(buffer);
}
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("material_detail_%d", i);
+ initCtrl(buffer);
+ }
for(S32 i = 0; i < CORNER_COUNT; ++i)
{
@@ -1419,6 +1427,81 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
return LLPanelRegionInfo::postBuild();
}
+enum class TerrainMaterialType
+{
+ TEXTURE,
+ PBR_MATERIAL,
+ COUNT
+};
+
+TerrainMaterialType material_type_from_index(S32 index)
+{
+ if (index == 0)
+ {
+ return TerrainMaterialType::TEXTURE;
+ }
+ if (index == 1)
+ {
+ return TerrainMaterialType::PBR_MATERIAL;
+ }
+ return TerrainMaterialType::COUNT;
+}
+
+// virtual
+void LLPanelRegionTerrainInfo::refresh()
+{
+ std::string buffer;
+
+ bool has_material_assets = false;
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("material_detail_%d", i);
+ LLTextureCtrl* material_ctrl = getChild<LLTextureCtrl>(buffer);
+ if (material_ctrl && material_ctrl->getImageAssetID().notNull())
+ {
+ has_material_assets = true;
+ break;
+ }
+ }
+
+ LLComboBox* material_type_ctrl = getChild<LLComboBox>("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;
+ material_type_ctrl->setEnabled(!(is_material_selected && has_material_assets));
+ }
+}
+
+void LLPanelRegionTerrainInfo::onSelectMaterialType()
+{
+ LLComboBox* material_type_ctrl = getChild<LLComboBox>("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;
+ std::string buffer;
+ LLTextureCtrl* texture_ctrl;
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if (texture_ctrl)
+ {
+ texture_ctrl->setVisible(show_texture_controls);
+ }
+ }
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("material_detail_%d", i);
+ texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if (texture_ctrl)
+ {
+ texture_ctrl->setVisible(show_material_controls);
+ }
+ }
+}
+
// virtual
bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index c34dbb62e8..7b22002806 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -258,6 +258,9 @@ public:
//static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button
+ void refresh() override;
+ void onSelectMaterialType();
+
virtual BOOL sendUpdate();
static void onClickDownloadRaw(void*);
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 7d6015f557..ba379f77d8 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -328,7 +328,7 @@ BOOL LLPanelFace::postBuild()
pbr_ctrl->setImmediateFilterPermMask(PERM_NONE);
pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
pbr_ctrl->setBakeTextureEnabled(false);
- pbr_ctrl->setInventoryPickType(LLTextureCtrl::PICK_MATERIAL);
+ pbr_ctrl->setInventoryPickType(EPickInventoryType::MATERIAL);
}
mTextureCtrl = getChild<LLTextureCtrl>("texture control");
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 0dd1ff5483..ef58bba71e 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -176,7 +176,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mSetImageAssetIDCallback(NULL),
mOnUpdateImageStatsCallback(NULL),
mBakeTextureEnabled(FALSE),
- mInventoryPickType(LLTextureCtrl::PICK_TEXTURE)
+ mInventoryPickType(EPickInventoryType::TEXTURE)
{
mCanApplyImmediately = can_apply_immediately;
buildFromFile("floater_texture_ctrl.xml");
@@ -356,11 +356,11 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
bool is_material = cargo_type == DAD_MATERIAL;
bool allow_dnd = false;
- if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
allow_dnd = is_material;
}
- else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ else if (mInventoryPickType == EPickInventoryType::TEXTURE)
{
allow_dnd = is_texture || is_mesh;
}
@@ -570,7 +570,7 @@ void LLFloaterTexturePicker::draw()
mGLTFMaterial = NULL;
if (mImageAssetID.notNull())
{
- if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
mGLTFMaterial = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mImageAssetID);
llassert(mGLTFMaterial == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(gGLTFMaterialList.getMaterial(mImageAssetID)) != nullptr);
@@ -901,7 +901,7 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
self->getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == 2 ? TRUE : FALSE);
bool pipette_visible = (index == 0)
- && (self->mInventoryPickType != LLTextureCtrl::PICK_MATERIAL);
+ && (self->mInventoryPickType != EPickInventoryType::MATERIAL);
self->getChild<LLButton>("Pipette")->setVisible(pipette_visible);
if (index == 2)
@@ -966,15 +966,15 @@ void LLFloaterTexturePicker::onBtnAdd(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata;
- if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ if (self->mInventoryPickType == EPickInventoryType::TEXTURE_MATERIAL)
{
LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_MATERIAL_TEXTURE, true);
}
- else if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ else if (self->mInventoryPickType == EPickInventoryType::TEXTURE)
{
LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_IMAGE, true);
}
- else if (self->mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ else if (self->mInventoryPickType == EPickInventoryType::MATERIAL)
{
LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_MATERIAL, true);
}
@@ -1229,16 +1229,16 @@ void LLFloaterTexturePicker::refreshLocalList()
{
mLocalScrollCtrl->clearRows();
- if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::TEXTURE_MATERIAL)
{
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
}
- else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ else if (mInventoryPickType == EPickInventoryType::TEXTURE)
{
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
}
- else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ else if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
}
@@ -1248,18 +1248,18 @@ void LLFloaterTexturePicker::refreshInventoryFilter()
{
U32 filter_types = 0x0;
- if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::TEXTURE_MATERIAL)
{
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
}
- else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ else if (mInventoryPickType == EPickInventoryType::TEXTURE)
{
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
}
- else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ else if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
}
@@ -1294,13 +1294,13 @@ void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
onModeSelect(0, this);
}
-void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryType type)
+void LLFloaterTexturePicker::setInventoryPickType(EPickInventoryType type)
{
mInventoryPickType = type;
refreshLocalList();
refreshInventoryFilter();
- if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
getChild<LLButton>("Pipette")->setVisible(false);
}
@@ -1316,7 +1316,7 @@ void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryT
setTitle(pick + mLabel);
}
- else if(mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ else if(mInventoryPickType == EPickInventoryType::MATERIAL)
{
setTitle(getString("pick_material"));
}
@@ -1352,16 +1352,16 @@ void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& fi
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)handle.get();
self->mLocalScrollCtrl->clearRows();
- if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ if (self->mInventoryPickType == EPickInventoryType::TEXTURE_MATERIAL)
{
LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
}
- else if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ else if (self->mInventoryPickType == EPickInventoryType::TEXTURE)
{
LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
}
- else if (self->mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ else if (self->mInventoryPickType == EPickInventoryType::MATERIAL)
{
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
}
@@ -1374,7 +1374,7 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
if (inventory_item_id.notNull())
{
LLToolPipette::getInstance()->setResult(TRUE, "");
- if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
// tes have no data about material ids
// Plus gltf materials are layered with overrides,
@@ -1425,7 +1425,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mShowLoadingPlaceholder( TRUE ),
mOpenTexPreview(false),
mBakeTextureEnabled(true),
- mInventoryPickType(PICK_TEXTURE),
+ mInventoryPickType(p.pick_type),
mImageAssetID(p.image_id),
mDefaultImageAssetID(p.default_image_id),
mDefaultImageName(p.default_image_name),
@@ -1680,7 +1680,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
if (!mOpenTexPreview)
{
showPicker(FALSE);
- if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
//grab materials first...
LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL));
@@ -1860,11 +1860,11 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
bool is_material = cargo_type == DAD_MATERIAL;
bool allow_dnd = false;
- if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ if (mInventoryPickType == EPickInventoryType::MATERIAL)
{
allow_dnd = is_material;
}
- else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ else if (mInventoryPickType == EPickInventoryType::TEXTURE)
{
allow_dnd = is_texture || is_mesh;
}
@@ -2097,6 +2097,16 @@ LLSD LLTextureCtrl::getValue() const
return LLSD(getImageAssetID());
}
+namespace LLInitParam
+{
+ void TypeValues<EPickInventoryType>::declareValues()
+ {
+ declare("texture_material", EPickInventoryType::TEXTURE_MATERIAL);
+ declare("texture", EPickInventoryType::TEXTURE);
+ declare("material", EPickInventoryType::MATERIAL);
+ }
+}
+
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index c66e618782..28630d4ac4 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -64,10 +64,25 @@ bool get_is_predefined_texture(LLUUID asset_id);
LLUUID get_copy_free_item_by_asset_id(LLUUID image_id, bool no_trans_perm = false);
bool get_can_copy_texture(LLUUID image_id);
+enum class EPickInventoryType
+{
+ TEXTURE_MATERIAL = 0,
+ TEXTURE = 1,
+ MATERIAL = 2,
+};
+
+namespace LLInitParam
+{
+ template<>
+ struct TypeValues<EPickInventoryType> : public TypeValuesHelper<EPickInventoryType>
+ {
+ static void declareValues();
+ };
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
// LLTextureCtrl
-
class LLTextureCtrl
: public LLUICtrl
{
@@ -79,19 +94,13 @@ public:
TEXTURE_CANCEL
} ETexturePickOp;
- typedef enum e_pick_inventory_type
- {
- PICK_TEXTURE_MATERIAL = 0,
- PICK_TEXTURE = 1,
- PICK_MATERIAL = 2,
- } EPickInventoryType;
-
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<LLUUID> image_id;
Optional<LLUUID> default_image_id;
Optional<std::string> default_image_name;
+ Optional<EPickInventoryType> pick_type;
Optional<bool> allow_no_texture;
Optional<bool> can_apply_immediately;
Optional<bool> no_commit_on_selection; // alternative mode: commit occurs and the widget gets dirty
@@ -109,6 +118,7 @@ public:
: image_id("image"),
default_image_id("default_image_id"),
default_image_name("default_image_name"),
+ pick_type("pick_type", EPickInventoryType::TEXTURE),
allow_no_texture("allow_no_texture", false),
can_apply_immediately("can_apply_immediately"),
no_commit_on_selection("no_commit_on_selection", false),
@@ -260,7 +270,7 @@ private:
S32 mLabelWidth;
bool mOpenTexPreview;
bool mBakeTextureEnabled;
- LLTextureCtrl::EPickInventoryType mInventoryPickType;
+ EPickInventoryType mInventoryPickType;
};
//////////////////////////////////////////////////////////////////////////////////////////
@@ -350,7 +360,7 @@ public:
void setLocalTextureEnabled(BOOL enabled);
void setBakeTextureEnabled(BOOL enabled);
- void setInventoryPickType(LLTextureCtrl::EPickInventoryType type);
+ void setInventoryPickType(EPickInventoryType type);
static void onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle);
@@ -396,7 +406,7 @@ private:
bool mCanApply;
bool mCanPreview;
bool mPreviewSettingChanged;
- LLTextureCtrl::EPickInventoryType mInventoryPickType;
+ EPickInventoryType mInventoryPickType;
texture_selected_callback mTextureSelectedCallback;
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 5e0dad445f..e36fb05647 100644
--- a/indra/newview/skins/default/xui/en/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
@@ -76,29 +76,47 @@
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"
+ halign="left"
+ valign="center"
follows="left|top"
height="20"
layout="topleft"
- left="10"
+ top_delta="0"
+ left_delta="180"
name="detail_texture_text"
- top="110"
- width="300">
- Terrain Textures (maximum size: 1024x1024)
+ width="200">
+ Maximum size: 1024x1024
</text>
<texture_picker
follows="left|top"
height="100"
layout="topleft"
- left_delta="0"
+ left="10"
name="texture_detail_0"
default_image_id="0bc58228-74a0-7e83-89bc-5c23464bcec5"
- top_delta="20"
+ top_delta="30"
width="100" />
<texture_picker
- follows="left|top"
+ follows="top"
height="100"
layout="topleft"
left_pad="10"
@@ -124,6 +142,50 @@
default_image_id="53a2f406-4895-1d13-d541-d2e3b86bc19c"
top_delta="0"
width="100" />
+ <texture_picker
+ visible="false"
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left="10"
+ name="material_detail_0"
+ pick_type="material"
+ allow_no_texture="true"
+ top_delta="0"
+ width="100" />
+ <texture_picker
+ visible="false"
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left_pad="10"
+ name="material_detail_1"
+ pick_type="material"
+ allow_no_texture="true"
+ top_delta="0"
+ width="100" />
+ <texture_picker
+ visible="false"
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left_pad="10"
+ name="material_detail_2"
+ pick_type="material"
+ allow_no_texture="true"
+ top_delta="0"
+ width="100" />
+ <texture_picker
+ visible="false"
+ follows="left|top"
+ height="100"
+ layout="topleft"
+ left_pad="10"
+ name="material_detail_3"
+ pick_type="material"
+ allow_no_texture="true"
+ top_delta="0"
+ width="100" />
<text
type="string"
length="1"