summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-05-17 12:05:31 -0700
committerRider Linden <rider@lindenlab.com>2018-05-17 12:05:31 -0700
commitb117a9ea197a084eeec1e8330dbe7c562423e248 (patch)
treee1fd0a023c0ac2116ae36da4022aa37ffc39c0f5
parent3d224c66cbb449b99545b93fb9742f32aca4ad5d (diff)
Fix end of cycle trigger for time blender.
-rw-r--r--indra/llinventory/llsettingsbase.cpp17
-rw-r--r--indra/llinventory/llsettingsbase.h3
2 files changed, 17 insertions, 3 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index daf42fc073..a6a7a9acf9 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -542,9 +542,7 @@ 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());
+ triggerComplete();
return 1.0;
}
blendf = llclamp(blendf, 0.0, 1.0);
@@ -556,11 +554,24 @@ F64 LLSettingsBlender::setPosition(F64 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.
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index ee0a86010c..d304638d20 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -306,6 +306,9 @@ public:
virtual void update(F64 blendf);
virtual F64 setPosition(F64 blendf);
+protected:
+ void triggerComplete();
+
private:
finish_signal_t mOnFinished;