summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 8807509a2e..52eddcfc67 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -519,7 +519,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor));
panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access));
- panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue(hard_agent_limit);
+ panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue((F32)hard_agent_limit);
LLPanelRegionGeneralInfo* panel_general = LLFloaterRegionInfo::getPanelGeneral();
if (panel)
@@ -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));
@@ -1931,11 +1931,11 @@ bool LLPanelRegionTerrainInfo::sendUpdate()
for (U32 tt = 0; tt < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++tt)
{
LLGLTFMaterial::TextureTransform& transform = mat_override->mTextureTransform[tt];
- transform.mScale.mV[VX] = mMaterialScaleUCtrl[i]->getValue().asReal();
- transform.mScale.mV[VY] = mMaterialScaleVCtrl[i]->getValue().asReal();
- transform.mRotation = mMaterialRotationCtrl[i]->getValue().asReal() * DEG_TO_RAD;
- transform.mOffset.mV[VX] = mMaterialOffsetUCtrl[i]->getValue().asReal();
- transform.mOffset.mV[VY] = mMaterialOffsetVCtrl[i]->getValue().asReal();
+ transform.mScale.mV[VX] = (F32)mMaterialScaleUCtrl[i]->getValue().asReal();
+ transform.mScale.mV[VY] = (F32)mMaterialScaleVCtrl[i]->getValue().asReal();
+ transform.mRotation = (F32)mMaterialRotationCtrl[i]->getValue().asReal() * DEG_TO_RAD;
+ transform.mOffset.mV[VX] = (F32)mMaterialOffsetUCtrl[i]->getValue().asReal();
+ transform.mOffset.mV[VY] = (F32)mMaterialOffsetVCtrl[i]->getValue().asReal();
}
}
@@ -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);