|
|
@@ -38,11 +38,11 @@ namespace Urho3D
|
|
|
AttributeAnimation::AttributeAnimation(Context* context) :
|
|
|
Resource(context),
|
|
|
interpolationMethod_(IM_LINEAR),
|
|
|
+ splineTension_(0.5f),
|
|
|
valueType_(VAR_NONE),
|
|
|
isInterpolatable_(false),
|
|
|
beginTime_(M_INFINITY),
|
|
|
endTime_(-M_INFINITY),
|
|
|
- splineTension_(0.5f),
|
|
|
splineTangentsDirty_(false)
|
|
|
{
|
|
|
}
|
|
|
@@ -239,18 +239,18 @@ ObjectAnimation* AttributeAnimation::GetObjectAnimation() const
|
|
|
|
|
|
void AttributeAnimation::UpdateAttributeValue(Animatable* animatable, const AttributeInfo& attributeInfo, float scaledTime)
|
|
|
{
|
|
|
- unsigned index = 1;
|
|
|
- for (; index < keyFrames_.Size(); ++index)
|
|
|
- {
|
|
|
- if (scaledTime < keyFrames_[index].time_)
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (index >= keyFrames_.Size() || !isInterpolatable_)
|
|
|
- animatable->OnSetAttribute(attributeInfo, keyFrames_[index - 1].value_);
|
|
|
- else
|
|
|
- {
|
|
|
- if (interpolationMethod_ == IM_LINEAR)
|
|
|
+ unsigned index = 1;
|
|
|
+ for (; index < keyFrames_.Size(); ++index)
|
|
|
+ {
|
|
|
+ if (scaledTime < keyFrames_[index].time_)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (index >= keyFrames_.Size() || !isInterpolatable_)
|
|
|
+ animatable->OnSetAttribute(attributeInfo, keyFrames_[index - 1].value_);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (interpolationMethod_ == IM_LINEAR)
|
|
|
animatable->OnSetAttribute(attributeInfo, LinearInterpolation(index - 1, index, scaledTime));
|
|
|
else
|
|
|
animatable->OnSetAttribute(attributeInfo, SplineInterpolation(index - 1, index, scaledTime));
|
|
|
@@ -416,4 +416,4 @@ Variant AttributeAnimation::SubstractAndMultiply(const Variant& value1, const Va
|
|
|
return Variant::EMPTY;
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|