1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
3 #ifndef __FacialSequenceDialog_h__
4 #define __FacialSequenceDialog_h__
7 #include "Dialogs/ToolbarDialog.h"
8 #include "FacialSlidersCtrl.h"
9 #include "Controls/SplitterCtrl.h"
10 #include "Controls/SplineCtrlEx.h"
11 #include "Controls/TimelineCtrl.h"
12 #include "Audio/WaveGraphCtrl.h"
13 #include "PhonemesCtrl.h"
15 //////////////////////////////////////////////////////////////////////////
16 class CFacialChannelTreeCtrl
: public CXTTreeCtrl
18 DECLARE_DYNAMIC(CFacialChannelTreeCtrl
)
20 CFacialChannelTreeCtrl();
21 ~CFacialChannelTreeCtrl();
25 IFacialAnimChannel
* GetSelectedChannel();
27 void SetContext(CFacialEdContext
* pContext
);
28 void SelectChannel(IFacialAnimChannel
* pChannel
, bool bExclusive
);
30 std::vector
<string
> m_selectedChannelIDs
;
36 CImageList m_imageList
;
37 std::map
<IFacialAnimChannel
*, HTREEITEM
> m_itemsMap
;
38 CFacialEdContext
* m_pContext
;
41 //////////////////////////////////////////////////////////////////////////
42 class CFacialSequenceDialog
: public CCustomFrameWnd
, public IFacialEdListener
, public ISplineSet
, public IEditorNotifyListener
44 DECLARE_DYNAMIC(CFacialSequenceDialog
)
45 friend class CSequenceDialogDropTarget
;
47 CFacialSequenceDialog();
48 ~CFacialSequenceDialog();
50 void SetContext(CFacialEdContext
* pContext
);
51 void LipSync(int waveformIndex
);
52 void RemoveSoundEntry(int waveformIndex
);
53 void ClearAllSoundEntries();
54 IFacialAnimChannel
* GetLipSyncGroup();
55 IFacialAnimChannel
* GetBakedLipSyncGroup();
56 bool DoPhonemeExtraction(CString wavFile
, CString strText
, struct IFacialAnimSequence
* pSeq
, int soundEntryIndex
);
57 _smart_ptr
<IFacialAnimSequence
> CreateSequenceWithSelectedExpressions();
59 // ISplineSet implementation
60 virtual ISplineInterpolator
* GetSplineFromID(const string
& id
);
61 virtual string
GetIDFromSpline(ISplineInterpolator
* pSpline
);
62 virtual int GetSplineCount() const;
63 virtual int GetKeyCountAtTime(float time
, float threshold
) const;
65 // IEditorNotifyListener implementation
66 virtual void OnEditorNotifyEvent(EEditorNotifyEvent event
);
68 void SetSmoothingSigma(float smoothingSigma
) { m_fSmoothingSigma
= smoothingSigma
; UpdateSmoothSplineSigma(); }
69 float GetSmoothingSigma() const { return m_fSmoothingSigma
; }
70 void SetNoiseThreshold(float noiseThreshold
) { m_fNoiseThreshold
= noiseThreshold
; UpdateRemoveNoiseSigma(); }
71 float GetNoiseThreshold() const { return m_fNoiseThreshold
; }
72 void SetKeyCleanupThreshold(float keyCleanupThreshold
) { m_fKeyCleanupThreshold
= keyCleanupThreshold
; UpdateKeyCleanupErrorMax(); }
73 float GetKeyCleanupThreshold() const { return m_fKeyCleanupThreshold
; }
75 void LoadSequenceSound(const string
& filename
);
80 virtual void OnOK() {};
81 virtual void OnCancel() {};
83 virtual BOOL
OnInitDialog();
84 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
89 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
91 afx_msg
void OnTreeRClick(NMHDR
* pNMHDR
, LRESULT
* pResult
);
92 afx_msg
void OnTreeSelChanged(NMHDR
* pNMHDR
, LRESULT
* pResult
);
93 afx_msg
void OnTreeItemExpanded(NMHDR
* pNMHDR
, LRESULT
* pResult
);
94 afx_msg
void OnAddSelectedEffector();
95 afx_msg
void OnNewFolder();
96 afx_msg
void OnRenameFolder();
97 afx_msg
void OnRemoveSelected();
98 afx_msg
void OnTimelineChangeStart(NMHDR
* pNMHDR
, LRESULT
* pResult
);
99 afx_msg
void OnTimelineChangeEnd(NMHDR
* pNMHDR
, LRESULT
* pResult
);
100 afx_msg
void OnTimelineChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
101 afx_msg
void OnTimelineDeletePressed(NMHDR
* pNMHDR
, LRESULT
* pResult
);
102 afx_msg
void OnWaveCtrlTimeChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
103 afx_msg
void OnSplineScrollZoom(NMHDR
* pNMHDR
, LRESULT
* pResult
);
104 afx_msg
void OnSplineTimeChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
105 afx_msg
void OnWaveScrollZoom(NMHDR
* pNMHDR
, LRESULT
* pResult
);
106 afx_msg
void OnWaveRClick(NMHDR
* pNMHDR
, LRESULT
* pResult
);
107 afx_msg
void OnBeginMoveWaveform(NMHDR
* pNMHDR
, LRESULT
* pResult
);
108 afx_msg
void OnMoveWaveforms(NMHDR
* pNMHDR
, LRESULT
* pResult
);
109 afx_msg
void OnResetWaveformChanges(NMHDR
* pNMHDR
, LRESULT
* pResult
);
110 afx_msg
void OnEndWaveformChanges(NMHDR
* pNMHDR
, LRESULT
* pResult
);
111 afx_msg
void OnSplineChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
112 afx_msg
void OnSplineBeginChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
114 afx_msg
void OnPhonemesBeforeChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
115 afx_msg
void OnPhonemesChange(NMHDR
* pNMHDR
, LRESULT
* pResult
);
116 afx_msg
void OnPhonemesPreview(NMHDR
* pNMHDR
, LRESULT
* pResult
);
117 afx_msg
void OnPhonemesClear(NMHDR
* pNMHDR
, LRESULT
* pResult
);
118 afx_msg
void OnPhonemesBake(NMHDR
* pNMHDR
, LRESULT
* pResult
);
120 afx_msg
void OnSplineCmd(UINT cmd
);
121 afx_msg
void OnSplineCmdUpdateUI(CCmdUI
* pCmdUI
);
123 afx_msg
void OnPlay();
124 afx_msg
void OnPlayUpdate(CCmdUI
* pCmdUI
);
125 afx_msg
void OnStop();
126 afx_msg
void OnSequenceProperties();
127 afx_msg
void OnSpeedChange();
128 afx_msg
void OnFrameChange();
130 afx_msg
void OnZeroAll();
131 afx_msg
void OnKeyAll();
132 afx_msg
void OnSkeletonAnim();
133 afx_msg
void OnCameraAnim();
134 afx_msg
void OnOverlapSounds();
135 afx_msg
void OnControlAmplitude();
136 afx_msg
void OnSmoothSplineSigmaChange();
137 afx_msg
void OnKeyCleanupErrorMaxChange();
138 afx_msg
void OnRemoveNoiseSigmaChange();
140 afx_msg BOOL
OnMouseWheel(UINT nFlags
, short zDelta
, CPoint pt
);
141 afx_msg
void OnBeginDrag(NMHDR
* pNMHDR
, LRESULT
* pResult
);
142 afx_msg
void OnDestroy();
144 int OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl
);
146 //////////////////////////////////////////////////////////////////////////
147 void SelectChannel(IFacialAnimChannel
* pChannel
, bool bExclusive
);
148 void SelectChannels(int numChannels
, IFacialAnimChannel
** ppChannels
, bool bExclusive
= true);
149 void OnSelectionChange();
151 void ReloadPhonemeCtrl();
153 void OnTimeChanged();
154 void OnSoundChanged();
155 void AddPhonemeStrengthChannel();
156 void AddVertexDragChannel();
157 void AddBalanceChannel();
158 void AddCategoryBalanceChannel();
159 void AddLipsyncCategoryStrengthChannel();
160 void AddProceduralStrengthChannel();
163 void RemoveNoiseFromKeys();
164 void AddLayerToChannel();
165 void DeleteLayerOfChannel();
166 void CollapseLayersForChannel();
167 void InsertShapeIntoChannel();
168 void InsertVisimeSeriesIntoChannel();
171 virtual void OnFacialEdEvent(EFacialEdEvent event
, IFacialEffector
* pEffector
, int nChannelCount
, IFacialAnimChannel
** ppChannels
);
173 IFacialAnimChannel
* GetChannelFromSpline(ISplineInterpolator
* pSpline
);
174 void DisplayPlaybackSpeedInToolbar();
175 float ReadPlaybackSpeedFromToolbar();
176 float ReadFrameFromToolbar();
177 float ReadSmoothSigmaFromToolbar();
178 float ReadKeyCleanupErrorMaxFromToolbar();
179 float ReadRemoveNoiseSigmaFromToolbar();
180 void UpdateSkeletonAnimationStatus();
181 void UpdateCameraAnimationStatus();
182 void UpdateOverlapSoundStatus();
183 void UpdateControlAmplitudeStatus();
184 void UpdateSmoothSplineSigma();
185 void UpdateKeyCleanupErrorMax();
186 void UpdateRemoveNoiseSigma();
188 void ReloadWaveCtrlSounds();
191 CSplitterCtrl m_splitWnd
;
192 CSplitterCtrl m_splitWnd2
;
194 CFacialChannelTreeCtrl m_channelsCtrl
;
195 CSplineCtrlEx m_splineCtrl
;
196 CTimelineCtrl m_timelineCtrl
;
197 IFacialAnimChannel
* m_pCurrent
;
198 CXTPControlEdit
* m_pTimeEdit
;
199 CXTPControlEdit
* m_pFrameEdit
;
200 CXTPControlEdit
* m_pSpeedEdit
;
201 CXTPControlButton
* m_pAnimSkeletonButton
;
202 CXTPControlButton
* m_pAnimCameraButton
;
203 CXTPControlButton
* m_pOverlapSoundsButton
;
204 CXTPControlButton
* m_pControlAmplitudeButton
;
205 CXTPControlEdit
* m_pSmoothValueEdit
;
206 CXTPControlEdit
* m_pCleanupKeysValueEdit
;
207 CXTPControlEdit
* m_pRemoveNoiseValueEdit
;
208 CWaveGraphCtrl m_waveCtrl
;
209 CPhonemesCtrl m_phonemesCtrl
;
211 CFacialEdContext
* m_pContext
;
212 bool m_bIgnoreSplineChangeEvents
;
213 COleDropTarget
* m_pDropTarget
;
215 float m_fSmoothingSigma
;
216 float m_fNoiseThreshold
;
217 float m_fKeyCleanupThreshold
;
220 #endif // __FacialSequenceDialog_h__