summaryrefslogtreecommitdiff
path: root/indra/llinventory/llsettingsbase.cpp
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-18 00:27:39 +0100
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-18 00:27:39 +0100
commit242fe0610996696a026dc2dc9b1b42c4db2f852c (patch)
tree5aa7570d35fed679740df497448654f40cd4bd29 /indra/llinventory/llsettingsbase.cpp
parent39fb9cc9b4221b6fb715e9f59ae5512b76baa1ba (diff)
parent313dbc7fea54cc58ceb8bd3437b91674360a3384 (diff)
Merge
Diffstat (limited to 'indra/llinventory/llsettingsbase.cpp')
-rw-r--r--indra/llinventory/llsettingsbase.cpp47
1 files changed, 35 insertions, 12 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index 6d2e1f5b78..e297fbd94e 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -32,8 +32,6 @@
#include "llsdserialize.h"
-#pragma optimize("", off)
-
//=========================================================================
namespace
{
@@ -54,8 +52,6 @@ const std::string LLSettingsBase::SETTING_NAME("name");
const std::string LLSettingsBase::SETTING_HASH("hash");
const std::string LLSettingsBase::SETTING_TYPE("type");
-const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01);
-
//=========================================================================
LLSettingsBase::LLSettingsBase():
mSettings(LLSD::emptyMap()),
@@ -541,21 +537,48 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range)
}
//=========================================================================
-void LLSettingsBlender::update(F64Seconds timedelta)
+void LLSettingsBlender::update(F64 blendf)
{
- mTimeSpent += timedelta;
- if (mTimeSpent >= mSeconds)
+}
+
+F64 LLSettingsBlender::setPosition(F64 blendf)
+{
+ if (blendf >= 1.0)
{
- LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon
- mOnFinished(shared_from_this());
- return;
+ triggerComplete();
+ return 1.0;
}
-
- F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value();
+ blendf = llclamp(blendf, 0.0, 1.0);
//_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL;
mTarget->replaceSettings(mInitial->getSettings());
mTarget->blend(mFinal, blendf);
+
+ return blendf;
+}
+
+void LLSettingsBlender::triggerComplete()
+{
+ mTarget->replaceSettings(mFinal->getSettings());
+ LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon
+ mOnFinished(shared_from_this());
}
+//-------------------------------------------------------------------------
+void LLSettingsBlenderTimeDelta::update(F64 timedelta)
+{
+ mTimeSpent += F64Seconds(timedelta);
+
+ if (mTimeSpent > mBlendSpan)
+ {
+ triggerComplete();
+ return;
+ }
+
+ F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value();
+
+ // Note no clamp here.
+
+ setPosition(blendf);
+}