Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.2 KiB

  1. //====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //=============================================================================
  5. #ifndef SFMANIMSETSCRIPTCONTEXT_H
  6. #define SFMANIMSETSCRIPTCONTEXT_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "movieobjects/dmechannel.h"
  11. #include "tier1/timeutils.h"
  12. // Forward declarations
  13. class CDmElement;
  14. class CDmeClip;
  15. class CDmeFilmClip;
  16. class CDmeAnimationSet;
  17. class CDmeGameModel;
  18. class CDmeChannelsClip;
  19. class CDmeDag;
  20. class CDmeRigHandle;
  21. class CDmeChannel;
  22. class CDmeTransformControl;
  23. class CDmeRigBaseConstraintOperator;
  24. class CDmeConstraintTarget;
  25. class CDmeRig;
  26. class CStudioHdr;
  27. //-------------------------------------------------------------------------------------------------
  28. // CSFMAnimSetScriptContext
  29. //
  30. //-------------------------------------------------------------------------------------------------
  31. class CSFMAnimSetScriptContext
  32. {
  33. public:
  34. // Constructor
  35. CSFMAnimSetScriptContext( CDmeAnimationSet *pAnimSet, CDmeFilmClip *pShot, CDmeClip *pMovie, DmeTime_t time, ChannelMode_t channelMode );
  36. // Destructor
  37. ~CSFMAnimSetScriptContext();
  38. // Add the specified dag node to the animation set
  39. void AddDagNode( CDmeDag *pDagNode, CDmeRig *pRig, const char *pchControlGroupPath = 0, bool bPositionControl = true, bool bOrientationControl = true ) const;
  40. // Remove the specified rig handle from the animation set
  41. void RemoveRigHandle( CDmeRigHandle *pRigHandle ) const;
  42. // Add the specified constraint to the animation set
  43. void AddConstraint( CDmeRigBaseConstraintOperator *pConstraint, CDmeRig *pRig, const char *pchControlGroupPath = 0 ) const;
  44. // Find any dag node within the animation set with the specified name
  45. CDmeDag *FindDagNode( const char *pchName ) const;
  46. // Find the dag node associated with the specified bone
  47. CDmeDag *FindBoneDag( const char *pchBoneName ) const;
  48. // Set the channel operation mode for all of the channels in the the clip associated with the animation set
  49. void SetChannelMode( ChannelMode_t mode );
  50. // Set the current time and update the time of the channels in the animation set.
  51. void SetCurrentTime( DmeTime_t time );
  52. // Get the animation set associated with the context
  53. CDmeAnimationSet *GetAnimationSet() const { return m_pAnimSet; }
  54. // Get the gameModel associated with the context
  55. CDmeGameModel *GetGameModel() const { return m_pGameModel; }
  56. private:
  57. // Create the position and rotation channels for the specified dag node.
  58. //void CreateTransformChannels( CDmeDag *pDag, CDmeChannel *channels[ 2 ], bool bPosition, bool bRotation ) const;
  59. // Create a transform control of the specified type for the provided dag node and attach it to the specified channel.
  60. CDmeTransformControl *CreateTransformControl( CDmeDag *pDag ) const;
  61. // Create the weight channels for the specified constraint
  62. void CreateWeightChannels( CDmeRigBaseConstraintOperator *pConstraint, CDmeRig *pRig ) const;
  63. // Create a control for the specified weight channel and add it to the animation set
  64. CDmElement *CreateWeightControl( const char *pBaseName, CDmeConstraintTarget *pTarget, CDmeChannel *pDagChannel, bool rig ) const;
  65. // Add a control with the specified name at the specified location to the animation set
  66. void AddControl( CDmElement *pControl, const char *pchGroupPath ) const;
  67. private:
  68. bool m_bValid; // Flag indicating if the context is ready to perform operations
  69. DmeTime_t m_CurrentTime; // Current time at which the script is operating
  70. ChannelMode_t m_ChannelMode; // Current channel operation mode
  71. CDmeClip *m_pMovie; // Current movie in which the script is operating
  72. CDmeFilmClip *m_pShot; // Current shot in which the script is operating
  73. CDmeAnimationSet *m_pAnimSet; // Animation set on which the script is operating
  74. CDmeChannelsClip *m_pChannelsClip; // Channels clip for the animation set
  75. CDmeGameModel *m_pGameModel; // Game model associated with the animation set
  76. CStudioHdr *m_pStudioHdr; // Pointer to a studio model header interface instance
  77. };
  78. //-------------------------------------------------------------------------------------------------
  79. #endif // SFMANIMSETSCRIPTCONTEXT_H