void Animatable::HandleAttributeAnimationAdded(StringHash eventType, VariantMap& eventData) { if (!objectAnimation_) return; using namespace AttributeAnimationAdded; const String& name =eventData[P_ATTRIBUTEANIMATIONNAME].GetString(); ValueAnimationInfo* info = objectAnimation_->GetAttributeAnimationInfo(name); if (!info) return; SetObjectAttributeAnimation(name, info->GetAnimation(), info->GetWrapMode(), info->GetSpeed()); }
void Animatable::OnObjectAnimationAdded(ObjectAnimation* objectAnimation) { if (!objectAnimation) return; // Set all attribute animations from the object animation const HashMap<String, SharedPtr<ValueAnimationInfo> >& attributeAnimationInfos = objectAnimation->GetAttributeAnimationInfos(); for (HashMap<String, SharedPtr<ValueAnimationInfo> >::ConstIterator i = attributeAnimationInfos.Begin(); i != attributeAnimationInfos.End(); ++i) { const String& name = i->first_; ValueAnimationInfo* info = i->second_; SetObjectAttributeAnimation(name, info->GetAnimation(), info->GetWrapMode(), info->GetSpeed()); } }
WrapMode ObjectAnimation::GetAttributeAnimationWrapMode(const String& name) const { ValueAnimationInfo* info = GetAttributeAnimationInfo(name); return info ? info->GetWrapMode() : WM_LOOP; }
float ObjectAnimation::GetAttributeAnimationSpeed(const String& name) const { ValueAnimationInfo* info = GetAttributeAnimationInfo(name); return info ? info->GetSpeed() : 1.0f; }
ValueAnimation* ObjectAnimation::GetAttributeAnimation(const String& name) const { ValueAnimationInfo* info = GetAttributeAnimationInfo(name); return info ? info->GetAnimation() : 0; }