BVB Source Codes

CRYENGINE Show IAnimationGraph.h Source code

Return Download CRYENGINE: download IAnimationGraph.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef __IANIMATIONGRAPH_H__
  4. #define __IANIMATIONGRAPH_H__
  5.  
  6. #if _MSC_VER > 1000
  7.         #pragma once
  8. #endif
  9.  
  10. #include <CryAnimation/ICryAnimation.h>
  11. #include <CrySystem/TimeValue.h>
  12.  
  13. class CCryName;
  14. struct IGameObject;
  15. struct IAnimatedCharacter;
  16.  
  17. const uint32 INVALID_ANIMATION_TOKEN = 0xffffffff;
  18.  
  19. enum EAnimationGraphPauser
  20. {
  21.         eAGP_FlowGraph,
  22.         eAGP_TrackView,
  23.         eAGP_StartGame,
  24.         eAGP_Freezing,
  25.         eAGP_PlayAnimationNode,
  26.         eAGP_HitDeathReactions,
  27.         eAGP_ActionController,
  28. };
  29.  
  30. enum EAnimationGraphTriggerUser
  31. {
  32.         eAGTU_AI = 0,
  33.         eAGTU_VehicleSystem
  34. };
  35.  
  36. enum EMovementControlMethod
  37. {
  38.         // !!! WARNING: Update g_szMCMString in AnimationGraph.cpp !!!
  39.  
  40.         eMCM_Undefined           = 0,
  41.         eMCM_Entity              = 1,
  42.         eMCM_Animation           = 2,
  43.         eMCM_DecoupledCatchUp    = 3,
  44.         eMCM_ClampedEntity       = 4,
  45.         eMCM_SmoothedEntity      = 5,
  46.         eMCM_AnimationHCollision = 6,
  47.  
  48.         // !!! WARNING: Update g_szMCMString in AnimationGraph.cpp !!!
  49.  
  50.         eMCM_COUNT,
  51.         eMCM_FF = 0xFF
  52. };
  53. AUTO_TYPE_INFO(EMovementControlMethod);
  54.  
  55. extern char* g_szMCMString[eMCM_COUNT];
  56.  
  57. enum EColliderMode
  58. {
  59.         // !!! WARNING: Update g_szColliderModeString in AnimationGraph.cpp !!!
  60.  
  61.         eColliderMode_Undefined = 0,
  62.         eColliderMode_Disabled,
  63.         eColliderMode_GroundedOnly,
  64.         eColliderMode_Pushable,
  65.         eColliderMode_NonPushable,
  66.         eColliderMode_PushesPlayersOnly,
  67.         eColliderMode_Spectator,
  68.  
  69.         // !!! WARNING: Update g_szColliderModeString in AnimationGraph.cpp !!!
  70.  
  71.         eColliderMode_COUNT,
  72.         eColliderMode_FF = 0xFF
  73. };
  74. extern char* g_szColliderModeString[eColliderMode_COUNT];
  75.  
  76. AUTO_TYPE_INFO(EColliderMode);
  77.  
  78. enum EColliderModeLayer
  79. {
  80.         // !!! WARNING: Update g_szColliderModeLayerString in AnimationGraph.cpp !!!
  81.  
  82.         eColliderModeLayer_AnimGraph = 0,
  83.         eColliderModeLayer_Game,
  84.         eColliderModeLayer_Script,
  85.         eColliderModeLayer_FlowGraph,
  86.         eColliderModeLayer_Animation,
  87.         eColliderModeLayer_ForceSleep,
  88.  
  89.         eColliderModeLayer_Debug,
  90.  
  91.         // !!! WARNING: Update g_szColliderModeLayerString in AnimationGraph.cpp !!!
  92.  
  93.         eColliderModeLayer_COUNT,
  94.         eColliderModeLayer_FF = 0xFF
  95. };
  96.  
  97. extern char* g_szColliderModeLayerString[eColliderModeLayer_COUNT];
  98.  
  99. enum EAnimationGraphUserData
  100. {
  101.         eAGUD_MovementControlMethodH = 0,
  102.         eAGUD_MovementControlMethodV,
  103.         eAGUD_ColliderMode,
  104.         eAGUD_AnimationControlledView,
  105.         eAGUD_AdditionalTurnMultiplier,
  106.         eAGUD_NUM_BUILTINS
  107. };
  108.  
  109. struct IAnimationGraphState;
  110.  
  111. struct IAnimationGraphStateListener;
  112.  
  113. typedef uint8 AnimationGraphInputID;
  114.  
  115. class CAnimationPlayerProxy
  116. {
  117. public:
  118.         virtual ~CAnimationPlayerProxy(){}
  119.  
  120.         virtual bool StartAnimation(IEntity* entity, const char* szAnimName0, const CryCharAnimationParams& Params, float speedMultiplier = 1.0f)
  121.         {
  122.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  123.                 if (pICharacter)
  124.                 {
  125.                         ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  126.  
  127.                         if (pISkeletonAnim->StartAnimation(szAnimName0, Params))
  128.                         {
  129.                                 pISkeletonAnim->SetLayerBlendWeight(Params.m_nLayerID, speedMultiplier);
  130.                                 return true;
  131.                         }
  132.                 }
  133.                 return false;
  134.         }
  135.  
  136.         virtual bool StartAnimationById(IEntity* entity, int animId, const CryCharAnimationParams& Params, float speedMultiplier = 1.0f)
  137.         {
  138.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  139.                 if (pICharacter)
  140.                 {
  141.                         ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  142.  
  143.                         if (pISkeletonAnim->StartAnimationById(animId, Params))
  144.                         {
  145.                                 pISkeletonAnim->SetLayerBlendWeight(Params.m_nLayerID, speedMultiplier);
  146.                                 return true;
  147.                         }
  148.                 }
  149.                 return false;
  150.         }
  151.  
  152.         virtual bool StopAnimationInLayer(IEntity* entity, int32 nLayer, f32 BlendOutTime)
  153.         {
  154.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  155.                 ISkeletonAnim* pISkeletonAnim = pICharacter ? pICharacter->GetISkeletonAnim() : NULL;
  156.  
  157.                 return pISkeletonAnim ? pISkeletonAnim->StopAnimationInLayer(nLayer, BlendOutTime) : false;
  158.         }
  159.  
  160.         virtual bool RemoveAnimationInLayer(IEntity* entity, int32 nLayer, uint32 token)
  161.         {
  162.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  163.                 if (pICharacter)
  164.                 {
  165.                         ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  166.  
  167.                         int nAnimsInFIFO = pISkeletonAnim->GetNumAnimsInFIFO(nLayer);
  168.                         for (int i = 0; i < nAnimsInFIFO; ++i)
  169.                         {
  170.                                 const CAnimation& anim = pISkeletonAnim->GetAnimFromFIFO(nLayer, i);
  171.                                 if (anim.HasUserToken(token))
  172.                                 {
  173.                                         return pISkeletonAnim->RemoveAnimFromFIFO(nLayer, i);
  174.                                 }
  175.                         }
  176.                 }
  177.  
  178.                 return false;
  179.         }
  180.  
  181.         virtual float GetAnimationNormalizedTime(IEntity* pEntity, const CAnimation* pAnimation)
  182.         {
  183.                 if (!pEntity)
  184.                         return -1.f;
  185.  
  186.                 if (!pAnimation)
  187.                         return -1.f;
  188.  
  189.                 ICharacterInstance* pCharacterInstance = pEntity->GetCharacter(0);
  190.                 if (!pCharacterInstance)
  191.                         return -1.f;
  192.  
  193.                 ISkeletonAnim* pSkeletonAnim = pCharacterInstance->GetISkeletonAnim();
  194.                 if (!pSkeletonAnim)
  195.                         return -1.f;
  196.  
  197.                 return pSkeletonAnim->GetAnimationNormalizedTime(pAnimation);
  198.         }
  199.  
  200.         virtual bool SetAnimationNormalizedTime(IEntity* pEntity, CAnimation* pAnimation, float normalizedTime)
  201.         {
  202.                 if (!pEntity)
  203.                         return false;
  204.  
  205.                 if (!pAnimation)
  206.                         return false;
  207.  
  208.                 ICharacterInstance* pCharacterInstance = pEntity->GetCharacter(0);
  209.                 if (!pCharacterInstance)
  210.                         return false;
  211.  
  212.                 ISkeletonAnim* pSkeletonAnim = pCharacterInstance->GetISkeletonAnim();
  213.                 if (!pSkeletonAnim)
  214.                         return false;
  215.  
  216.                 pSkeletonAnim->SetAnimationNormalizedTime(pAnimation, normalizedTime);
  217.                 return true;
  218.         }
  219.  
  220.         virtual float GetTopAnimExpectedSecondsLeft(IEntity* entity, int32 layer)
  221.         {
  222.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  223.                 if (!pICharacter)
  224.                         return -1.f;
  225.  
  226.                 ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  227.                 if (!pISkeletonAnim)
  228.                         return -1.f;
  229.  
  230.                 const CAnimation* pAnim = GetTopAnimation(entity, layer);
  231.                 if (!pAnim)
  232.                         return -1.f;
  233.  
  234.                 return (1.f - pISkeletonAnim->GetAnimationNormalizedTime(pAnim)) * pAnim->GetExpectedTotalDurationSeconds();
  235.         }
  236.  
  237.         virtual float GetTopAnimNormalizedTime(IEntity* entity, int32 layer)
  238.         {
  239.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  240.                 if (!pICharacter)
  241.                         return -1.f;
  242.  
  243.                 ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  244.                 if (!pISkeletonAnim)
  245.                         return -1.f;
  246.  
  247.                 const CAnimation* pAnim = GetTopAnimation(entity, layer);
  248.                 if (!pAnim)
  249.                         return -1.f;
  250.  
  251.                 return pISkeletonAnim->GetAnimationNormalizedTime(pAnim);
  252.         }
  253.  
  254.         virtual const CAnimation* GetTopAnimation(IEntity* entity, int32 layer)
  255.         {
  256.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  257.                 if (pICharacter)
  258.                 {
  259.                         ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  260.  
  261.                         int nAnimsInFIFO = pISkeletonAnim->GetNumAnimsInFIFO(layer);
  262.                         if (nAnimsInFIFO > 0)
  263.                         {
  264.                                 return &pISkeletonAnim->GetAnimFromFIFO(layer, nAnimsInFIFO - 1);
  265.                         }
  266.                 }
  267.  
  268.                 return NULL;
  269.         }
  270.  
  271.         virtual CAnimation* GetAnimation(IEntity* entity, int32 layer, uint32 token)
  272.         {
  273.                 ICharacterInstance* pICharacter = entity->GetCharacter(0);
  274.                 if (!pICharacter)
  275.                         return NULL;
  276.  
  277.                 ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
  278.                 if (!pISkeletonAnim)
  279.                         return NULL;
  280.  
  281.                 if (token == INVALID_ANIMATION_TOKEN)
  282.                 {
  283.                         int nAnimsInFIFO = pISkeletonAnim->GetNumAnimsInFIFO(layer);
  284.                         if (nAnimsInFIFO == 0)
  285.                         {
  286.                                 return NULL;
  287.                         }
  288.                         else
  289.                         {
  290.                                 return &pISkeletonAnim->GetAnimFromFIFO(layer, 0);
  291.                         }
  292.                 }
  293.                 else
  294.                 {
  295.                         return pISkeletonAnim->FindAnimInFIFO(token, layer);
  296.                 }
  297.         }
  298.  
  299. protected:
  300. };
  301.  
  302. struct SAnimationTargetRequest
  303. {
  304.         SAnimationTargetRequest()
  305.                 : position(ZERO)
  306.                 , direction(FORWARD_DIRECTION)
  307.                 , startArcAngle(0.0f)
  308.                 , directionTolerance(gf_PI)
  309.                 , prepareRadius(3.0f)
  310.                 , startWidth(0.0f)
  311.                 , projectEnd(false)
  312.                 , navSO(false)
  313.         {}
  314.         Vec3  position;
  315.         Vec3  direction;
  316.         float startArcAngle;
  317.         float directionTolerance;
  318.         float prepareRadius;
  319.         float startWidth;
  320.         bool  projectEnd;
  321.  
  322.         // we allow bigger errors in start position while passing through
  323.         // a smart object to avoid too much slowing down in front of it
  324.         bool navSO;
  325.  
  326.         bool operator==(const SAnimationTargetRequest& rhs) const
  327.         {
  328.                 static const float eps = 1e-3f;
  329.                 return position.GetSquaredDistance(rhs.position) < eps
  330.                        && direction.Dot(rhs.direction) > (1.0f - eps)
  331.                        && fabsf(startArcAngle - rhs.startArcAngle) < eps
  332.                        && fabsf(directionTolerance - rhs.directionTolerance) < eps
  333.                        && fabsf(prepareRadius - rhs.prepareRadius) < eps
  334.                        && fabsf(startWidth - rhs.startWidth) < eps
  335.                        && projectEnd == rhs.projectEnd
  336.                        && navSO == rhs.navSO;
  337.         }
  338.         bool operator!=(const SAnimationTargetRequest& rhs) const
  339.         {
  340.                 return !this->operator==(rhs);
  341.         }
  342. };
  343.  
  344. struct SAnimationTarget
  345. {
  346.         SAnimationTarget()
  347.                 : preparing(false)
  348.                 , activated(false)
  349.                 , doingSomething(false)
  350.                 , allowActivation(false)
  351.                 , notAiControlledAnymore(false)
  352.                 , isNavigationalSO(false)
  353.                 , maxRadius(0)
  354.                 , position(ZERO)
  355.                 , startWidth(0.0f)
  356.                 , positionWidth(0.0f)
  357.                 , positionDepth(0.0f)
  358.                 , orientationTolerance(0.0f)
  359.                 , orientation(IDENTITY)
  360.                 , activationTimeRemaining(0)
  361.                 , errorVelocity(ZERO)
  362.                 , errorRotationalVelocity(IDENTITY)
  363.         {}
  364.         uint32         preparing              : 1;
  365.         uint32         activated              : 1;
  366.         uint32         doingSomething         : 1;
  367.         mutable uint32 allowActivation        : 1;
  368.         mutable uint32 notAiControlledAnymore : 1;
  369.         uint32         isNavigationalSO       : 1;
  370.         float          maxRadius;
  371.         Vec3           position;
  372.         float          startWidth;
  373.         float          positionWidth;
  374.         float          positionDepth;
  375.         float          orientationTolerance;
  376.         Quat           orientation;
  377.         float          activationTimeRemaining;
  378.         Vec3           errorVelocity;
  379.         Quat           errorRotationalVelocity;
  380. };
  381.  
  382. //TODO: find a better place for this!!!
  383.  
  384. #define MAX_PREDICTION_PARAMS 6
  385.  
  386. // TODO: Rename to SMotionParameters
  387. struct SPredictedCharacterStates
  388. {
  389. public:
  390.         SPredictedCharacterStates()
  391.         {
  392.                 m_numParams = 0;
  393.                 memset(m_motionParameter, 0, MAX_PREDICTION_PARAMS * sizeof(m_motionParameter[0]));
  394.                 memset(m_motionParameterID, 0, MAX_PREDICTION_PARAMS * sizeof(m_motionParameterID[0]));
  395.         }
  396.  
  397.         bool        IsSet() const { return m_numParams > 0; }
  398.  
  399.         inline void Reset()
  400.         {
  401.                 m_numParams = 0;
  402.         }
  403.  
  404.         bool SetParam(EMotionParamID motionParameterID, float value)
  405.         {
  406.                 int index = 0;
  407.                 while ((index < m_numParams) && (m_motionParameterID[index] != motionParameterID))
  408.                         ++index;
  409.  
  410.                 if (index == m_numParams)
  411.                 {
  412.                         if (index == MAX_PREDICTION_PARAMS)
  413.                                 return false;
  414.  
  415.                         ++m_numParams;
  416.                 }
  417.  
  418.                 m_motionParameter[index] = value;
  419.                 m_motionParameterID[index] = motionParameterID;
  420.  
  421.                 return true;
  422.         }
  423.  
  424.         bool GetParam(EMotionParamID motionParameterID, float& value) const
  425.         {
  426.                 for (int index = 0; index < m_numParams; ++index)
  427.                 {
  428.                         if (m_motionParameterID[index] == motionParameterID)
  429.                         {
  430.                                 value = m_motionParameter[index];
  431.                                 return true;
  432.                         }
  433.                 }
  434.  
  435.                 return false;
  436.         }
  437.  
  438.         bool IsValid() const
  439.         {
  440.                 bool isValid = true;
  441.                 for (int index = 0; index < m_numParams; ++index)
  442.                 {
  443.                         isValid = isValid && NumberValid(m_motionParameter[index]);
  444.                 }
  445.  
  446.                 return isValid;
  447.         }
  448.  
  449. private:
  450.         f32   m_motionParameter[MAX_PREDICTION_PARAMS];
  451.         uint8 m_motionParameterID[MAX_PREDICTION_PARAMS];
  452.         uint8 m_numParams;
  453. };
  454.  
  455. typedef uint32 TAnimationGraphQueryID;
  456.  
  457. struct IAnimationGraphAuxillaryInputs
  458. {
  459.         typedef AnimationGraphInputID InputID;
  460.  
  461.         virtual ~IAnimationGraphAuxillaryInputs(){}
  462.         virtual IAnimationGraphState* GetState() = 0;
  463.         virtual void                  SetInput(InputID, float) = 0;
  464.         virtual void                  SetInput(InputID, int) = 0;
  465.         virtual void                  SetInput(InputID, const char*) = 0;
  466.  
  467.         template<class T>
  468.         inline void SetInput(const char* name, T value);
  469. };
  470.  
  471. typedef IAnimationGraphAuxillaryInputs IAnimationSpacialTrigger;
  472.  
  473. struct IAnimationGraphExistanceQuery : public IAnimationGraphAuxillaryInputs
  474. {
  475.         /// Execute the query.
  476.         virtual bool       Complete() = 0;
  477.         /// Returns animation length after query is Complete() and successful. Otherwise returns CTimeValue(0).
  478.         virtual CTimeValue GetAnimationLength() const = 0;
  479.         virtual void       Reset() = 0;
  480.         virtual void       Release() = 0;
  481. };
  482.  
  483. struct IAnimationGraphState
  484. {
  485. public:
  486.         typedef AnimationGraphInputID InputID;
  487.  
  488.         virtual ~IAnimationGraphState() {}
  489.  
  490.         // (see lower level versions below)
  491.         template<class T>
  492.         inline bool SetInput(const char* name, T value, TAnimationGraphQueryID* pQueryID = 0)
  493.         {
  494.                 return SetInput(GetInputId(name), value, pQueryID);
  495.         }
  496.         // SetInputOptional is same as SetInput except that it will not set the default input value in case a non-existing value is passed
  497.         inline bool SetInputOptional(const char* name, const char* value, TAnimationGraphQueryID* pQueryID = 0)
  498.         {
  499.                 return SetInputOptional(GetInputId(name), value, pQueryID);
  500.         }
  501.         inline void QueryChangeInput(const char* name, TAnimationGraphQueryID* pQueryID)
  502.         {
  503.                 QueryChangeInput(GetInputId(name), pQueryID);
  504.         }
  505.         inline void LockInput(const char* name, bool locked)
  506.         {
  507.                 LockInput(GetInputId(name), locked);
  508.         }
  509.  
  510.         // recurse setting. query mechanism needs to be wrapped by wrapper.
  511.         // Associated QueryID will be given to QueryComplete when ALL layers supporting the input have reached their matching states.
  512.         // wrapper generates it's own query IDs which are associated to a bunch of sub IDs with rules for how to handle the sub IDs into wrapped IDs.
  513.         virtual bool        SetInput(InputID, float, TAnimationGraphQueryID * pQueryID = 0) = 0;
  514.         virtual bool        SetInput(InputID, int, TAnimationGraphQueryID * pQueryID = 0) = 0;
  515.         virtual bool        SetInput(InputID, const char*, TAnimationGraphQueryID * pQueryID = 0) = 0;
  516.         // SetInputOptional is same as SetInput except that it will not set the default input value in case a non-existing value is passed
  517.         virtual bool        SetInputOptional(InputID, const char*, TAnimationGraphQueryID * pQueryID = 0) = 0;
  518.         virtual void        ClearInput(InputID) = 0;
  519.         virtual void        LockInput(InputID, bool locked) = 0;
  520.  
  521.         virtual bool        SetVariationInput(const char* name, const char* value) = 0;
  522.         virtual bool        SetVariationInput(InputID inputID, const char* value) = 0;
  523.         virtual const char* GetVariationInput(InputID inputID) const = 0;
  524.  
  525.         // assert all equal, use any (except if signalled, then return the one not equal to default, or return default of all default)
  526.         virtual void GetInput(InputID, char*) const = 0;
  527.  
  528.         // get input from specific layer if layer index is valid for this state
  529.         virtual void GetInput(InputID, char*, int layerIndex) const = 0;
  530.  
  531.         // AND all layers
  532.         virtual bool IsDefaultInputValue(InputID) const = 0;
  533.  
  534.         // returns NULL if InputID is out of range
  535.         virtual const char* GetInputName(InputID) const = 0;
  536.         virtual const char* GetVariationInputName(InputID) const = 0;
  537.  
  538.         // When QueryID of SetInput (reached queried state) is emitted this function is called by the outside, by convention(verify!).
  539.         // Remember which layers supported the SetInput query and emit QueryLeaveState QueryComplete when all those layers have left those states.
  540.         virtual void QueryLeaveState(TAnimationGraphQueryID* pQueryID) = 0;
  541.  
  542.         // assert all equal, forward to all layers, complete when all have changed once (trivial, since all change at once via SetInput).
  543.         // (except for signalled, forward only to layers which currently are not default, complete when all those have changed).
  544.         virtual void QueryChangeInput(InputID, TAnimationGraphQueryID*) = 0;
  545.  
  546.         // Just register and non-selectivly call QueryComplete on all listeners (regardless of what ID's they are actually interested in).
  547.         virtual void AddListener(const char* name, IAnimationGraphStateListener* pListener) = 0;
  548.         virtual void RemoveListener(IAnimationGraphStateListener* pListener) = 0;
  549.  
  550.         // Not used
  551.         virtual bool DoesInputMatchState(InputID) const = 0;
  552.  
  553.         // TODO: This should be turned into registered callbacks or something instead (look at AnimationGraphStateListener).
  554.         // Use to access the SelectLocomotionState() callback in CAnimatedCharacter.
  555.         // Only set for fullbody, null for upperbody.
  556.         virtual void SetAnimatedCharacter(class CAnimatedCharacter* animatedCharacter, int layerIndex, IAnimationGraphState* parentLayerState) = 0;
  557.  
  558.         // simply recurse
  559.         virtual bool Update() = 0;
  560.         virtual void Release() = 0;
  561.         virtual void ForceTeleportToQueriedState() = 0;
  562.  
  563.         // simply recurse (will be ignored by each layer individually if state not found)
  564.         virtual void PushForcedState(const char* state, TAnimationGraphQueryID* pQueryID = 0) = 0;
  565.  
  566.         // simply recurse
  567.         virtual void ClearForcedStates() = 0;
  568.  
  569.         // same as GetInput above
  570.         virtual float GetInputAsFloat(InputID inputId) = 0;
  571.  
  572.         // wrapper generates it's own input IDs for the union of all inputs in all layers, and for each input it maps to the layer specific IDs.
  573.         virtual InputID GetInputId(const char* input) = 0;
  574.         virtual InputID GetVariationInputId(const char* variationInputName) const = 0;
  575.  
  576.         // simply recurse (preserve order), and don't forget to serialize the wrapper stuff, ID's or whatever.
  577.         virtual void Serialize(TSerialize ser) = 0;
  578.  
  579.         // simply recurse
  580.         virtual void SetAnimationActivation(bool activated) = 0;
  581.         virtual bool GetAnimationActivation() = 0;
  582.  
  583.         // Concatenate all layers state names with '+'. Use only fullbody layer state name if upperbody layer is not allowed/mixed.
  584.         virtual const char* GetCurrentStateName() = 0;
  585.  
  586.         // don't expose (should only be called on specific layer state directly, by AGAnimation)
  587.         //virtual void ForceLeaveCurrentState() = 0;
  588.         //virtual void InvalidateQueriedState() = 0;
  589.  
  590.         // simply recurse
  591.         virtual void Pause(bool pause, EAnimationGraphPauser pauser, float fOverrideTransTime = -1.0f) = 0;
  592.  
  593.         // is the same for all layers (equal assertion should not even be needed)
  594.         virtual bool IsInDebugBreak() = 0;
  595.  
  596.         // don't expose (not used) (if used outside AGAnimation, specify layer)
  597.         //virtual CTimeValue GetAnimationLength() = 0;
  598.  
  599.         // don't expose (only used by AGOutput)
  600.         //virtual void SetOutput( int id ) = 0;
  601.         //virtual void ClearOutput( int id ) = 0;
  602.  
  603.         // find highest layer that has output id, or null (this allows upperbody to override fullbody).
  604.         // Use this logic when calling SetOutput on listeners.
  605.         virtual const char* QueryOutput(const char* name) = 0;
  606.  
  607.         // Don't expose (only used on specific layer in AGParams)
  608.         //virtual void SetCurrentStructure( const CCryName& ) = 0;
  609.         //virtual const CCryName& GetCurrentStructure() = 0;
  610.  
  611.         // don't expose (exact positioning uses fullbody layer only, and AGAnimation operates on specific layer already)
  612.         //virtual uint32 GetCurrentToken() = 0;
  613.  
  614.         // Exact positioning: Forward to fullbody layer only (hardcoded)
  615.         virtual IAnimationSpacialTrigger* SetTrigger(const SAnimationTargetRequest& req, EAnimationGraphTriggerUser user, TAnimationGraphQueryID* pQueryStart, TAnimationGraphQueryID* pQueryEnd) = 0;
  616.         virtual void                      ClearTrigger(EAnimationGraphTriggerUser user) = 0;
  617.         virtual const SAnimationTarget*   GetAnimationTarget() = 0;
  618.         virtual bool                      HasAnimationTarget() const = 0;
  619.         virtual bool                      IsUpdateReallyNecessary() = 0;
  620.  
  621.         // Creates an object you can use to test whether a specific combination of inputs will select a state
  622.         // (and to get a bit more information about that state)
  623.         virtual IAnimationGraphExistanceQuery* CreateExistanceQuery() = 0;
  624.         virtual IAnimationGraphExistanceQuery* CreateExistanceQuery(int layer) = 0;
  625.  
  626.         // simply recurse
  627.         virtual void Reset() = 0;
  628.  
  629.         // simply recurse (hurry all layers, let them hurry independently where they can)
  630.         virtual void Hurry() = 0;
  631.  
  632.         // simply recurse (first person skippable states are skipped independently by each layer)
  633.         virtual void SetFirstPersonMode(bool on) = 0;
  634.  
  635.         // Removed (remove this from original interface as well., including SetIWeights
  636.         //virtual uint16 GetBlendSpaceWeightFlags() = 0;
  637.         //virtual void  SetBlendSpaceWeightFlags(uint16 flags) = 0;
  638.  
  639.         // simply recurse (will add all layer's containers to the sizer)
  640.         virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0;
  641.  
  642.         // the wrapper simply returns false
  643.         virtual bool IsMixingAllowedForCurrentState() const = 0;
  644.  
  645.         // used by CAnimationGraphStates
  646.         virtual bool IsSignalledInput(InputID intputId) const = 0;
  647. };
  648.  
  649. template<class T>
  650. inline void IAnimationGraphAuxillaryInputs::SetInput(const char* name, T value)
  651. {
  652.         SetInput(GetState()->GetInputId(name), value);
  653. }
  654.  
  655. struct IAnimationGraphStateListener
  656. {
  657.         virtual ~IAnimationGraphStateListener(){}
  658.         virtual void SetOutput(const char* output, const char* value) = 0;
  659.         virtual void QueryComplete(TAnimationGraphQueryID queryID, bool succeeded) = 0;
  660.         virtual void DestroyedState(IAnimationGraphState*) = 0;
  661. };
  662. #endif
  663.  
downloadIAnimationGraph.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top