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.

652 lines
22 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef DMECLIP_H
  7. #define DMECLIP_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamodel/dmelement.h"
  12. #include "datamodel/dmattribute.h"
  13. #include "datamodel/dmattributevar.h"
  14. #include "datamodel/dmehandle.h"
  15. #include "avi/iavi.h"
  16. #include "materialsystem/materialsystemutil.h"
  17. #include "tier1/utlmap.h"
  18. #include "videocache/iremotevideomaterial.h"
  19. //-----------------------------------------------------------------------------
  20. // Forward declarations
  21. //-----------------------------------------------------------------------------
  22. class CDmeClip;
  23. class CDmeTimeFrame;
  24. class CDmeBookmark;
  25. class CDmeBookmarkSet;
  26. class CDmeSound;
  27. class CDmeChannel;
  28. class CDmeCamera;
  29. class CDmeDag;
  30. class CDmeInput;
  31. class CDmeOperator;
  32. class CDmeMaterial;
  33. class CDmeTrack;
  34. class CDmeTrackGroup;
  35. class IMaterial;
  36. class CDmeChannelsClip;
  37. class CDmeAnimationSet;
  38. class CDmeMaterialOverlayFXClip;
  39. class DmeLog_TimeSelection_t;
  40. struct TimeSelection_t;
  41. struct Rect_t;
  42. enum ChannelMode_t;
  43. enum DmeClipSkipFlag_t
  44. {
  45. DMESKIP_NONE = 0,
  46. DMESKIP_MUTED = 1,
  47. DMESKIP_INVISIBLE = 2,
  48. };
  49. DEFINE_ENUM_BITWISE_OPERATORS( DmeClipSkipFlag_t )
  50. //-----------------------------------------------------------------------------
  51. // Clip types
  52. //-----------------------------------------------------------------------------
  53. enum DmeClipType_t
  54. {
  55. DMECLIP_UNKNOWN = -1,
  56. DMECLIP_FIRST = 0,
  57. DMECLIP_CHANNEL = 0,
  58. DMECLIP_SOUND,
  59. DMECLIP_FX,
  60. DMECLIP_FILM,
  61. DMECLIP_LAST = DMECLIP_FILM,
  62. DMECLIP_TYPE_COUNT
  63. };
  64. DEFINE_ENUM_INCREMENT_OPERATORS( DmeClipType_t )
  65. struct DmeClipStack_t
  66. {
  67. public:
  68. DmeClipStack_t() : m_bOptimized( false ) {}
  69. DmeClipStack_t( const CDmeClip *pRoot, CDmeClip *pShot, CDmeClip *pClip ) { BuildClipStack( pRoot, pShot, pClip ); }
  70. int GetClipCount() const { return m_clips.Count(); }
  71. const CDmeClip *GetClip( int i ) const { return m_clips[ i ]; }
  72. CDmeClip *GetClip( int i ) { return m_clips[ i ]; }
  73. int FindClip( const CDmeClip *pClip ) const;
  74. int InvalidClipIndex() const { return m_clips.InvalidIndex(); }
  75. bool BuildClipStack( const CDmeClip *pRoot, const CDmeClip *pShot, const CDmeClip *pClip );
  76. int AddClipToHead( const CDmeClip *pClip );
  77. int AddClipToTail( const CDmeClip *pClip );
  78. void RemoveClip( int i ) { m_clips.Remove( i ); m_bOptimized = false; }
  79. void RemoveAll() { m_clips.RemoveAll(); m_bOptimized = false; }
  80. DmeTime_t ToChildMediaTime ( DmeTime_t t, bool bClamp = true ) const;
  81. DmeTime_t FromChildMediaTime( DmeTime_t t, bool bClamp = true ) const;
  82. DmeTime_t ToChildMediaDuration ( DmeTime_t t ) const;
  83. DmeTime_t FromChildMediaDuration( DmeTime_t t ) const;
  84. void ToChildMediaTime( TimeSelection_t &params ) const;
  85. protected:
  86. // Given a root clip and a child (or grandchild) clip, builds the stack
  87. // from root on down to the destination clip. If shot is specified, then it
  88. // must build a clip stack that passes through the shot
  89. bool BuildClipStack_R( const CDmeClip *pMovie, const CDmeClip *pShot, const CDmeClip *pCurrent );
  90. CUtlVector< CDmeHandle< CDmeClip > > m_clips;
  91. mutable DmeTime_t m_tStart;
  92. mutable DmeTime_t m_tDuration;
  93. mutable DmeTime_t m_tOffset;
  94. mutable double m_flScale;
  95. mutable bool m_bOptimized;
  96. void Optimize() const;
  97. };
  98. //-----------------------------------------------------------------------------
  99. // Is a particular clip type non-overlapping?
  100. //-----------------------------------------------------------------------------
  101. inline bool IsNonoverlapping( DmeClipType_t type )
  102. {
  103. return ( type == DMECLIP_FILM );
  104. }
  105. //-----------------------------------------------------------------------------
  106. // String to clip type + back
  107. //-----------------------------------------------------------------------------
  108. DmeClipType_t ClipTypeFromString( const char *pName );
  109. const char *ClipTypeToString( DmeClipType_t type );
  110. //-----------------------------------------------------------------------------
  111. // Used to move clips in non-film track groups with film clips
  112. //-----------------------------------------------------------------------------
  113. struct ClipAssociation_t
  114. {
  115. enum AssociationType_t
  116. {
  117. HAS_CLIP = 0,
  118. BEFORE_START,
  119. AFTER_END,
  120. NO_MOVEMENT,
  121. };
  122. AssociationType_t m_nType;
  123. CDmeHandle< CDmeClip > m_hClip;
  124. CDmeHandle< CDmeClip > m_hAssociation;
  125. DmeTime_t m_startTimeInAssociatedClip; // used for HAS_CLIP
  126. DmeTime_t m_offset; // used for BEFORE_START and AFTER_END
  127. };
  128. //-----------------------------------------------------------------------------
  129. // Constructor, destructor
  130. //-----------------------------------------------------------------------------
  131. class CDmeClip : public CDmElement
  132. {
  133. DEFINE_ELEMENT( CDmeClip, CDmElement );
  134. public:
  135. // Returns the time frame
  136. CDmeTimeFrame *GetTimeFrame() const;
  137. DmeTime_t ToChildMediaTime ( DmeTime_t t, bool bClamp = true ) const;
  138. DmeTime_t FromChildMediaTime( DmeTime_t t, bool bClamp = true ) const;
  139. DmeTime_t ToChildMediaDuration ( DmeTime_t dt ) const;
  140. DmeTime_t FromChildMediaDuration( DmeTime_t dt ) const;
  141. DmeTime_t GetStartTime() const;
  142. DmeTime_t GetEndTime() const;
  143. DmeTime_t GetDuration() const;
  144. DmeTime_t GetTimeOffset() const;
  145. DmeTime_t GetStartInChildMediaTime() const;
  146. DmeTime_t GetEndInChildMediaTime() const;
  147. float GetTimeScale() const;
  148. void SetStartTime ( DmeTime_t t );
  149. void SetDuration ( DmeTime_t t );
  150. void SetTimeOffset( DmeTime_t t );
  151. void SetTimeScale ( float s );
  152. virtual void BakeTimeScale( float scale = 1.0f );
  153. // Given a root clip and a child (or grandchild) clip, builds the stack
  154. // from root on down to the destination clip. If shot is specified, then it
  155. // must build a clip stack that passes through the shot
  156. bool BuildClipStack( DmeClipStack_t* pStack, const CDmeClip *pRoot, CDmeClip *pShot = NULL );
  157. void SetClipColor( const Color& clr );
  158. Color GetClipColor() const;
  159. void SetClipText( const char *pText );
  160. const char* GetClipText() const;
  161. // Clip type
  162. virtual DmeClipType_t GetClipType() { return DMECLIP_UNKNOWN; }
  163. // Track group iteration methods
  164. int GetTrackGroupCount() const;
  165. CDmeTrackGroup *GetTrackGroup( int nIndex ) const;
  166. const CUtlVector< DmElementHandle_t > &GetTrackGroups( ) const;
  167. // Track group addition/removal
  168. void AddTrackGroup( CDmeTrackGroup *pTrackGroup );
  169. void AddTrackGroupBefore( CDmeTrackGroup *pTrackGroup, CDmeTrackGroup *pBefore );
  170. CDmeTrackGroup *AddTrackGroup( const char *pTrackGroupName );
  171. void RemoveTrackGroup( int nIndex );
  172. void RemoveTrackGroup( CDmeTrackGroup *pTrackGroup );
  173. void RemoveTrackGroup( const char *pTrackGroupName );
  174. // Track group finding
  175. CDmeTrackGroup *FindTrackGroup( const char *pTrackGroupName ) const;
  176. int GetTrackGroupIndex( CDmeTrackGroup *pTrack ) const;
  177. CDmeTrackGroup *FindOrAddTrackGroup( const char *pTrackGroupName );
  178. // Swap track groups
  179. void SwapOrder( CDmeTrackGroup *pTrackGroup1, CDmeTrackGroup *pTrackGroup2 );
  180. // Clip finding
  181. virtual CDmeTrack *FindTrackForClip( CDmeClip *pClip, CDmeTrackGroup **ppTrackGroup = NULL ) const;
  182. bool FindMultiTrackGroupForClip( CDmeClip *pClip, int *pTrackGroupIndex, int *pTrackIndex = NULL, int *pClipIndex = NULL ) const;
  183. // Finding clips in tracks by time
  184. virtual void FindClipsAtTime( DmeClipType_t clipType, DmeTime_t time, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const;
  185. virtual void FindClipsIntersectingTime( DmeClipType_t clipType, DmeTime_t startTime, DmeTime_t endTime, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const;
  186. virtual void FindClipsWithinTime ( DmeClipType_t clipType, DmeTime_t startTime, DmeTime_t endTime, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const;
  187. // Is a particular clip typed able to be added?
  188. bool IsSubClipTypeAllowed( DmeClipType_t type ) const;
  189. // Returns the special film track group
  190. virtual CDmeTrackGroup *GetFilmTrackGroup() const { return NULL; }
  191. virtual CDmeTrack *GetFilmTrack() const { return NULL; }
  192. // Checks for muteness
  193. void SetMute( bool state );
  194. bool IsMute( ) const;
  195. // Clip vertical display size
  196. void SetDisplayScale( float flDisplayScale );
  197. float GetDisplayScale() const;
  198. protected:
  199. virtual int AllowedClipTypes() const { return 1 << DMECLIP_CHANNEL; }
  200. // Is a track group valid to add?
  201. bool IsTrackGroupValid( CDmeTrackGroup *pTrackGroup );
  202. CDmaElementArray< CDmeTrackGroup > m_TrackGroups;
  203. CDmaElement< CDmeTimeFrame > m_TimeFrame;
  204. CDmaVar< Color > m_ClipColor;
  205. CDmaVar< bool > m_bMute;
  206. CDmaVar< float > m_flDisplayScale;
  207. CDmaString m_ClipText;
  208. };
  209. inline bool CDmeClip::IsSubClipTypeAllowed( DmeClipType_t type ) const
  210. {
  211. return ( AllowedClipTypes() & ( 1 << type ) ) != 0;
  212. }
  213. inline void CDmeClip::SetMute( bool state )
  214. {
  215. m_bMute = state;
  216. }
  217. inline bool CDmeClip::IsMute( ) const
  218. {
  219. return m_bMute;
  220. }
  221. //-----------------------------------------------------------------------------
  222. // Clip vertical display size
  223. //-----------------------------------------------------------------------------
  224. inline void CDmeClip::SetDisplayScale( float flDisplayScale )
  225. {
  226. m_flDisplayScale = flDisplayScale;
  227. }
  228. inline float CDmeClip::GetDisplayScale() const
  229. {
  230. return m_flDisplayScale;
  231. }
  232. //-----------------------------------------------------------------------------
  233. // Sound clip
  234. //-----------------------------------------------------------------------------
  235. class CDmeSoundClip : public CDmeClip
  236. {
  237. DEFINE_ELEMENT( CDmeSoundClip, CDmeClip );
  238. public:
  239. virtual DmeClipType_t GetClipType() { return DMECLIP_SOUND; }
  240. void SetShowWave( bool state );
  241. bool ShouldShowWave( ) const;
  242. void SetFadeTimes( DmeTime_t fadeIn, DmeTime_t fadeOut ) { m_fadeInDuration = fadeIn; m_fadeOutDuration = fadeOut; }
  243. void SetFadeInTime( DmeTime_t t ) { m_fadeInDuration = t; }
  244. void SetFadeOutTime( DmeTime_t t ) { m_fadeOutDuration = t; }
  245. DmeTime_t GetFadeInTime() const { return m_fadeInDuration; }
  246. DmeTime_t GetFadeOutTime() const { return m_fadeOutDuration; }
  247. float GetVolumeFade( DmeTime_t tParent );
  248. virtual void BakeTimeScale( float scale = 1.0f );
  249. CDmaElement< CDmeSound > m_Sound;
  250. CDmaVar< bool > m_bShowWave;
  251. CDmaTime m_fadeInDuration;
  252. CDmaTime m_fadeOutDuration;
  253. };
  254. //-----------------------------------------------------------------------------
  255. // Clip containing recorded data from the game
  256. //-----------------------------------------------------------------------------
  257. class CDmeChannelsClip : public CDmeClip
  258. {
  259. DEFINE_ELEMENT( CDmeChannelsClip, CDmeClip );
  260. public:
  261. virtual DmeClipType_t GetClipType() { return DMECLIP_CHANNEL; }
  262. virtual void BakeTimeScale( float scale = 1.0f );
  263. CDmeChannel *CreatePassThruConnection
  264. (
  265. char const *passThruName,
  266. CDmElement *pFrom,
  267. char const *pFromAttribute,
  268. CDmElement *pTo,
  269. char const *pToAttribute,
  270. int index = 0
  271. );
  272. void RemoveChannel( CDmeChannel *pChannel );
  273. // Set the mode of all of the channels in the clip
  274. void SetChannelMode( const ChannelMode_t &mode );
  275. // Operate all of the channels in the clip
  276. void OperateChannels();
  277. // Play all of the channels in the clip
  278. void PlayChannels();
  279. CDmaElementArray< CDmeChannel > m_Channels;
  280. };
  281. //-----------------------------------------------------------------------------
  282. // An effect clip
  283. //-----------------------------------------------------------------------------
  284. class CDmeFXClip : public CDmeClip
  285. {
  286. DEFINE_ELEMENT( CDmeFXClip, CDmeClip );
  287. public:
  288. virtual DmeClipType_t GetClipType() { return DMECLIP_FX; }
  289. enum
  290. {
  291. MAX_FX_INPUT_TEXTURES = 3
  292. };
  293. // All effects must be able to apply their effect
  294. virtual void ApplyEffect( DmeTime_t time, Rect_t &currentRect, Rect_t &totalRect, ITexture *pTextures[MAX_FX_INPUT_TEXTURES] ) {}
  295. // Global list of FX clip types
  296. static void InstallFXClipType( const char *pElementType, const char *pDescription );
  297. static int FXClipTypeCount();
  298. static const char *FXClipType( int nIndex );
  299. static const char *FXClipDescription( int nIndex );
  300. private:
  301. enum
  302. {
  303. MAX_FXCLIP_TYPES = 16
  304. };
  305. static const char *s_pFXClipTypes[MAX_FXCLIP_TYPES];
  306. static const char *s_pFXClipDescriptions[MAX_FXCLIP_TYPES];
  307. static int s_nFXClipTypeCount;
  308. };
  309. //-----------------------------------------------------------------------------
  310. // Helper Template factory for simple creation of factories
  311. //-----------------------------------------------------------------------------
  312. template <class T>
  313. class CDmFXClipFactory : public CDmElementFactory<T>
  314. {
  315. public:
  316. CDmFXClipFactory( const char *pLookupName, const char *pDescription ) : CDmElementFactory<T>( pLookupName )
  317. {
  318. CDmeFXClip::InstallFXClipType( pLookupName, pDescription );
  319. }
  320. };
  321. //-----------------------------------------------------------------------------
  322. // All effects must use IMPLEMENT_FX_CLIP_ELEMENT_FACTORY instead of IMPLEMENT_ELEMENT_FACTORY
  323. //-----------------------------------------------------------------------------
  324. #if defined( MOVIEOBJECTS_LIB ) || defined ( DATAMODEL_LIB ) || defined ( DMECONTROLS_LIB )
  325. #define IMPLEMENT_FX_CLIP_ELEMENT_FACTORY( lookupName, className, description ) \
  326. IMPLEMENT_ELEMENT( className ) \
  327. CDmFXClipFactory< className > g_##className##_Factory( #lookupName, description ); \
  328. CDmElementFactoryHelper g_##className##_Helper( #lookupName, &g_##className##_Factory, true ); \
  329. className *g_##className##LinkerHack = NULL;
  330. #else
  331. #define IMPLEMENT_FX_CLIP_ELEMENT_FACTORY( lookupName, className, description ) \
  332. IMPLEMENT_ELEMENT( className ) \
  333. CDmFXClipFactory< className > g_##className##_Factory( #lookupName, description ); \
  334. CDmElementFactoryHelper g_##className##_Helper( #lookupName, &g_##className##_Factory, false ); \
  335. className *g_##className##LinkerHack = NULL;
  336. #endif
  337. //-----------------------------------------------------------------------------
  338. // Film clip
  339. //-----------------------------------------------------------------------------
  340. class CDmeFilmClip : public CDmeClip
  341. {
  342. DEFINE_ELEMENT( CDmeFilmClip, CDmeClip );
  343. public:
  344. virtual DmeClipType_t GetClipType() { return DMECLIP_FILM; }
  345. virtual void BakeTimeScale( float scale = 1.0f );
  346. // Attribute changed
  347. virtual void OnElementUnserialized( );
  348. virtual void OnAttributeChanged( CDmAttribute *pAttribute );
  349. // Resolve
  350. virtual void Resolve();
  351. // Returns the special film track group
  352. virtual CDmeTrackGroup *GetFilmTrackGroup() const;
  353. virtual CDmeTrack *GetFilmTrack() const;
  354. CDmeTrackGroup *FindOrCreateFilmTrackGroup();
  355. CDmeTrack *FindOrCreateFilmTrack();
  356. // Clip finding
  357. virtual CDmeTrack *FindTrackForClip( CDmeClip *pClip, CDmeTrackGroup **ppTrackGroup = NULL ) const;
  358. // Finding clips in tracks by time
  359. virtual void FindClipsAtTime( DmeClipType_t clipType, DmeTime_t time, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const;
  360. virtual void FindClipsIntersectingTime( DmeClipType_t clipType, DmeTime_t startTime, DmeTime_t endTime, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const;
  361. virtual void FindClipsWithinTime ( DmeClipType_t clipType, DmeTime_t startTime, DmeTime_t endTime, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const;
  362. // mapname helper methods
  363. const char *GetMapName();
  364. void SetMapName( const char *pMapName );
  365. // Returns the camera associated with the clip
  366. CDmeCamera *GetCamera();
  367. void SetCamera( CDmeCamera *pCamera );
  368. // Audio volume
  369. void SetVolume( float state );
  370. float GetVolume() const;
  371. int GetConCommandCount() const;
  372. const char *GetConCommand( int i ) const;
  373. int GetConVarCount() const;
  374. const char *GetConVar( int i ) const;
  375. // Returns the monitor camera associated with the clip (for now, only 1 supported)
  376. CDmeCamera *GetMonitorCamera();
  377. void AddMonitorCamera( CDmeCamera *pCamera );
  378. void RemoveMonitorCamera( CDmeCamera *pCamera );
  379. void SelectMonitorCamera( CDmeCamera *pCamera );
  380. int FindMonitorCamera( CDmeCamera *pCamera );
  381. // Scene / Dag helper methods
  382. void SetScene( CDmeDag *pDag );
  383. CDmeDag *GetScene( bool bCreateIfNull = false );
  384. // helper for inputs and operators
  385. int GetInputCount();
  386. CDmeInput *GetInput( int nIndex );
  387. void AddInput( CDmeInput *pInput );
  388. void RemoveAllInputs();
  389. void AddOperator( CDmeOperator *pOperator );
  390. void RemoveOperator( CDmeOperator *pOperator );
  391. void CollectOperators( CUtlVector< DmElementHandle_t > &operators );
  392. CDmaElementArray< CDmeOperator > &GetOperators();
  393. // Helper for overlays
  394. // FIXME: Change this to use CDmeMaterials
  395. IMaterial *GetOverlayMaterial();
  396. void SetOverlay( const char *pMaterialName );
  397. float GetOverlayAlpha();
  398. void SetOverlayAlpha( float alpha );
  399. void DrawOverlay( DmeTime_t time, Rect_t &currentRect, Rect_t &totalRect );
  400. bool HasOpaqueOverlay();
  401. // AVI tape out
  402. void UseCachedVersion( bool bUseCachedVersion );
  403. bool IsUsingCachedVersion() const;
  404. AVIMaterial_t GetCachedAVI();
  405. void SetCachedAVI( const char *pAVIFile );
  406. void AssignRemoteVideoMaterial( IRemoteVideoMaterial *theMaterial );
  407. void UpdateRemoteVideoMaterialStatus();
  408. bool HasRemoteVideo();
  409. bool GetCachedQTVideoFrameAt( float timeInSec );
  410. IMaterial *GetRemoteVideoMaterial();
  411. void GetRemoteVideoMaterialTexCoordRange( float *u, float *v );
  412. CDmaElementArray< CDmeAnimationSet > &GetAnimationSets(); // raw access to the array
  413. const CDmaElementArray< CDmeAnimationSet > &GetAnimationSets() const;
  414. CDmeAnimationSet *FindAnimationSet( const char *pAnimSetName ) const;
  415. const CDmaElementArray< CDmeBookmarkSet > &GetBookmarkSets() const;
  416. CDmaElementArray< CDmeBookmarkSet > &GetBookmarkSets();
  417. int GetActiveBookmarkSetIndex() const;
  418. void SetActiveBookmarkSetIndex( int nActiveBookmarkSet );
  419. CDmeBookmarkSet *GetActiveBookmarkSet();
  420. CDmeBookmarkSet *CreateBookmarkSet( const char *pName = "default set" );
  421. void SetFadeTimes( DmeTime_t fadeIn, DmeTime_t fadeOut ) { m_fadeInDuration = fadeIn; m_fadeOutDuration = fadeOut; }
  422. void SetFadeInTime( DmeTime_t t ) { m_fadeInDuration = t; }
  423. void SetFadeOutTime( DmeTime_t t ) { m_fadeOutDuration = t; }
  424. DmeTime_t GetFadeInTime() const { return m_fadeInDuration; }
  425. DmeTime_t GetFadeOutTime() const { return m_fadeOutDuration; }
  426. // Used to move clips in non-film track groups with film clips
  427. // Call BuildClipAssociations before modifying the film track,
  428. // then UpdateAssociatedClips after modifying it.
  429. void BuildClipAssociations( CUtlVector< ClipAssociation_t > &association, bool bHandleGaps = true );
  430. void UpdateAssociatedClips( CUtlVector< ClipAssociation_t > &association );
  431. void LatchWorkCamera( CDmeCamera *pCamera );
  432. void UpdateWorkCamera( CDmeCamera *pCamera );
  433. void PreviousWorkCamera();
  434. void NextWorkCamera();
  435. CDmeCamera *GetCurrentCameraStackEntry();
  436. void PurgeCameraStack();
  437. private:
  438. virtual int AllowedClipTypes() const { return (1 << DMECLIP_CHANNEL) | (1 << DMECLIP_SOUND) | (1 << DMECLIP_FX) | (1 << DMECLIP_FILM); }
  439. CDmaElement< CDmeTrackGroup > m_FilmTrackGroup;
  440. CDmaString m_MapName;
  441. CDmaElement < CDmeCamera > m_Camera;
  442. CDmaElementArray< CDmeCamera > m_MonitorCameras;
  443. CDmaVar< int > m_nActiveMonitor;
  444. CDmaElement < CDmeDag > m_Scene;
  445. CDmaElementArray< CDmeInput > m_Inputs;
  446. CDmaElementArray< CDmeOperator > m_Operators;
  447. CDmaString m_AVIFile;
  448. CDmaTime m_fadeInDuration;
  449. CDmaTime m_fadeOutDuration;
  450. CDmaElement< CDmeMaterialOverlayFXClip >m_MaterialOverlayEffect;
  451. CDmaVar< bool > m_bIsUsingCachedVersion;
  452. CDmaElementArray< CDmeAnimationSet > m_AnimationSets; // "animationSets"
  453. CDmaElementArray< CDmeBookmarkSet > m_BookmarkSets; // "bookmarkSets"
  454. CDmaVar< int > m_nActiveBookmarkSet; // "activeBookmarkSet"
  455. CDmaVar< float > m_Volume;
  456. CDmaStringArray m_ConCommands;
  457. CDmaStringArray m_ConVars;
  458. AVIMaterial_t m_hCachedVersion;
  459. bool m_bReloadCachedVersion;
  460. CMaterialReference m_FadeMaterial;
  461. CDmaElementArray< CDmeCamera > m_CameraStack;
  462. int m_nCurrentStackCamera;
  463. IRemoteVideoMaterial *m_pRemoteVideoMaterial;
  464. };
  465. //-----------------------------------------------------------------------------
  466. // Fast type conversions
  467. //-----------------------------------------------------------------------------
  468. inline bool IsFilmClip( CDmeClip *pClip )
  469. {
  470. return pClip && pClip->IsA( CDmeFilmClip::GetStaticTypeSymbol() );
  471. }
  472. //-----------------------------------------------------------------------------
  473. // Creates a slug clip
  474. //-----------------------------------------------------------------------------
  475. CDmeFilmClip *CreateSlugClip( const char *pClipName, DmeTime_t startTime, DmeTime_t endTime, DmFileId_t fileid );
  476. //-----------------------------------------------------------------------------
  477. // For use in template functions
  478. //-----------------------------------------------------------------------------
  479. template <class T>
  480. class CDmeClipInfo
  481. {
  482. public:
  483. static DmeClipType_t ClipType( ) { return DMECLIP_UNKNOWN; }
  484. };
  485. #define DECLARE_DMECLIP_TYPE( _className, _dmeClipType ) \
  486. template< > class CDmeClipInfo< _className > \
  487. { \
  488. public: \
  489. static DmeClipType_t ClipType() { return _dmeClipType; } \
  490. };
  491. DECLARE_DMECLIP_TYPE( CDmeSoundClip, DMECLIP_SOUND )
  492. DECLARE_DMECLIP_TYPE( CDmeChannelsClip, DMECLIP_CHANNEL )
  493. DECLARE_DMECLIP_TYPE( CDmeFXClip, DMECLIP_FX )
  494. DECLARE_DMECLIP_TYPE( CDmeFilmClip, DMECLIP_FILM )
  495. #define DMECLIP_TYPE( _className ) CDmeClipInfo<T>::ClipType()
  496. //-----------------------------------------------------------------------------
  497. // helper methods
  498. //-----------------------------------------------------------------------------
  499. CDmeTrack *GetParentTrack( CDmeClip *pClip );
  500. CDmeChannel *FindChannelTargetingElement( CDmElement *pElement, const char *pAttributeName = NULL );
  501. CDmeChannel *FindChannelTargetingElement( CDmeChannelsClip *pChannelsClip, CDmElement *pElement, const char *pAttributeName = NULL );
  502. CDmeChannel *FindChannelTargetingElement( CDmeFilmClip *pClip, CDmElement *pElement, const char *pAttributeName, CDmeChannelsClip **ppChannelsClip, CDmeTrack **ppTrack = NULL, CDmeTrackGroup **ppTrackGroup = NULL );
  503. CDmeFilmClip *FindFilmClipContainingDag( CDmeDag *pDag );
  504. void BuildClipStackList( const CUtlVector< CDmeChannel* > &channelList, CUtlVector< DmeClipStack_t > &clipStackList, CUtlVector< DmeTime_t > &orginalTimeList, const CDmeClip *pMovie, CDmeClip *pShot );
  505. void PlayChannelsAtTime( DmeTime_t time, const CUtlVector< CDmeChannel* > &channelList, const CUtlVector< CDmeOperator* > &operatorList, const CUtlVector< DmeClipStack_t > &clipStackList, bool forcePlay = true );
  506. void PlayChannelsAtLocalTimes( const CUtlVector< DmeTime_t > &timeList, const CUtlVector< CDmeChannel* > &channelList, const CUtlVector< CDmeOperator* > &operatorList, bool forcePlay = true );
  507. #endif // DMECLIP_H