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.

140 lines
5.7 KiB

  1. //====== Copyright � 1996-2009, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Contains the declaration of the CDmeRig, a class which groups a set
  4. // of associated constraints and operators together, allowing operations to be
  5. // performed on the group of elements. Also contains the declaration of
  6. // CDmeRigAnimSetElements, a helper class used to store a list of elements which
  7. // are all associated with a single animation set.
  8. //
  9. //=============================================================================
  10. #ifndef DMERIG_H
  11. #define DMERIG_H
  12. #ifdef _WIN32
  13. #pragma once
  14. #endif
  15. #include "datamodel/dmattributevar.h"
  16. #include "movieobjects/dmedag.h"
  17. #include "movieobjects/dmecontrolgroup.h"
  18. #include "movieobjects/dmeanimationset.h"
  19. // Forward declarations
  20. class CDmeAnimationSet;
  21. class CDmeFilmClip;
  22. //-------------------------------------------------------------------------------------------------
  23. // CDmeRigAnimSetElements: A helper class used by CDmeRig to store a list of elements associated
  24. // with a particular animation set.
  25. //-------------------------------------------------------------------------------------------------
  26. class CDmeRigAnimSetElements : public CDmElement
  27. {
  28. DEFINE_ELEMENT( CDmeRigAnimSetElements, CDmElement );
  29. public:
  30. // Set the animation set elements in the list are to be associated with, only allowed when empty.
  31. void SetAnimationSet( CDmeAnimationSet* pAnimationSet );
  32. // Add an element to the list
  33. void AddElement( CDmElement *pElement );
  34. // Remove the specified element from the list
  35. bool RemoveElement( CDmElement *pElement );
  36. // Remove all of the elements from the list
  37. void RemoveAll();
  38. // Add all of the elements to the provided array
  39. void GetElements( CUtlVector< CDmElement* > &elementList ) const;
  40. // Add a control group to the list of hidden control groups
  41. void AddHiddenControlGroup( CDmeControlGroup *pControlGroup );
  42. // Accessors
  43. CDmeAnimationSet *AnimationSet() const { return m_AnimationSet; }
  44. int NumElements() const { return m_ElementList.Count(); }
  45. const CDmaElementArray< CDmElement > &Elements() const { return m_ElementList; }
  46. const CDmaStringArray &HiddenControlGroups() const { return m_HiddenGroups; }
  47. private:
  48. CDmaElement< CDmeAnimationSet > m_AnimationSet; // "animationSet" : Animation set to which the elements belong
  49. CDmaElementArray< CDmElement > m_ElementList; // "elementList" : List of elements assigned to the group
  50. CDmaStringArray m_HiddenGroups; // "hiddenGroups" : List of names of the groups for which the rig disabled visibility
  51. };
  52. //-------------------------------------------------------------------------------------------------
  53. // CDmeRig: The CDmeRig class represents a grouping of rig constraints, operators, controls and
  54. // other elements which are conceptually a single rig, operating on one or more animation sets.
  55. // By maintaining this grouping it is possible to perform operations such as detach on all of the
  56. // elements associated with rig, even if the rig has elements in multiple animation sets and those
  57. // animation sets have elements from more than one rig. The CDmeRig is no actually required for
  58. // operation of the elements composing the rig, it is merely utility for managing the elements
  59. // associated with a single rig.
  60. //-------------------------------------------------------------------------------------------------
  61. class CDmeRig : public CDmeDag
  62. {
  63. DEFINE_ELEMENT( CDmeRig, CDmeDag );
  64. public:
  65. // Add an element to the rig
  66. void AddElement( CDmElement* pElement, CDmeAnimationSet *pAnimationSet );
  67. // Set the state of the specified control group and add it to list of control group modified by the rig
  68. void HideControlGroup( CDmeControlGroup *pGroup );
  69. // Remove an element from the rig
  70. void RemoveElement( CDmElement *pElement, CDmeAnimationSet *pAnimationSet );
  71. // Remove an animation set and all associated elements from the rig
  72. void RemoveAnimationSet( CDmeAnimationSet *pAnimationSet );
  73. // Determine if the rig has any animation sets associated with it
  74. bool HasAnyAnimationSets() const;
  75. // Get the list of animation sets in the rig
  76. void GetAnimationSets( CUtlVector< CDmeAnimationSet* > &animationSetList ) const;
  77. // Get the list of elements for the specified animation set
  78. void GetAnimationSetElements( const CDmeAnimationSet *pAnimationSet, CUtlVector< CDmElement* > &elementList ) const;
  79. // Determine if the rig has any elements from the specified animation set
  80. bool HasAnimationSet( const CDmeAnimationSet *pAnimationSet ) const;
  81. // Build a list of all of the dag nodes which are influenced by rig
  82. void FindInfluencedDags( CUtlVector< CDmeDag* > &dagList ) const;
  83. // Remove all of elements in the rig from scene
  84. void RemoveElementsFromShot( CDmeFilmClip *pShot );
  85. // Hide all of the control groups in the rig's list of hidden control groups
  86. void HideHiddenControlGroups( CDmeAnimationSet *pAnimationSet );
  87. // Remove the specified element from any rig which it may be associated with.
  88. static void RemoveElementFromRig( CDmElement *pElement );
  89. private:
  90. // Find the element list for the specified animation set
  91. int FindAnimSetElementList( const CDmeAnimationSet *pAnimationSet ) const;
  92. // Find the element list for the specified animation set or create one
  93. CDmeRigAnimSetElements *FindOrCreateAnimSetElementList( CDmeAnimationSet *pAnimationSet );
  94. // Set the visibility of the control groups in the hidden list
  95. void SetHiddenControlGroupVisibility( CDmeRigAnimSetElements *pAnimSetElement, bool bHidden );
  96. CDmaElementArray< CDmeRigAnimSetElements > m_AnimSetList; // "animSetList" : Array of animation set / element groupings
  97. };
  98. void CollectRigsOnAnimationSet( CDmeAnimationSet *pAnimSet, CUtlVector< CDmeRig* > &rigList );
  99. #endif // DMERIGELEMENTGROUP_H