Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
w3ddlg.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/* $Header: /Commando/Code/Tools/max2w3d/w3ddlg.cpp 24 11/07/00 5:40p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/w3ddlg.cpp $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 11/07/00 4:39p $*
31 * *
32 * $Revision:: 24 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38#include "w3ddlg.h"
39#include "resource.h"
40#include "dllmain.h"
41#include "w3dexp.h"
42#include "util.h"
43#include "rawfile.h"
44#include <string>
45#include "units.h"
47
48
49#define ENABLE_MESH_OPTIMIZING 0
50
51/*
52** Static functions
53*/
54static BOOL CALLBACK _options_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam,LPARAM lParam);
55static void _init_ofn(void);
56
57/*
58** Static data
59*/
60static bool _OfnInited = false;
61static OPENFILENAME _HierarchyFileOFN;
62
63
64/***********************************************************************************************
65 * W3dOptionsDialogClass::W3dOptionsDialogClass -- constructor for the options dialog object *
66 * *
67 * INPUT: *
68 * *
69 * OUTPUT: *
70 * *
71 * WARNINGS: *
72 * *
73 * HISTORY: *
74 * 07/24/1997 GH : Created. *
75 *=============================================================================================*/
76W3dOptionsDialogClass::W3dOptionsDialogClass(Interface * maxinterface,ExpInterface * exportinterface)
77{
78 MaxInterface = maxinterface;
79 ExportInterface = exportinterface;
80 if (!_OfnInited) _init_ofn();
81 GotHierarchyFilename = false;
82
83 RangeLowSpin = NULL;
84 RangeHighSpin = NULL;
85
86 GetMasterUnitInfo(&UnitsType, &UnitsScale);
87}
88
90{
91 ReleaseISpinner(RangeLowSpin);
92 ReleaseISpinner(RangeHighSpin);
93}
94
96{
97 Options = options;
98
99 // Put up the options dialog box.
100 /*BOOL result = DialogBoxParam
101 (
102 AppInstance,
103 MAKEINTRESOURCE (IDD_W3D_EXPORT_OPTIONS),
104 MaxInterface->GetMAXHWnd(),
105 (DLGPROC) _options_dialog_proc,
106 (LPARAM) this
107 );*/
108
109 PresetExportOptionsDialogClass dialog (MaxInterface, MaxInterface->GetMAXHWnd ());
110
111 dialog.Set_Options (Options);
112 int result = dialog.Do_Modal ();
113
114 if (result == IDOK) {
115 return true;
116 } else {
117 return false;
118 }
119}
120
121
122/***********************************************************************************************
123 * W3dOptionsDialogClass::Dialog_Proc -- Handles the windows message for the options dialog *
124 * *
125 * INPUT: *
126 * *
127 * OUTPUT: *
128 * *
129 * WARNINGS: *
130 * *
131 * HISTORY: *
132 * 07/24/1997 GH : Created. *
133 *=============================================================================================*/
135(
136 HWND hwnd,
137 UINT message,
138 WPARAM wParam,
139 LPARAM
140)
141{
142 int code = HIWORD(wParam);
143
144 switch (message ) {
145
146 /*******************************************************************
147 * WM_INITDIALOG
148 *
149 * Initialize all of the custom controls for the dialog box
150 *
151 *******************************************************************/
152 case WM_INITDIALOG:
153
154 Dialog_Init();
155 return 1;
156
157
158 /*******************************************************************
159 * WM_COMMAND
160 *
161 *
162 *******************************************************************/
163 case WM_COMMAND:
164
165 switch (LOWORD(wParam))
166 {
167 case IDOK:
168
169 if (Dialog_Ok() == FALSE) {
170 MessageBox(Hwnd,"You have not supplied a Base Pose hierarchy file!","Error",MB_OK);
171 return 1;
172 }
173
174 SetCursor(LoadCursor (NULL, IDC_WAIT));
175 EndDialog(Hwnd, 1);
176 break;
177
178 case IDCANCEL:
179 EndDialog(Hwnd, 0);
180 break;
181
185 WHT_Export_Radio_Changed();
186 break;
187
190 WHA_Export_Radio_Changed();
191 break;
192
195 WTM_Export_Radio_Changed();
196 break;
197
199 WHA_Compress_Animation_Check_Changed();
200 break;
201
203 WHA_Reduce_Animation_Check_Changed();
204 break;
205
207 WHA_Compression_Flavor_Changed();
208 break;
209
211
212 // use the open file common dialog to get a hierarchy filename.
213 _HierarchyFileOFN.hwndOwner = Hwnd;
214 _HierarchyFileOFN.lpstrFileTitle = NULL;
215 _HierarchyFileOFN.lpstrFile = Options->HierarchyFilename;
216
217 if (GetOpenFileName(&_HierarchyFileOFN)) {
218
219 // Get the relative path between the current export path
220 // and the full file path to the hierarchy file:
221 Create_Relative_Path(Options->RelativeHierarchyFilename,
223 _HierarchyFileOFN.lpstrFile);
224
225 // set window text to the relative path.
226 HWND butHwnd = GetDlgItem(hwnd,IDC_WHT_BROWSE_BUTTON);
227 if (Options->RelativeHierarchyFilename[0] != 0) {
228 SetWindowText(butHwnd, Options->RelativeHierarchyFilename);
229 } else {
230 SetWindowText(butHwnd, Options->HierarchyFilename);
231 }
232 GotHierarchyFilename = true;
233
234 SetSaveRequiredFlag(true);
235 }
236
237 _HierarchyFileOFN.lpstrFile = NULL;
238 break;
239 }
240 return 1;
241
242 /*******************************************************************
243 * CC_SPINNER_CHANGE
244 *
245 * Max custom spinner controls
246 *
247 *******************************************************************/
248 case CC_SPINNER_CHANGE:
249
250 switch (LOWORD(wParam))
251 {
253 if (RangeLowSpin->GetIVal() > RangeHighSpin->GetIVal())
254 {
255 RangeHighSpin->SetValue (RangeLowSpin->GetIVal(),FALSE);
256 }
257 break;
258
260 if (RangeHighSpin->GetIVal() < RangeLowSpin->GetIVal())
261 {
262 RangeLowSpin->SetValue(RangeHighSpin->GetIVal(),FALSE);
263 }
264 break;
265
266 }
267
268 }
269 return 0;
270}
271
272void W3dOptionsDialogClass::Dialog_Init()
273{
274 CenterWindow(Hwnd, GetParent(Hwnd));
275 SetCursor(LoadCursor (NULL, IDC_ARROW));
276
277 // initialize the export radio buttons
278 if (Options->ExportHierarchy) {
279 CheckDlgButton(Hwnd,IDC_WHT_EXPORT_RADIO,BST_CHECKED);
280 Enable_WHT_Export();
281 } else {
282 if (Options->LoadHierarchy) {
283 CheckDlgButton(Hwnd,IDC_WHT_LOAD_RADIO,BST_CHECKED);
284 Enable_WHT_Load();
285
286 // If the relative path is a full path, just erase both paths
287 // This case happens with files which were exported using a previous,
288 // bugged version of the exporter which did not handle files on
289 // different drives correctly.
290 if (Is_Full_Path(Options->RelativeHierarchyFilename)) {
291 Options->RelativeHierarchyFilename[0] = 0;
292 Options->HierarchyFilename[0] = 0;
293 }
294
295 // Honor the relative path if it is present
296 if (Options->RelativeHierarchyFilename[0] != 0)
297 {
298
299 HWND butHwnd = GetDlgItem(Hwnd,IDC_WHT_BROWSE_BUTTON);
300 SetWindowText(butHwnd, Options->RelativeHierarchyFilename);
301 Create_Full_Path(Options->HierarchyFilename,
303 Options->RelativeHierarchyFilename);
304 GotHierarchyFilename = true;
305
306 } else if (Options->HierarchyFilename[0] != 0) {
307
308 HWND butHwnd = GetDlgItem(Hwnd,IDC_WHT_BROWSE_BUTTON);
309 SetWindowText(butHwnd, Options->HierarchyFilename);
310 GotHierarchyFilename = true;
311
312 }
313
314 } else {
315 CheckDlgButton(Hwnd,IDC_WHT_NO_EXPORT_RADIO,BST_CHECKED);
316 Disable_WHT_Export();
317 }
318 }
319
320 if (Options->ExportGeometry) {
321 CheckDlgButton(Hwnd,IDC_WTM_EXPORT_RADIO,BST_CHECKED);
322 Enable_WTM_Export();
323 } else {
324 CheckDlgButton(Hwnd,IDC_WTM_NO_EXPORT_RADIO,BST_CHECKED);
325 Disable_WTM_Export();
326 }
327
328 if (Options->SmoothBetweenMeshes && Options->ExportGeometry) {
329 CheckDlgButton(Hwnd,IDC_EXPORT_MESH_SMOOTH_CHECK,BST_CHECKED);
330 } else {
331 CheckDlgButton(Hwnd,IDC_EXPORT_MESH_SMOOTH_CHECK,BST_UNCHECKED);
332 }
333
334 SetCheckBox(Hwnd, IDC_TRANSLATION_ONLY_CHECK, Options->TranslationOnly);
335 SetCheckBox(Hwnd, IDC_TERRAIN_MODE_CHECK, Options->EnableTerrainMode);
336
337 // Initialize additional Animation Options
338
339 SetCheckBox(Hwnd, IDC_COMPRESS_ANIMATION_CHECK, Options->CompressAnimation);
340 SetCheckBox(Hwnd, IDC_REDUCE_ANIMATION_CHECK , Options->ReduceAnimation);
341 SetCheckBox(Hwnd, IDC_VIEWLOG_CHECK, Options->ReviewLog);
342
343 char string[128]; // temp string buffer
344
345 sprintf(string, "Current FPS: %d", GetFrameRate());
346
347 SetDlgItemText(Hwnd, IDC_ANIMATION_FPS_STATIC, string);
348
349
350 // initialize animation combo/list boxes
351
352 HwndReduce = GetDlgItem(Hwnd, IDC_REDUCE_ANIMATION_COMBO);
353 HwndFlavor = GetDlgItem(Hwnd, IDC_COMPRESS_ANIMATION_FLAVOR_COMBO);
354
355 ComboBox_ResetContent(HwndReduce);
356 ComboBox_ResetContent(HwndFlavor);
357
358 for (int i=1; i<100; i++) {
359 sprintf(string, "%d", i);
360 ComboBox_AddString(HwndReduce, string);
361 }
362
363 ComboBox_AddString(HwndFlavor, "TimeCoded");
364 ComboBox_AddString(HwndFlavor, "Adaptive Delta");
365
366
367 if ((Options->ReduceAnimationPercent < 1) || (Options->ReduceAnimationPercent > 99)) {
368 Options->ReduceAnimationPercent = 50;
369
370 }
371
372 if ((Options->CompressAnimationFlavor < 0) || (Options->CompressAnimationFlavor >= ANIM_FLAVOR_VALID)) {
373 Options->CompressAnimationFlavor = 0;
374 }
375
376 ComboBox_SetCurSel(HwndReduce, Options->ReduceAnimationPercent-1);
377 ComboBox_SetCurSel(HwndFlavor, Options->CompressAnimationFlavor);
378
379
380 HwndTError = GetDlgItem(Hwnd, IDC_MAX_TRANS_ERROR_EDIT);
381 HwndRError = GetDlgItem(Hwnd, IDC_MAX_ROT_ERROR_EDIT);
382
383 sprintf(string, "%f", Options->CompressAnimationTranslationError);
384 Edit_SetText(HwndTError, string);
385
386 sprintf(string, "%f", Options->CompressAnimationRotationError);
387 Edit_SetText(HwndRError, string);
388
389
390 // Make sure everything under animations is properly active/inactive
391
392 WHA_Compress_Animation_Check_Changed();
393
394 if (Options->ExportAnimation) {
395 CheckDlgButton(Hwnd,IDC_WHA_EXPORT_RADIO,BST_CHECKED);
396 Enable_WHA_Export();
397 } else {
398 CheckDlgButton(Hwnd,IDC_WHA_NO_EXPORT_RADIO,BST_CHECKED);
399 Disable_WHA_Export();
400 }
401
402
403 // initialize the frame-range spinners
404 int ticksperframe = GetTicksPerFrame();
405 int startframe = MaxInterface->GetAnimRange().Start() / ticksperframe;
406 int endframe = MaxInterface->GetAnimRange().End() / ticksperframe;
407
408 RangeLowSpin = SetupIntSpinner
409 (
410 Hwnd,
413 startframe,
414 endframe,
415 Options->StartFrame
416 );
417
418 RangeHighSpin = SetupIntSpinner
419 (
420 Hwnd,
423 startframe,
424 endframe,
425 Options->EndFrame
426 );
427
428 // initialize the 'DisableExportAABTrees' option
429 CheckDlgButton(Hwnd,IDC_EXPORT_MESH_AABTREES,!Options->DisableExportAABTrees);
430
431 CheckDlgButton(Hwnd,IDC_EXPORT_MESH_MAT_TO_TEXTURE,Options->EnableMaterialColorToTextureConversion);
432
433#if ENABLE_MESH_OPTIMIZING
434 CheckDlgButton(Hwnd,IDC_EXPORT_MESH_OPTIMIZE,Options->EnableOptimizeMeshData);
435#endif
436}
437
438BOOL W3dOptionsDialogClass::Dialog_Ok()
439{
440 bool changed = false;
441
442 // export options:
443 bool export_h = (IsDlgButtonChecked(Hwnd,IDC_WHT_EXPORT_RADIO) == BST_CHECKED);
444 changed = changed || (Options->ExportHierarchy != export_h);
445 Options->ExportHierarchy = export_h;
446
447 bool load_h = (IsDlgButtonChecked(Hwnd,IDC_WHT_LOAD_RADIO) == BST_CHECKED);
448 changed = changed || (Options->LoadHierarchy != load_h);
449 Options->LoadHierarchy = load_h;
450
451 bool export_a = (IsDlgButtonChecked(Hwnd,IDC_WHA_EXPORT_RADIO) == BST_CHECKED);
452 changed = changed || (Options->ExportAnimation != export_a);
453 Options->ExportAnimation = export_a;
454
455 bool export_g = (IsDlgButtonChecked(Hwnd,IDC_WTM_EXPORT_RADIO) == BST_CHECKED);
456 changed = changed || (Options->ExportGeometry != export_g);
457 Options->ExportGeometry = export_g;
458
459 if (export_g) {
460 bool smooth_meshes = (IsDlgButtonChecked(Hwnd,IDC_EXPORT_MESH_SMOOTH_CHECK) == BST_CHECKED);
461 changed = changed || (Options->SmoothBetweenMeshes != smooth_meshes);
462 Options->SmoothBetweenMeshes = smooth_meshes;
463
464 bool disable_export_aabs = (IsDlgButtonChecked(Hwnd,IDC_EXPORT_MESH_AABTREES) != BST_CHECKED);
465 changed = changed || (Options->DisableExportAABTrees != disable_export_aabs);
466 Options->DisableExportAABTrees = disable_export_aabs;
467
468 bool convert_materials = (IsDlgButtonChecked(Hwnd,IDC_EXPORT_MESH_MAT_TO_TEXTURE) == BST_CHECKED);
469 changed = changed || (Options->EnableMaterialColorToTextureConversion != convert_materials);
470 Options->EnableMaterialColorToTextureConversion = convert_materials;
471
472#if ENABLE_MESH_OPTIMIZING
473 bool optimize_mesh_data = (IsDlgButtonChecked(Hwnd,IDC_EXPORT_MESH_OPTIMIZE) == BST_CHECKED);
474 changed = changed || (Options->EnableOptimizeMeshData != optimize_mesh_data);
475 Options->EnableOptimizeMeshData = optimize_mesh_data;
476#else
477 Options->EnableOptimizeMeshData = false;
478#endif
479
480 } else {
481 Options->SmoothBetweenMeshes = false;
482 Options->DisableExportAABTrees = false;
483 Options->EnableOptimizeMeshData = false;
484 Options->EnableMaterialColorToTextureConversion = false;
485 }
486
487 // Hierarchy Options:
488 bool xlation_only = (IsDlgButtonChecked(Hwnd,IDC_TRANSLATION_ONLY_CHECK) == BST_CHECKED);
489 changed = changed || (Options->TranslationOnly != xlation_only);
490 Options->TranslationOnly = xlation_only;
491
492 bool terrain_mode = (IsDlgButtonChecked(Hwnd,IDC_TERRAIN_MODE_CHECK) == BST_CHECKED);
493 changed = changed || (Options->EnableTerrainMode != terrain_mode);
494 Options->EnableTerrainMode = terrain_mode;
495
496 if (Options->LoadHierarchy && (Options->ExportAnimation || Options->ExportGeometry)) {
497 if (!GotHierarchyFilename) {
498 MessageBox(Hwnd,"You have not supplied a Base Pose hierarchy file!","Error",MB_OK);
499 if (changed) SetSaveRequiredFlag(true);
500 return FALSE;
501 }
502
503 RawFileClass file(Options->HierarchyFilename);
504 if (!file.Open()) {
505 char buf[100+_MAX_FNAME+_MAX_EXT];
506 sprintf(buf,"Unable to load hierarchy file: %s\nIf this Max file has been moved, please re-select the hierarchy file.",Options->HierarchyFilename);
507 MessageBox(Hwnd,buf,"Error",MB_OK);
508 return FALSE;
509 }
510 file.Close();
511 }
512
513 // Animation options:
514 int start_frame = RangeLowSpin->GetIVal();
515 changed = changed || (Options->StartFrame != start_frame);
516 Options->StartFrame = start_frame;
517
518 int end_frame = RangeHighSpin->GetIVal();
519 changed = changed || (Options->EndFrame != end_frame);
520 Options->EndFrame = end_frame;
521
522 bool compress_animation = (IsDlgButtonChecked(Hwnd, IDC_COMPRESS_ANIMATION_CHECK) == BST_CHECKED);
523 changed = changed || (Options->CompressAnimation != compress_animation);
524 Options->CompressAnimation = compress_animation;
525
526 bool reduce_animation = (IsDlgButtonChecked(Hwnd, IDC_REDUCE_ANIMATION_CHECK) == BST_CHECKED);
527 changed = changed || (Options->ReduceAnimation != reduce_animation);
528 Options->ReduceAnimation = reduce_animation;
529
530 int reduce_percent = ComboBox_GetCurSel(HwndReduce) + 1;
531 changed = changed || (Options->ReduceAnimationPercent != reduce_percent);
532 Options->ReduceAnimationPercent = reduce_percent;
533
534 int flavor = ComboBox_GetCurSel(HwndFlavor);
535 changed = changed || (Options->CompressAnimationFlavor != flavor);
536 Options->CompressAnimationFlavor = flavor;
537
538 char string[128];
539 Edit_GetText(HwndTError, string, 128);
540 float trans_error = atof(string);
541 changed = changed || (Options->CompressAnimationTranslationError != trans_error);
542 Options->CompressAnimationTranslationError = trans_error;
543
544 Edit_GetText(HwndRError, string, 128);
545 float rot_error = atof(string);
546 changed = changed || (Options->CompressAnimationRotationError != rot_error);
547 Options->CompressAnimationRotationError = rot_error;
548
549 bool review_log = (IsDlgButtonChecked(Hwnd, IDC_VIEWLOG_CHECK) == BST_CHECKED);
550 changed = changed || (Options->ReviewLog != review_log);
551 Options->ReviewLog = review_log;
552
553 // Geometry options:
554 //Options->UseVoxelizer = (IsDlgButtonChecked(Hwnd,IDC_VOXELIZER_CHECK) == BST_CHECKED);
555 Options->UseVoxelizer = false;
556
557 if (changed) SetSaveRequiredFlag(true);
558 return TRUE;
559}
560
561void W3dOptionsDialogClass::Enable_WHT_Export(void)
562{
563 EnableWindow(GetDlgItem(Hwnd,IDC_TRANSLATION_ONLY_CHECK),TRUE);
564 EnableWindow(GetDlgItem(Hwnd,IDC_TERRAIN_MODE_CHECK),TRUE);
565 EnableWindow(GetDlgItem(Hwnd,IDC_WHT_BROWSE_BUTTON),FALSE);
566 EnableWindow(GetDlgItem(Hwnd,IDC_WHA_EXPORT_RADIO),TRUE);
567}
568
569void W3dOptionsDialogClass::Enable_WHT_Load(void)
570{
571 EnableWindow(GetDlgItem(Hwnd,IDC_TRANSLATION_ONLY_CHECK),FALSE);
572 EnableWindow(GetDlgItem(Hwnd,IDC_TERRAIN_MODE_CHECK),FALSE);
573 EnableWindow(GetDlgItem(Hwnd,IDC_WHT_BROWSE_BUTTON),TRUE);
574 EnableWindow(GetDlgItem(Hwnd,IDC_WHA_EXPORT_RADIO),TRUE);
575}
576
577void W3dOptionsDialogClass::Disable_WHT_Export(void)
578{
579 // since there will be no hierarchy tree, disable animation
580 CheckDlgButton(Hwnd,IDC_WHA_EXPORT_RADIO,BST_UNCHECKED);
581 CheckDlgButton(Hwnd,IDC_WHA_NO_EXPORT_RADIO,BST_CHECKED);
582 Disable_WHA_Export();
583
584 EnableWindow(GetDlgItem(Hwnd,IDC_TRANSLATION_ONLY_CHECK),FALSE);
585 EnableWindow(GetDlgItem(Hwnd,IDC_TERRAIN_MODE_CHECK),FALSE);
586 EnableWindow(GetDlgItem(Hwnd,IDC_WHT_BROWSE_BUTTON),FALSE);
587 EnableWindow(GetDlgItem(Hwnd,IDC_WHA_EXPORT_RADIO),FALSE);
588}
589
590void W3dOptionsDialogClass::Enable_WHA_Export(void)
591{
592 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_LOW_EDIT),TRUE);
593 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_LOW_SPIN),TRUE);
594 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_HIGH_EDIT),TRUE);
595 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_HIGH_SPIN),TRUE);
596 EnableWindow(GetDlgItem(Hwnd,IDC_VIEWLOG_CHECK), TRUE);
597
598 EnableWindow(GetDlgItem(Hwnd,IDC_COMPRESS_ANIMATION_CHECK),TRUE);
599 if (IsDlgButtonChecked(Hwnd, IDC_COMPRESS_ANIMATION_CHECK) == BST_CHECKED) {
600 Enable_CompressAnimationOptions_Export();
601
602 }
603}
604
605void W3dOptionsDialogClass::Disable_WHA_Export(void)
606{
607 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_LOW_EDIT),FALSE);
608 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_LOW_SPIN),FALSE);
609 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_HIGH_EDIT),FALSE);
610 EnableWindow(GetDlgItem(Hwnd,IDC_RANGE_HIGH_SPIN),FALSE);
611 EnableWindow(GetDlgItem(Hwnd,IDC_VIEWLOG_CHECK), FALSE);
612
613 EnableWindow(GetDlgItem(Hwnd,IDC_COMPRESS_ANIMATION_CHECK),FALSE);
614 Disable_CompressAnimationOptions_Export();
615}
616
617void W3dOptionsDialogClass::Enable_ReduceAnimationOptions_Export(void)
618{
619 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_COMBO), TRUE);
620}
621
622void W3dOptionsDialogClass::Disable_ReduceAnimationOptions_Export(void)
623{
624 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_COMBO), FALSE);
625}
626
627void W3dOptionsDialogClass::Enable_CompressAnimationOptions_Export(void)
628{
629 EnableWindow(GetDlgItem(Hwnd,IDC_COMPRESS_ANIMATION_FLAVOR_COMBO), TRUE);
630 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_TRANS_ERROR_EDIT), TRUE);
631 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_ROT_ERROR_EDIT), TRUE);
632 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_CHECK), TRUE);
633 WHA_Reduce_Animation_Check_Changed();
634 WHA_Compression_Flavor_Changed();
635}
636
637void W3dOptionsDialogClass::Disable_CompressAnimationOptions_Export(void)
638{
639 EnableWindow(GetDlgItem(Hwnd,IDC_COMPRESS_ANIMATION_FLAVOR_COMBO), FALSE);
640 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_TRANS_ERROR_EDIT), FALSE);
641 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_ROT_ERROR_EDIT), FALSE);
642 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_CHECK), FALSE);
643 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_COMBO), FALSE);
644}
645
646void W3dOptionsDialogClass::Enable_WTM_Export(void)
647{
648 ::EnableWindow(::GetDlgItem(Hwnd,IDC_EXPORT_MESH_SMOOTH_CHECK),TRUE);
649 ::EnableWindow(::GetDlgItem(Hwnd,IDC_EXPORT_MESH_AABTREES),TRUE);
650#if ENABLE_MESH_OPTIMIZING
651 ::EnableWindow(::GetDlgItem(Hwnd,IDC_EXPORT_MESH_OPTIMIZE),TRUE);
652#endif
653}
654
655void W3dOptionsDialogClass::Disable_WTM_Export(void)
656{
657 ::EnableWindow(::GetDlgItem(Hwnd,IDC_EXPORT_MESH_SMOOTH_CHECK),FALSE);
658 ::EnableWindow(::GetDlgItem(Hwnd,IDC_EXPORT_MESH_AABTREES),FALSE);
659#if ENABLE_MESH_OPTIMIZING
660 ::EnableWindow(::GetDlgItem(Hwnd,IDC_EXPORT_MESH_OPTIMIZE),FALSE);
661#endif
662}
663
664void W3dOptionsDialogClass::WHT_Export_Radio_Changed(void)
665{
666 if (IsDlgButtonChecked(Hwnd, IDC_WHT_EXPORT_RADIO) == BST_CHECKED) {
667 Enable_WHT_Export();
668 } else if (IsDlgButtonChecked(Hwnd,IDC_WHT_LOAD_RADIO) == BST_CHECKED) {
669 Enable_WHT_Load();
670 } else if (IsDlgButtonChecked(Hwnd,IDC_WHT_NO_EXPORT_RADIO) == BST_CHECKED) {
671 Disable_WHT_Export();
672 }
673}
674
675void W3dOptionsDialogClass::WHA_Export_Radio_Changed(void)
676{
677 if (IsDlgButtonChecked(Hwnd, IDC_WHA_EXPORT_RADIO) == BST_CHECKED) {
678 Enable_WHA_Export();
679 } else if (IsDlgButtonChecked(Hwnd,IDC_WHA_NO_EXPORT_RADIO) == BST_CHECKED) {
680 Disable_WHA_Export();
681 }
682}
683
684void W3dOptionsDialogClass::WTM_Export_Radio_Changed(void)
685{
686 if (IsDlgButtonChecked(Hwnd, IDC_WTM_EXPORT_RADIO) == BST_CHECKED) {
687 Enable_WTM_Export();
688 } else if (IsDlgButtonChecked(Hwnd,IDC_WTM_NO_EXPORT_RADIO) == BST_CHECKED) {
689 Disable_WTM_Export();
690 }
691}
692
693
694void W3dOptionsDialogClass::WHA_Compress_Animation_Check_Changed(void)
695{
696 if (IsDlgButtonChecked(Hwnd, IDC_COMPRESS_ANIMATION_CHECK) == BST_CHECKED) {
697 Enable_CompressAnimationOptions_Export();
698 } else {
699 Disable_CompressAnimationOptions_Export();
700 }
701}
702
703void W3dOptionsDialogClass::WHA_Reduce_Animation_Check_Changed(void)
704{
705 if (IsDlgButtonChecked(Hwnd, IDC_REDUCE_ANIMATION_CHECK) == BST_CHECKED) {
706 Enable_ReduceAnimationOptions_Export();
707 } else {
708 Disable_ReduceAnimationOptions_Export();
709 }
710}
711
712void W3dOptionsDialogClass::WHA_Compression_Flavor_Changed()
713{
714 int flavor = ComboBox_GetCurSel(HwndFlavor);
715
716 switch (flavor) {
717
718
720 WHA_Reduce_Animation_Check_Changed();
721 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_CHECK), TRUE);
722 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_TRANS_ERROR_EDIT), TRUE);
723 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_ROT_ERROR_EDIT), TRUE);
724
725 break;
726 }
727
729 // Disable Reduce animation controls
730 Disable_ReduceAnimationOptions_Export();
731 EnableWindow(GetDlgItem(Hwnd,IDC_REDUCE_ANIMATION_CHECK), FALSE);
732 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_TRANS_ERROR_EDIT), FALSE);
733 EnableWindow(GetDlgItem(Hwnd,IDC_MAX_ROT_ERROR_EDIT), FALSE);
734
735 break;
736 }
737
738
739 default:
740 assert(0); // invalid compressed flavor setting
741 break;
742
743 }
744
745}
746
747
748
749/***********************************************************************************************
750 * _options_dialog_proc -- thunks into the Options dialog class's windows message handler *
751 * *
752 * INPUT: *
753 * *
754 * OUTPUT: *
755 * *
756 * WARNINGS: *
757 * *
758 * HISTORY: *
759 * 07/24/1997 GH : Created. *
760 *=============================================================================================*/
761BOOL CALLBACK _options_dialog_proc
762(
763 HWND hwnd,
764 UINT message,
765 WPARAM wParam,
766 LPARAM lParam
767)
768{
769 static W3dOptionsDialogClass * optdialog = NULL;
770
771 if (message == WM_INITDIALOG) {
772 optdialog = (W3dOptionsDialogClass *) lParam;
773 optdialog->Hwnd = hwnd;
774 }
775
776 if (optdialog) {
777 return optdialog->Dialog_Proc(hwnd, message, wParam, lParam);
778 } else {
779 return FALSE;
780 }
781}
782
783
784/***********************************************************************************************
785 * _init_ofn -- initialize the OpenFilename struct. *
786 * *
787 * INPUT: *
788 * *
789 * OUTPUT: *
790 * *
791 * WARNINGS: *
792 * *
793 * HISTORY: *
794 * 07/24/1997 GH : Created. *
795 *=============================================================================================*/
796void _init_ofn(void)
797{
798 static char _szhierarchyfilter[] = "W3D Files (*.W3D)\0*.W3D\0WHT Files (*.WHT)\0*.WHT\0\0";
799
800 _HierarchyFileOFN.lStructSize = sizeof(OPENFILENAME);
801 _HierarchyFileOFN.hwndOwner = NULL;
802 _HierarchyFileOFN.hInstance = NULL;
803 _HierarchyFileOFN.lpstrFilter = _szhierarchyfilter;
804 _HierarchyFileOFN.lpstrCustomFilter = NULL;
805 _HierarchyFileOFN.nMaxCustFilter = 0;
806 _HierarchyFileOFN.nFilterIndex = 0;
807 _HierarchyFileOFN.lpstrFile = NULL;
808 _HierarchyFileOFN.nMaxFile = _MAX_PATH;
809 _HierarchyFileOFN.lpstrFileTitle = NULL;
810 _HierarchyFileOFN.nMaxFileTitle = _MAX_FNAME + _MAX_EXT;
811 _HierarchyFileOFN.lpstrInitialDir = NULL;
812 _HierarchyFileOFN.lpstrTitle = NULL;
813 _HierarchyFileOFN.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT;
814 _HierarchyFileOFN.nFileOffset = 0;
815 _HierarchyFileOFN.nFileExtension = 0;
816 _HierarchyFileOFN.lpstrDefExt = "wht";
817 _HierarchyFileOFN.lCustData = 0L;
818 _HierarchyFileOFN.lpfnHook = NULL;
819 _HierarchyFileOFN.lpTemplateName = NULL;
820
821 _OfnInited = true;
822}
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
@ ANIM_FLAVOR_VALID
Definition w3d_file.h:1440
@ ANIM_FLAVOR_TIMECODED
Definition w3d_file.h:1437
@ ANIM_FLAVOR_ADAPTIVE_DELTA
Definition w3d_file.h:1438
unsigned int UINT
Definition bittype.h:63
#define IDC_REDUCE_ANIMATION_COMBO
Definition resource.h:357
#define IDC_MAX_ROT_ERROR_EDIT
Definition resource.h:361
#define IDC_RANGE_HIGH_EDIT
Definition resource.h:151
#define IDC_MAX_TRANS_ERROR_EDIT
Definition resource.h:360
#define IDC_COMPRESS_ANIMATION_CHECK
Definition resource.h:353
#define IDC_WHT_NO_EXPORT_RADIO
Definition resource.h:145
#define IDC_RANGE_HIGH_SPIN
Definition resource.h:203
#define IDC_WTM_EXPORT_RADIO
Definition resource.h:140
#define IDC_COMPRESS_ANIMATION_FLAVOR_COMBO
Definition resource.h:359
#define IDC_EXPORT_MESH_SMOOTH_CHECK
Definition resource.h:317
#define IDC_EXPORT_MESH_AABTREES
Definition resource.h:319
#define IDC_WTM_NO_EXPORT_RADIO
Definition resource.h:142
#define IDC_RANGE_LOW_EDIT
Definition resource.h:149
#define IDC_REDUCE_ANIMATION_CHECK
Definition resource.h:356
#define IDC_WHT_EXPORT_RADIO
Definition resource.h:130
#define IDC_ANIMATION_FPS_STATIC
Definition resource.h:358
#define IDC_WHA_EXPORT_RADIO
Definition resource.h:134
#define IDC_TERRAIN_MODE_CHECK
Definition resource.h:115
#define IDC_WHA_NO_EXPORT_RADIO
Definition resource.h:138
#define IDC_EXPORT_MESH_MAT_TO_TEXTURE
Definition resource.h:321
#define IDC_VIEWLOG_CHECK
Definition resource.h:364
#define IDC_RANGE_LOW_SPIN
Definition resource.h:200
#define IDC_WHT_BROWSE_BUTTON
Definition resource.h:136
#define IDC_EXPORT_MESH_OPTIMIZE
Definition resource.h:323
#define IDC_TRANSLATION_ONLY_CHECK
Definition resource.h:114
#define IDC_WHT_LOAD_RADIO
Definition resource.h:132
#define BOOL
Definition Wnd_File.h:57
BOOL Options(Command_Line_Arguments *Orgs)
Definition autorun.cpp:4624
void Set_Options(W3dExportOptionsStruct *options)
static char CurrentExportPath[_MAX_DRIVE+_MAX_DIR+1]
Definition w3dexp.h:81
W3dOptionsDialogClass(Interface *maxinterface, ExpInterface *exportinterface)
Definition w3ddlg.cpp:76
bool Dialog_Proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM)
Definition w3ddlg.cpp:135
bool Get_Export_Options(W3dExportOptionsStruct *options)
Definition w3ddlg.cpp:95
void Create_Relative_Path(char *rel_path, const char *curr, const char *full_path)
Definition util.cpp:285
bool Is_Full_Path(char *path)
Definition util.cpp:410
void Create_Full_Path(char *full_path, const char *curr, const char *rel_path)
Definition util.cpp:251