From 4975bd03c12673778616e1cca1811bf906bb42a6 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 16 May 2018 13:42:48 -0700 Subject: Splitting the blender up to support manual positioning as well as time. Phase1 --- indra/llinventory/llsettingsbase.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f2dfeaf154..daf42fc073 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -52,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()), @@ -535,21 +533,37 @@ 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) { + mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); - return; + 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 LLSettingsBlenderTimeDelta::update(F64 timedelta) +{ + mTimeSpent += F64Seconds(timedelta); + + F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); + + // Note no clamp here. + + setPosition(blendf); +} -- cgit v1.2.3