Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OlympeAnimation::AnimationGraph Class Reference

#include <AnimationGraph.h>

Public Member Functions

 AnimationGraph ()=default
 
 ~AnimationGraph ()=default
 
bool LoadFromFile (const std::string &filePath)
 
void SetParameter (const std::string &name, bool value)
 
void SetParameter (const std::string &name, float value)
 
void SetParameter (const std::string &name, int value)
 
void SetParameter (const std::string &name, const std::string &value)
 
bool GetParameterBool (const std::string &name, bool defaultValue=false) const
 
float GetParameterFloat (const std::string &name, float defaultValue=0.0f) const
 
int GetParameterInt (const std::string &name, int defaultValue=0) const
 
std::string GetParameterString (const std::string &name, const std::string &defaultValue="") const
 
void SetCurrentState (const std::string &stateName)
 
const std::string & GetCurrentState () const
 
std::string GetCurrentAnimationName () const
 
bool Update (float deltaTime)
 
const std::string & GetGraphName () const
 
const std::string & GetAnimationBankPath () const
 
bool IsValid () const
 

Private Member Functions

bool ParseJSON (const std::string &jsonContent)
 
bool EvaluateCondition (const Condition &condition) const
 
bool EvaluateTransition (const Transition &transition) const
 
const TransitionFindValidTransition () const
 

Private Attributes

std::string m_graphName
 
std::string m_description
 
std::string m_animationBankPath
 
std::string m_currentState
 
std::string m_defaultState = "Idle"
 
bool m_isValid = false
 
std::unordered_map< std::string, ParameterValuem_parameters
 
std::unordered_map< std::string, AnimationStatem_states
 
std::vector< Transitionm_transitions
 

Detailed Description

Definition at line 65 of file AnimationGraph.h.

Constructor & Destructor Documentation

◆ AnimationGraph()

OlympeAnimation::AnimationGraph::AnimationGraph ( )
default

◆ ~AnimationGraph()

OlympeAnimation::AnimationGraph::~AnimationGraph ( )
default

Member Function Documentation

◆ EvaluateCondition()

bool OlympeAnimation::AnimationGraph::EvaluateCondition ( const Condition condition) const
private

◆ EvaluateTransition()

bool OlympeAnimation::AnimationGraph::EvaluateTransition ( const Transition transition) const
private

Definition at line 305 of file AnimationGraph.cpp.

References EvaluateCondition(), and GetComponentTypeID_Static().

Referenced by FindValidTransition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindValidTransition()

const Transition * OlympeAnimation::AnimationGraph::FindValidTransition ( ) const
private

Definition at line 316 of file AnimationGraph.cpp.

References EvaluateTransition(), GetComponentTypeID_Static(), m_currentState, and m_transitions.

Referenced by Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAnimationBankPath()

const std::string & OlympeAnimation::AnimationGraph::GetAnimationBankPath ( ) const
inline

Definition at line 100 of file AnimationGraph.h.

References m_animationBankPath.

◆ GetCurrentAnimationName()

std::string OlympeAnimation::AnimationGraph::GetCurrentAnimationName ( ) const

Definition at line 229 of file AnimationGraph.cpp.

References GetComponentTypeID_Static(), m_currentState, and m_states.

+ Here is the call graph for this function:

◆ GetCurrentState()

const std::string & OlympeAnimation::AnimationGraph::GetCurrentState ( ) const
inline

Definition at line 87 of file AnimationGraph.h.

References m_currentState.

◆ GetGraphName()

const std::string & OlympeAnimation::AnimationGraph::GetGraphName ( ) const
inline

Definition at line 97 of file AnimationGraph.h.

References m_graphName.

◆ GetParameterBool()

bool OlympeAnimation::AnimationGraph::GetParameterBool ( const std::string &  name,
bool  defaultValue = false 
) const

Definition at line 189 of file AnimationGraph.cpp.

References OlympeAnimation::Bool, GetComponentTypeID_Static(), and m_parameters.

+ Here is the call graph for this function:

◆ GetParameterFloat()

float OlympeAnimation::AnimationGraph::GetParameterFloat ( const std::string &  name,
float  defaultValue = 0.0f 
) const

Definition at line 197 of file AnimationGraph.cpp.

References OlympeAnimation::Float, GetComponentTypeID_Static(), and m_parameters.

+ Here is the call graph for this function:

◆ GetParameterInt()

