Clip-driven animation state machine with float/bool/trigger parameters and cross-fade transitions. Script type: AnimStateMachine.
更多...
#include <AnimStateMachine.h>
Public 成员函数 | |
| AnimStateMachine (AnimSkeleton *skeleton) | |
| Anim state machine. | |
| ~AnimStateMachine () override | |
| Anim state machine. | |
| AnimStateMachine (const AnimStateMachine &)=delete | |
| AnimStateMachine & | operator= (const AnimStateMachine &)=delete |
| AnimSkeleton * | getSkeleton () const override |
| Borrowed pointer accessor. @ownership Borrowed @lifetime Valid while the owning animation object remains alive; do not retain across destruction. | |
| void | addState (const std::string &name, AnimClip *clip) |
| Adds state. | |
| void | setEntry (const std::string &name) |
| Sets the entry. | |
| bool | hasState (const std::string &name) const |
| True when state. | |
| std::string | getCurrentState () const |
| Returns the current state. | |
| int | getStateCount () const |
| Returns the state count. | |
| int | addTransition (const std::string &from, const std::string &to, float blendSeconds) |
| Add transition from → to with blend duration. | |
| void | addFloatCondition (int transitionId, const std::string ¶m, const std::string &op, float threshold) |
| Comparison op: ">", ">=", "<", "<=", "==", "!=". | |
| void | addBoolCondition (int transitionId, const std::string ¶m, bool value) |
| Adds bool condition. | |
| void | addTriggerCondition (int transitionId, const std::string ¶m) |
| Adds trigger condition. | |
| void | setExitTime (int transitionId, float normalizedTime) |
| Optional: require normalized local time in [0,1] >= exitTime before transition. | |
| void | setHasExitTime (int transitionId, bool enabled) |
| Sets the has exit time. | |
| void | setFloat (const std::string &name, float value) |
| Sets the float. | |
| float | getFloat (const std::string &name) const |
| Returns the float. | |
| void | setBool (const std::string &name, bool value) |
| Sets the bool. | |
| bool | getBool (const std::string &name) const |
| Returns the bool. | |
| void | setTrigger (const std::string &name) |
| Sets the trigger. | |
| void | resetTrigger (const std::string &name) |
| Resets trigger. | |
| bool | getTrigger (const std::string &name) const |
| Query a trigger's current state. | |
| AnimPose * | getPose () override |
| Borrowed pointer accessor. @ownership Borrowed @lifetime Valid while the owning animation object remains alive; do not retain across destruction. | |
| float | getStateTime () const |
| Returns the state time. | |
| bool | isBlending () const |
| True when blending. | |
| eve::Result< void > | advance (const eve::SimulationStep &step) override |
| Advance state and pose using one scheduler-owned deterministic step. | |
| eve::SimulationTick | currentTick () const noexcept override |
| Last scheduler tick consumed by the checked state-machine API. | |
| bool | hasCurrentTick () const noexcept override |
| Whether advance has consumed at least one checked step. | |
| void | update (float dt) |
| Legacy seconds facade retained for scripts and old callers. | |
| bool | captureState (StateValue &out) const |
| Serialize runtime state (params, current/next state, blend). | |
| bool | restoreState (const StateValue &in, std::string *err=nullptr) |
| Restore runtime state captured by captureState(). | |
| bool | resetToDefaults () |
| Clear params and re-seat the entry state (restore fallback). | |
Public 成员函数 继承自 eve::animation::IAnimPoseSource | |
| virtual | ~IAnimPoseSource ()=default |
| Releases IAnimPoseSource resources. | |
| virtual int | getEventCount () const |
| Events emitted by the most recent advance; default is none. | |
| virtual std::string | getEventName (int) const |
| virtual std::string | getEventPayload (int) const |
详细描述
Clip-driven animation state machine with float/bool/trigger parameters and cross-fade transitions. Script type: AnimStateMachine.
在文件 AnimStateMachine.h 第 23 行定义.
构造及析构函数说明
◆ AnimStateMachine() [1/2]
|
explicit |
Anim state machine.
在文件 AnimStateMachine.cpp 第 67 行定义.
引用了 eve::animation::AnimSkeleton::applyBindPose(), eve::animation::AnimSkeleton::getBoneCount() , 以及 eve::animation::AnimPose::resize().
◆ ~AnimStateMachine()
|
override |
◆ AnimStateMachine() [2/2]
|
delete |
成员函数说明
◆ addBoolCondition()
| void eve::animation::AnimStateMachine::addBoolCondition | ( | int | transitionId, |
| const std::string & | param, | ||
| bool | value | ||
| ) |
◆ addFloatCondition()
| void eve::animation::AnimStateMachine::addFloatCondition | ( | int | transitionId, |
| const std::string & | param, | ||
| const std::string & | op, | ||
| float | threshold | ||
| ) |
◆ addState()
| void eve::animation::AnimStateMachine::addState | ( | const std::string & | name, |
| AnimClip * | clip | ||
| ) |
◆ addTransition()
| int eve::animation::AnimStateMachine::addTransition | ( | const std::string & | from, |
| const std::string & | to, | ||
| float | blendSeconds | ||
| ) |
◆ addTriggerCondition()
| void eve::animation::AnimStateMachine::addTriggerCondition | ( | int | transitionId, |
| const std::string & | param | ||
| ) |
◆ advance()
|
overridevirtual |
Advance state and pose using one scheduler-owned deterministic step.
实现了 eve::animation::IAnimPoseSource.
在文件 AnimStateMachine.cpp 第 305 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, step, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 update().
◆ captureState()
| bool eve::animation::AnimStateMachine::captureState | ( | StateValue & | out | ) | const |
Serialize runtime state (params, current/next state, blend).
在文件 AnimStateMachine.cpp 第 339 行定义.
引用了 eve::StateValue::boolean(), eve::StateValue::number(), eve::StateValue::object(), eve::StateValue::set(), eve::StateValue::string() , 以及 eve::detail::StrongUint64< Tag >::value().
◆ currentTick()
|
inlineoverridevirtualnoexcept |
Last scheduler tick consumed by the checked state-machine API.
实现了 eve::animation::IAnimPoseSource.
在文件 AnimStateMachine.h 第 100 行定义.
◆ getBool()
| bool eve::animation::AnimStateMachine::getBool | ( | const std::string & | name | ) | const |
◆ getCurrentState()
|
inline |
Returns the current state.
在文件 AnimStateMachine.h 第 46 行定义.
◆ getFloat()
| float eve::animation::AnimStateMachine::getFloat | ( | const std::string & | name | ) | const |
◆ getPose()
|
overridevirtual |
Borrowed pointer accessor. @ownership Borrowed @lifetime Valid while the owning animation object remains alive; do not retain across destruction.
实现了 eve::animation::IAnimPoseSource.
在文件 AnimStateMachine.cpp 第 203 行定义.
◆ getSkeleton()
|
inlineoverridevirtual |
Borrowed pointer accessor. @ownership Borrowed @lifetime Valid while the owning animation object remains alive; do not retain across destruction.
实现了 eve::animation::IAnimPoseSource.
在文件 AnimStateMachine.h 第 37 行定义.
被这些函数引用 eve::avatar::AvatarInstance::bindAnimStateMachine().
◆ getStateCount()
|
inline |
Returns the state count.
在文件 AnimStateMachine.h 第 48 行定义.
◆ getStateTime()
|
inline |
Returns the state time.
在文件 AnimStateMachine.h 第 92 行定义.
◆ getTrigger()
|
inline |
◆ hasCurrentTick()
|
inlineoverridevirtualnoexcept |
Whether advance has consumed at least one checked step.
实现了 eve::animation::IAnimPoseSource.
在文件 AnimStateMachine.h 第 102 行定义.
◆ hasState()
| bool eve::animation::AnimStateMachine::hasState | ( | const std::string & | name | ) | const |
◆ isBlending()
|
inline |
True when blending.
在文件 AnimStateMachine.h 第 94 行定义.
◆ operator=()
|
delete |
◆ resetToDefaults()
| bool eve::animation::AnimStateMachine::resetToDefaults | ( | ) |
Clear params and re-seat the entry state (restore fallback).
在文件 AnimStateMachine.cpp 第 446 行定义.
引用了 setEntry() , 以及 eve::detail::StrongUint64< detail::SimulationTickTag >::zero().
◆ resetTrigger()
| void eve::animation::AnimStateMachine::resetTrigger | ( | const std::string & | name | ) |
◆ restoreState()
| bool eve::animation::AnimStateMachine::restoreState | ( | const StateValue & | in, |
| std::string * | err = nullptr |
||
| ) |
Restore runtime state captured by captureState().
- 返回
- false when the captured current state is not defined here; the reload session then falls back to resetToDefaults().
在文件 AnimStateMachine.cpp 第 365 行定义.
引用了 current, eve::StateValue::find(), hasState(), eve::StateValue::isBool(), eve::StateValue::isObject(), eve::StateValue::isString(), key, started, tick, v, value , 以及 eve::detail::StrongUint64< detail::SimulationTickTag >::zero().
◆ setBool()
| void eve::animation::AnimStateMachine::setBool | ( | const std::string & | name, |
| bool | value | ||
| ) |
◆ setEntry()
| void eve::animation::AnimStateMachine::setEntry | ( | const std::string & | name | ) |
◆ setExitTime()
| void eve::animation::AnimStateMachine::setExitTime | ( | int | transitionId, |
| float | normalizedTime | ||
| ) |
Optional: require normalized local time in [0,1] >= exitTime before transition.
在文件 AnimStateMachine.cpp 第 175 行定义.
引用了 eve::animation::clampf() , 以及 tr.
◆ setFloat()
| void eve::animation::AnimStateMachine::setFloat | ( | const std::string & | name, |
| float | value | ||
| ) |
◆ setHasExitTime()
| void eve::animation::AnimStateMachine::setHasExitTime | ( | int | transitionId, |
| bool | enabled | ||
| ) |
◆ setTrigger()
| void eve::animation::AnimStateMachine::setTrigger | ( | const std::string & | name | ) |
◆ update()
| void eve::animation::AnimStateMachine::update | ( | float | dt | ) |
Legacy seconds facade retained for scripts and old callers.
在文件 AnimStateMachine.cpp 第 323 行定义.
引用了 advance(), duration, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Duration::fromSeconds(), eve::Result< T >::ignore(), eve::detail::StrongUint64< Tag >::incremented() , 以及 eve::InvariantViolation.
该类的文档由以下文件生成:
- src/modules/animation/AnimStateMachine.h
- src/modules/animation/AnimStateMachine.cpp
Public 成员函数 继承自