summaryrefslogtreecommitdiff
path: root/utils/hlfaceposer/expression.h
blob: 1a6d1346c2e5971c202541d6c24d34518b1165c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef EXPRESSION_H
#define EXPRESSION_H
#ifdef _WIN32
#pragma once
#endif

#include "utlvector.h"
#include "mxBitmapTools.h"
#include "hlfaceposer.h"

#define GLOBAL_STUDIO_FLEX_CONTROL_COUNT ( MAXSTUDIOFLEXCTRL * 4 )

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CExpUndoInfo
{
public:
	float				setting[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];
	float				weight[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];

	float				redosetting[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];
	float				redoweight[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];

	int					counter;
};

class CExpression;
class CExpClass;

typedef unsigned int CRC32_t;

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CExpression
{
public:
						CExpression	( void );
						~CExpression ( void );

						CExpression( const CExpression& from );

	void				SetModified( bool mod );
	bool				GetModified( void );
						
	void				ResetUndo( void );

	bool				CanUndo( void );
	bool				CanRedo( void );

	int					UndoLevels( void );
	int					UndoCurrent( void );

	const char 			*GetBitmapFilename( int modelindex );
	const char			*GetBitmapCheckSum();
	CRC32_t				GetBitmapCRC();
	void				CreateNewBitmap( int modelindex );

	void				PushUndoInformation( void );
	void				PushRedoInformation( void );

	void				Undo( void );
	void				Redo( void );

	void				SetSelected( bool selected );
	bool				GetSelected( void );

	float				*GetSettings( void );
	float				*GetWeights( void );

	bool				GetDirty( void );
	void				SetDirty( bool dirty );

	void				Revert( void );

	CExpClass			*GetExpressionClass( void );
	void				SetExpressionClass( char const *classname );

	// name of expression
	char				name[32];			
	int					index;
	char				description[128];

	mxbitmapdata_t		m_Bitmap[ MAX_FP_MODELS ];

	bool				m_bModified;

	// Undo information
	CUtlVector< CExpUndoInfo * >		undo;
	int								m_nUndoCurrent;

	bool				m_bSelected;

	bool				m_bDirty;

private:
	// settings of fields
	float				setting[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];		
	float				weight[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];		

	char				expressionclass[ 128 ];

	void WipeRedoInformation(  void );
};

#endif // EXPRESSION_H