@@ -14,6 +14,9 @@ partial class DmxRecordWindow
14
14
private readonly Recorder _recorder = new ( ) ;
15
15
16
16
private Label _errorMessageLabel ;
17
+
18
+ private VisualElement _outputBinaryConfig , _outputAnimationClipConfig ;
19
+ private TextField _outputAssetDirectoryField ;
17
20
private TextField _outputFileNameField , _outputDirectoryField ;
18
21
19
22
private Label _outputFilePathLabel , _footerStatusLabel ;
@@ -68,7 +71,7 @@ private void InitializeControlPanel(VisualElement root)
68
71
playButton . Add ( stopButtonImage ) ;
69
72
playButton . clicked += ( ) =>
70
73
{
71
- if ( ! _recorder . Config . Validate ( ) ) return ;
74
+ if ( ! _recorder . RecordConfigs . Validate ( ) ) return ;
72
75
if ( _recorder . Status == RecordingStatus . None )
73
76
{
74
77
SetEnabledTextField ( false ) ;
@@ -121,27 +124,44 @@ private void InitializeControlPanel(VisualElement root)
121
124
122
125
private void InitializeRecordingConfig ( VisualElement root )
123
126
{
127
+ _outputBinaryConfig = root . Q < VisualElement > ( "binaryOutputConfig" ) ;
128
+ _outputAnimationClipConfig = root . Q < VisualElement > ( "animationClipOutputConfig" ) ;
129
+
130
+ // 出力ファイルのフォーマット選択
131
+ var outputFormatGroup = root . Q < RadioButtonGroup > ( "outputFormatGroup" ) ;
132
+ outputFormatGroup . choices = new [ ] { "Binary" , "AnimationClip" } ;
133
+ outputFormatGroup . value = ( int ) _recorder . RecordConfigs . RecordFormat ;
134
+ ChangeOutputFormat ( _recorder . RecordConfigs . RecordFormat ) ;
135
+
136
+ outputFormatGroup . RegisterValueChangedCallback ( evt =>
137
+ {
138
+ var format = ( RecodeFormat ) evt . newValue ;
139
+ ChangeOutputFormat ( format ) ;
140
+ EditorUserSettings . SetConfigValue ( EditorSettingKey ( "RecodeFormat" ) , format . ToString ( ) ) ;
141
+ UpdateErrorMessage ( ) ;
142
+ } ) ;
143
+
124
144
_outputFilePathLabel = root . Q < Label > ( "outputFileName" ) ;
125
145
_outputWarningIcon = root . Q < Image > ( "outputWarningIcon" ) ;
126
146
127
147
// 出力ファイル名の設定
128
148
_outputFileNameField = root . Q < TextField > ( "outputFileNameField" ) ;
129
- _outputFileNameField . value = _recorder . Config . FileName ;
149
+ _outputFileNameField . value = _recorder . RecordConfigs . BinaryConfig . FileName ;
130
150
_outputFileNameField . RegisterValueChangedCallback ( evt =>
131
151
{
132
152
var fileName = evt . newValue ;
133
- _recorder . Config . FileName = fileName ;
153
+ _recorder . RecordConfigs . BinaryConfig . FileName = fileName ;
134
154
UpdateOutputFilePath ( ) ;
135
155
EditorUserSettings . SetConfigValue ( EditorSettingKey ( "OutputFileName" ) , fileName ) ;
136
156
} ) ;
137
157
138
158
// 出力ディレクトリの設定
139
159
_outputDirectoryField = root . Q < TextField > ( "outputDirectoryField" ) ;
140
- _outputDirectoryField . value = _recorder . Config . Directory ;
160
+ _outputDirectoryField . value = _recorder . RecordConfigs . BinaryConfig . Directory ;
141
161
_outputDirectoryField . RegisterValueChangedCallback ( evt =>
142
162
{
143
163
var directory = evt . newValue ;
144
- _recorder . Config . Directory = directory ;
164
+ _recorder . RecordConfigs . BinaryConfig . Directory = directory ;
145
165
UpdateOutputFilePath ( ) ;
146
166
EditorUserSettings . SetConfigValue ( EditorSettingKey ( "OutputDirectory" ) , directory ) ;
147
167
} ) ;
@@ -155,17 +175,27 @@ private void InitializeRecordingConfig(VisualElement root)
155
175
{
156
176
var selectedDirectory =
157
177
EditorUtility . OpenFolderPanel ( title : "Output Folder" ,
158
- folder : _recorder . Config . Directory ,
178
+ folder : _recorder . RecordConfigs . BinaryConfig . Directory ,
159
179
defaultName : "" ) ;
160
180
161
181
if ( string . IsNullOrEmpty ( selectedDirectory ) ) return ;
162
182
163
- _recorder . Config . Directory = selectedDirectory ;
183
+ _recorder . RecordConfigs . BinaryConfig . Directory = selectedDirectory ;
164
184
_outputDirectoryField . value = selectedDirectory ;
165
185
UpdateOutputFilePath ( ) ;
166
186
EditorUserSettings . SetConfigValue ( EditorSettingKey ( "OutputDirectory" ) , selectedDirectory ) ;
167
187
} ;
168
188
189
+ // Animation Config
190
+ var outputAssetDirectoryField = root . Q < TextField > ( "outputAssetDirectoryField" ) ;
191
+ outputAssetDirectoryField . value = _recorder . RecordConfigs . AnimationClipConfig . OutputAnimationClipAssetPath ;
192
+ outputAssetDirectoryField . RegisterValueChangedCallback ( evt =>
193
+ {
194
+ var directory = evt . newValue ;
195
+ _recorder . RecordConfigs . AnimationClipConfig . OutputAnimationClipAssetPath = directory ;
196
+ EditorUserSettings . SetConfigValue ( EditorSettingKey ( "OutputAssetDirectory" ) , directory ) ;
197
+ } ) ;
198
+
169
199
170
200
var outputWarningIcon = root . Q < Image > ( "outputWarningIcon" ) ;
171
201
outputWarningIcon . image = EditorGUIUtility . IconContent ( "Warning@2x" ) . image ;
@@ -177,7 +207,7 @@ private void InitializeRecordingConfig(VisualElement root)
177
207
) ;
178
208
openOutputFolderButton . clicked += ( ) =>
179
209
{
180
- Process . Start ( _recorder . Config . Directory ) ;
210
+ Process . Start ( _recorder . RecordConfigs . BinaryConfig . Directory ) ;
181
211
} ;
182
212
183
213
_errorMessageArea = root . Q < VisualElement > ( "errorMessageArea" ) ;
@@ -192,17 +222,36 @@ private void InitializeRecordingConfig(VisualElement root)
192
222
UpdateOutputFilePath ( ) ;
193
223
}
194
224
225
+ private void ChangeOutputFormat ( RecodeFormat format )
226
+ {
227
+ _outputBinaryConfig . style . display = DisplayStyle . None ;
228
+ _outputAnimationClipConfig . style . display = DisplayStyle . None ;
229
+ switch ( format )
230
+ {
231
+ case RecodeFormat . Binary :
232
+ _outputBinaryConfig . style . display = DisplayStyle . Flex ;
233
+ break ;
234
+ case RecodeFormat . AnimationClip :
235
+ _outputAnimationClipConfig . style . display = DisplayStyle . Flex ;
236
+ break ;
237
+ default :
238
+ throw new ArgumentOutOfRangeException ( nameof ( format ) , format , null ) ;
239
+ }
240
+
241
+ _recorder . RecordConfigs . RecordFormat = format ;
242
+ }
243
+
195
244
private void UpdateOutputFilePath ( )
196
245
{
197
- var path = _recorder . Config . OutputPath ;
246
+ var path = _recorder . RecordConfigs . BinaryConfig . OutputPath ;
198
247
_outputFilePathLabel . text = path ;
199
248
_outputWarningIcon . style . display = System . IO . File . Exists ( path ) ? DisplayStyle . Flex : DisplayStyle . None ;
200
249
UpdateErrorMessage ( ) ;
201
250
}
202
251
203
252
private void UpdateErrorMessage ( )
204
253
{
205
- var errors = _recorder . Config . ValidateErrors ( ) ;
254
+ var errors = _recorder . RecordConfigs . ValidateErrors ( ) ;
206
255
if ( errors . Count > 0 )
207
256
{
208
257
_errorMessageLabel . text = string . Join ( "\n " , errors ) ;
0 commit comments