void AnimationController::PlayAnimAutoStop(const String &name, const String &fadein, const String &exclusive) { if (!name.Length()) { LogWarning("Empty animation name for PlayAnimAutoStop"); return; } float fadein_ = 0.0f; if (fadein.Length()) fadein_ = ToFloat(fadein); bool exclusive_ = false; if (exclusive.Length()) exclusive_ = ToBool(exclusive); bool success; if (exclusive_) success = EnableExclusiveAnimation(name, false, fadein_, false); else success = EnableAnimation(name, false, fadein_, false); if (!success) { StringVector anims = AvailableAnimations(); void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning; log("Failed to play animation \"" + name + "\" on entity " + ParentEntity()->Name()); log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ",")); // Enable autostop, and start always from the beginning SetAnimationAutoStop(name, true); SetAnimationTimePosition(name, 0.0f); } }
void AnimationController::SetAnimationToEnd(const String& name) { auto i = animations_.Find(name); if (i != animations_.End() && i->second_.animationState_) { SetAnimationTimePosition(name, i->second_.animationState_->GetLength()); } }
void EC_OgreAnimationController::SetAnimationToEnd(const std::string& name) { Ogre::Entity* entity = GetEntity(); Ogre::AnimationState* animstate = GetAnimationState(entity, name); if (!animstate) return; if (animstate) { SetAnimationTimePosition(name, animstate->getLength()); } }