int OlympeAnimation::AnimationGraph::GetParameterInt ( const std::string &  name,
int  defaultValue = 0 
) const

Definition at line 205 of file AnimationGraph.cpp.

References GetComponentTypeID_Static(), OlympeAnimation::Int, and m_parameters.

+ Here is the call graph for this function:

◆ GetParameterString()

std::string OlympeAnimation::AnimationGraph::GetParameterString ( const std::string &  name,
const std::string &  defaultValue = "" 
) const

Definition at line 213 of file AnimationGraph.cpp.

References GetComponentTypeID_Static(), m_parameters, and OlympeAnimation::String.

+ Here is the call graph for this function:

◆ IsValid()

bool OlympeAnimation::AnimationGraph::IsValid ( ) const
inline

Definition at line 103 of file AnimationGraph.h.

References m_isValid.

◆ LoadFromFile()

bool OlympeAnimation::AnimationGraph::LoadFromFile ( const std::string &  filePath)

Definition at line 19 of file AnimationGraph.cpp.

References GetComponentTypeID_Static(), JsonHelper::LoadJsonFromFile(), ParseJSON(), and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ ParseJSON()

bool OlympeAnimation::AnimationGraph::ParseJSON ( const std::string &  jsonContent)
private

◆ SetCurrentState()

void OlympeAnimation::AnimationGraph::SetCurrentState ( const std::string &  stateName)

Definition at line 221 of file AnimationGraph.cpp.

References GetComponentTypeID_Static(), m_currentState, and m_states.

+ Here is the call graph for this function:

◆ SetParameter() [1/4]

void OlympeAnimation::AnimationGraph::SetParameter ( const std::string &  name,
bool  value 
)

Definition at line 169 of file AnimationGraph.cpp.

References m_parameters.

◆ SetParameter() [2/4]

void OlympeAnimation::AnimationGraph::SetParameter ( const std::string &  name,
const std::string &  value 
)

Definition at line 184 of file AnimationGraph.cpp.

References m_parameters.

◆ SetParameter() [3/4]

void OlympeAnimation::AnimationGraph::SetParameter ( const std::string &  name,
float  value 
)

Definition at line 174 of file AnimationGraph.cpp.

References m_parameters.

◆ SetParameter() [4/4]

void OlympeAnimation::AnimationGraph::SetParameter ( const std::string &  name,
int  value 
)

Definition at line 179 of file AnimationGraph.cpp.

References m_parameters.

◆ Update()

bool OlympeAnimation::AnimationGraph::Update ( float  deltaTime)

Definition at line 237 of file AnimationGraph.cpp.

References FindValidTransition(), GetComponentTypeID_Static(), and m_currentState.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_animationBankPath

std::string OlympeAnimation::AnimationGraph::m_animationBankPath
private

Definition at line 108 of file AnimationGraph.h.

Referenced by GetAnimationBankPath(), and ParseJSON().

◆ m_currentState

std::string OlympeAnimation::AnimationGraph::m_currentState
private

◆ m_defaultState

std::string OlympeAnimation::AnimationGraph::m_defaultState = "Idle"
private

Definition at line 110 of file AnimationGraph.h.

Referenced by ParseJSON().

◆ m_description

std::string OlympeAnimation::AnimationGraph::m_description
private

Definition at line 107 of file AnimationGraph.h.

Referenced by ParseJSON().

◆ m_graphName

std::string OlympeAnimation::AnimationGraph::m_graphName
private

Definition at line 106 of file AnimationGraph.h.

Referenced by GetGraphName(), and ParseJSON().

◆ m_isValid

bool OlympeAnimation::AnimationGraph::m_isValid = false
private

Definition at line 111 of file AnimationGraph.h.

Referenced by IsValid(), and ParseJSON().

◆ m_parameters

std::unordered_map<std::string, ParameterValue> OlympeAnimation::AnimationGraph::m_parameters
private

◆ m_states

std::unordered_map<std::string, AnimationState> OlympeAnimation::AnimationGraph::m_states
private

Definition at line 114 of file AnimationGraph.h.

Referenced by GetCurrentAnimationName(), ParseJSON(), and SetCurrentState().

◆ m_transitions

std::vector<Transition> OlympeAnimation::AnimationGraph::m_transitions
private

Definition at line 115 of file AnimationGraph.h.

Referenced by FindValidTransition(), and ParseJSON().


The documentation for this class was generated from the following files: