summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-07-02 11:44:14 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-07-02 19:34:37 +0300
commit886be2faf19343843d8b2bf7a24c91bdeb1a9294 (patch)
tree69e301ea4c1665eb994e8a34fad8c0afabebe5d1 /indra/newview/llfloaterregioninfo.cpp
parentcb2795748eec373b11154c2825a3ecf2633938be (diff)
viewer#1857 Reset texture transforms when terrain PBR is applied
ctrls aren't dynamically alocated so getChild is preferable, but since other elements use findchild and validy checks used findChild as well
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index c019bd047d..d6ffab5825 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1561,7 +1561,7 @@ bool LLPanelRegionTerrainInfo::postBuild()
{
mTextureDetailCtrl[i]->setBakeTextureEnabled(false);
}
- initAndSetCtrl(mMaterialDetailCtrl[i], llformat("material_detail_%d", i));
+ initMaterialCtrl(mMaterialDetailCtrl[i], llformat("material_detail_%d", i), i);
initAndSetCtrl(mMaterialScaleUCtrl[i], llformat("terrain%dScaleU", i));
initAndSetCtrl(mMaterialScaleVCtrl[i], llformat("terrain%dScaleV", i));
@@ -1958,6 +1958,31 @@ bool LLPanelRegionTerrainInfo::sendUpdate()
return true;
}
+void LLPanelRegionTerrainInfo::initMaterialCtrl(LLTextureCtrl*& ctrl, const std::string& name, S32 index)
+{
+ ctrl = findChild<LLTextureCtrl>(name, true);
+ if (!ctrl) return;
+
+ // consume cancel events, otherwise they will trigger commit callbacks
+ ctrl->setOnCancelCallback([](LLUICtrl* ctrl, const LLSD& param) {});
+ ctrl->setCommitCallback(
+ [this, index](LLUICtrl* ctrl, const LLSD& param)
+ {
+ if (!mMaterialScaleUCtrl[index]
+ || !mMaterialScaleVCtrl[index]
+ || !mMaterialRotationCtrl[index]
+ || !mMaterialOffsetUCtrl[index]
+ || !mMaterialOffsetVCtrl[index]) return;
+
+ mMaterialScaleUCtrl[index]->setValue(1.f);
+ mMaterialScaleVCtrl[index]->setValue(1.f);
+ mMaterialRotationCtrl[index]->setValue(0.f);
+ mMaterialOffsetUCtrl[index]->setValue(0.f);
+ mMaterialOffsetVCtrl[index]->setValue(0.f);
+ onChangeAnything();
+ });
+}
+
bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);