summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r--indra/newview/llpanelface.cpp94
1 files changed, 81 insertions, 13 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 9150b89de3..5f8071d3eb 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -1094,7 +1094,21 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
prev_obj_id = objectp->getID();
}
}
-
+ else
+ {
+ if (prev_obj_id != objectp->getID())
+ {
+ if (has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL))
+ {
+ mComboMatMedia->selectNthItem(MATMEDIA_PBR);
+ }
+ else if (!has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR))
+ {
+ mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
+ }
+ prev_obj_id = objectp->getID();
+ }
+ }
mComboMatMedia->setEnabled(editable);
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
@@ -1880,15 +1894,53 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
}
}
+// One-off listener that updates the build floater UI when the agent inventory adds or removes an item
+class PBRPickerAgentListener : public LLInventoryObserver
+{
+protected:
+ bool mChangePending = true;
+public:
+ PBRPickerAgentListener() : LLInventoryObserver()
+ {
+ gInventory.addObserver(this);
+ }
+
+ const bool isListening()
+ {
+ return mChangePending;
+ }
+
+ void changed(U32 mask) override
+ {
+ if (!(mask & (ADD | REMOVE)))
+ {
+ return;
+ }
+
+ if (gFloaterTools)
+ {
+ gFloaterTools->dirty();
+ }
+ gInventory.removeObserver(this);
+ mChangePending = false;
+ }
+
+ ~PBRPickerAgentListener() override
+ {
+ gInventory.removeObserver(this);
+ mChangePending = false;
+ }
+};
+
// One-off listener that updates the build floater UI when the prim inventory updates
-class PBRPickerItemListener : public LLVOInventoryListener
+class PBRPickerObjectListener : public LLVOInventoryListener
{
protected:
LLViewerObject* mObjectp;
bool mChangePending = true;
public:
- PBRPickerItemListener(LLViewerObject* object)
+ PBRPickerObjectListener(LLViewerObject* object)
: mObjectp(object)
{
registerVOInventoryListener(mObjectp, nullptr);
@@ -1912,7 +1964,7 @@ public:
mChangePending = false;
}
- ~PBRPickerItemListener()
+ ~PBRPickerObjectListener()
{
removeVOInventoryListener();
mChangePending = false;
@@ -1931,9 +1983,9 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
// pbr material
LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control");
+ LLUUID pbr_id;
if (pbr_ctrl)
{
- LLUUID pbr_id;
LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr);
pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE);
@@ -1942,7 +1994,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
if (objectp->isAttachment())
{
- pbr_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY);
+ pbr_ctrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY);
}
else
{
@@ -1956,14 +2008,25 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
if (objectp->isInventoryPending())
{
// Reuse the same listener when possible
- if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp))
+ if (!mVOInventoryListener || !mVOInventoryListener->isListeningFor(objectp))
{
- mInventoryListener = std::make_unique<PBRPickerItemListener>(objectp);
+ mVOInventoryListener = std::make_unique<PBRPickerObjectListener>(objectp);
}
}
else
{
- mInventoryListener = nullptr;
+ mVOInventoryListener = nullptr;
+ }
+ if (!identical_pbr || pbr_id.isNull() || pbr_id == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID)
+ {
+ mAgentInventoryListener = nullptr;
+ }
+ else
+ {
+ if (!mAgentInventoryListener || !mAgentInventoryListener->isListening())
+ {
+ mAgentInventoryListener = std::make_unique<PBRPickerAgentListener>();
+ }
}
const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled();
@@ -4227,6 +4290,7 @@ void LLPanelFace::onCopyTexture()
te_data["te"]["bumpmap"] = tep->getBumpmap();
te_data["te"]["bumpshiny"] = tep->getBumpShiny();
te_data["te"]["bumpfullbright"] = tep->getBumpShinyFullbright();
+ te_data["te"]["texgen"] = tep->getTexGen();
te_data["te"]["pbr"] = objectp->getRenderMaterialID(te);
if (tep->getGLTFMaterialOverride() != nullptr)
{
@@ -4622,6 +4686,11 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
{
objectp->setTEBumpShinyFullbright(te, (U8)te_data["te"]["bumpfullbright"].asInteger());
}
+ if (te_data["te"].has("texgen"))
+ {
+ objectp->setTETexGen(te, (U8)te_data["te"]["texgen"].asInteger());
+ }
+
// PBR/GLTF
if (te_data["te"].has("pbr"))
{
@@ -4690,8 +4759,6 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
{
LLUUID object_id = objectp->getID();
- LLSelectedTEMaterial::setAlphaMaskCutoff(this, (U8)te_data["material"]["SpecRot"].asInteger(), te, object_id);
-
// Normal
// Replace placeholders with target's
if (te_data["material"].has("NormMapNoCopy"))
@@ -4733,11 +4800,12 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
LLSelectedTEMaterial::setSpecularOffsetX(this, (F32)te_data["material"]["SpecOffX"].asReal(), te, object_id);
LLSelectedTEMaterial::setSpecularOffsetY(this, (F32)te_data["material"]["SpecOffY"].asReal(), te, object_id);
LLSelectedTEMaterial::setSpecularRotation(this, (F32)te_data["material"]["SpecRot"].asReal(), te, object_id);
- LLColor4 spec_color(te_data["material"]["SpecColor"]);
+ LLColor4U spec_color(te_data["material"]["SpecColor"]);
LLSelectedTEMaterial::setSpecularLightColor(this, spec_color, te);
LLSelectedTEMaterial::setSpecularLightExponent(this, (U8)te_data["material"]["SpecExp"].asInteger(), te, object_id);
LLSelectedTEMaterial::setEnvironmentIntensity(this, (U8)te_data["material"]["EnvIntensity"].asInteger(), te, object_id);
- LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["SpecRot"].asInteger(), te, object_id);
+ LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["DiffuseAlphaMode"].asInteger(), te, object_id);
+ LLSelectedTEMaterial::setAlphaMaskCutoff(this, (U8)te_data["material"]["AlphaMaskCutoff"].asInteger(), te, object_id);
if (te_data.has("te") && te_data["te"].has("shiny"))
{
objectp->setTEShiny(te, (U8)te_data["te"]["shiny"].asInteger());