载入中...
搜索中...
未找到
eve::animation::AnimStateMachine类 参考

Clip-driven animation state machine with float/bool/trigger parameters and cross-fade transitions. Script type: AnimStateMachine. 更多...

#include <AnimStateMachine.h>

类 eve::animation::AnimStateMachine 继承关系图:
eve::animation::IAnimPoseSource

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 &param, const std::string &op, float threshold)
 Comparison op: ">", ">=", "<", "<=", "==", "!=".
 
void addBoolCondition (int transitionId, const std::string &param, bool value)
 Adds bool condition.
 
void addTriggerCondition (int transitionId, const std::string &param)
 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]

eve::animation::AnimStateMachine::AnimStateMachine ( AnimSkeleton *  skeleton)
explicit

◆ ~AnimStateMachine()

eve::animation::AnimStateMachine::~AnimStateMachine ( )
override

Anim state machine.

在文件 AnimStateMachine.cpp 第 76 行定义.

引用了 begin , 以及 end.

◆ AnimStateMachine() [2/2]

eve::animation::AnimStateMachine::AnimStateMachine ( const AnimStateMachine &  )
delete

成员函数说明

◆ addBoolCondition()

void eve::animation::AnimStateMachine::addBoolCondition ( int  transitionId,
const std::string &  param,
bool  value 
)

Adds bool condition.

在文件 AnimStateMachine.cpp 第 154 行定义.

引用了 c, tr , 以及 value.

◆ addFloatCondition()

void eve::animation::AnimStateMachine::addFloatCondition ( int  transitionId,
const std::string &  param,
const std::string &  op,
float  threshold 
)

Comparison op: ">", ">=", "<", "<=", "==", "!=".

在文件 AnimStateMachine.cpp 第 141 行定义.

引用了 c , 以及 tr.

◆ addState()

void eve::animation::AnimStateMachine::addState ( const std::string &  name,
AnimClip *  clip 
)

Adds state.

在文件 AnimStateMachine.cpp 第 103 行定义.

引用了 clip , 以及 name.

◆ addTransition()

int eve::animation::AnimStateMachine::addTransition ( const std::string &  from,
const std::string &  to,
float  blendSeconds 
)

Add transition from → to with blend duration.

返回
transition id

在文件 AnimStateMachine.cpp 第 126 行定义.

引用了 from, to , 以及 tr.

◆ addTriggerCondition()

void eve::animation::AnimStateMachine::addTriggerCondition ( int  transitionId,
const std::string &  param 
)

Adds trigger condition.

在文件 AnimStateMachine.cpp 第 165 行定义.

引用了 c , 以及 tr.

◆ advance()

eve::Result< void > eve::animation::AnimStateMachine::advance ( const eve::SimulationStep &  step)
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

◆ currentTick()

eve::SimulationTick eve::animation::AnimStateMachine::currentTick ( ) const
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

Returns the bool.

在文件 AnimStateMachine.cpp 第 194 行定义.

引用了 name.

◆ getCurrentState()

std::string eve::animation::AnimStateMachine::getCurrentState ( ) const
inline

Returns the current state.

在文件 AnimStateMachine.h 第 46 行定义.

◆ getFloat()

float eve::animation::AnimStateMachine::getFloat ( const std::string &  name) const

Returns the float.

在文件 AnimStateMachine.cpp 第 187 行定义.

引用了 name.

◆ getPose()

AnimPose * eve::animation::AnimStateMachine::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()

AnimSkeleton * eve::animation::AnimStateMachine::getSkeleton ( ) const
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()

int eve::animation::AnimStateMachine::getStateCount ( ) const
inline

Returns the state count.

在文件 AnimStateMachine.h 第 48 行定义.

◆ getStateTime()

float eve::animation::AnimStateMachine::getStateTime ( ) const
inline

Returns the state time.

在文件 AnimStateMachine.h 第 92 行定义.

◆ getTrigger()

bool eve::animation::AnimStateMachine::getTrigger ( const std::string &  name) const
inline

Query a trigger's current state.

在文件 AnimStateMachine.h 第 81 行定义.

引用了 name.

◆ hasCurrentTick()

bool eve::animation::AnimStateMachine::hasCurrentTick ( ) const
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

True when state.

在文件 AnimStateMachine.cpp 第 122 行定义.

引用了 name.

被这些函数引用 restoreState().

◆ isBlending()

bool eve::animation::AnimStateMachine::isBlending ( ) const
inline

True when blending.

在文件 AnimStateMachine.h 第 94 行定义.

◆ operator=()

AnimStateMachine & eve::animation::AnimStateMachine::operator= ( const AnimStateMachine &  )
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)

Resets trigger.

在文件 AnimStateMachine.cpp 第 201 行定义.

引用了 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 
)

Sets the bool.

在文件 AnimStateMachine.cpp 第 192 行定义.

引用了 name , 以及 value.

◆ setEntry()

void eve::animation::AnimStateMachine::setEntry ( const std::string &  name)

Sets the entry.

在文件 AnimStateMachine.cpp 第 113 行定义.

引用了 name.

被这些函数引用 resetToDefaults().

◆ 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 
)

Sets the float.

在文件 AnimStateMachine.cpp 第 185 行定义.

引用了 name , 以及 value.

◆ setHasExitTime()

void eve::animation::AnimStateMachine::setHasExitTime ( int  transitionId,
bool  enabled 
)

Sets the has exit time.

在文件 AnimStateMachine.cpp 第 181 行定义.

引用了 enabled.

◆ setTrigger()

void eve::animation::AnimStateMachine::setTrigger ( const std::string &  name)

Sets the trigger.

在文件 AnimStateMachine.cpp 第 199 行定义.

引用了 name.

被这些函数引用 eve::avatar::AvatarInstance::setMotion().

◆ update()

void eve::animation::AnimStateMachine::update ( float  dt)

该类的文档由以下文件生成: