49#define ENABLE_MESH_OPTIMIZING 0
54static BOOL CALLBACK _options_dialog_proc(HWND Hwnd,
UINT message,WPARAM wParam,LPARAM lParam);
55static void _init_ofn(
void);
60static bool _OfnInited =
false;
61static OPENFILENAME _HierarchyFileOFN;
78 MaxInterface = maxinterface;
79 ExportInterface = exportinterface;
80 if (!_OfnInited) _init_ofn();
81 GotHierarchyFilename =
false;
86 GetMasterUnitInfo(&UnitsType, &UnitsScale);
91 ReleaseISpinner(RangeLowSpin);
92 ReleaseISpinner(RangeHighSpin);
114 if (result == IDOK) {
142 int code = HIWORD(wParam);
165 switch (LOWORD(wParam))
169 if (Dialog_Ok() ==
FALSE) {
170 MessageBox(
Hwnd,
"You have not supplied a Base Pose hierarchy file!",
"Error",MB_OK);
174 SetCursor(LoadCursor (
NULL, IDC_WAIT));
185 WHT_Export_Radio_Changed();
190 WHA_Export_Radio_Changed();
195 WTM_Export_Radio_Changed();
199 WHA_Compress_Animation_Check_Changed();
203 WHA_Reduce_Animation_Check_Changed();
207 WHA_Compression_Flavor_Changed();
213 _HierarchyFileOFN.hwndOwner =
Hwnd;
214 _HierarchyFileOFN.lpstrFileTitle =
NULL;
215 _HierarchyFileOFN.lpstrFile = Options->HierarchyFilename;
217 if (GetOpenFileName(&_HierarchyFileOFN)) {
223 _HierarchyFileOFN.lpstrFile);
227 if (Options->RelativeHierarchyFilename[0] != 0) {
228 SetWindowText(butHwnd, Options->RelativeHierarchyFilename);
230 SetWindowText(butHwnd, Options->HierarchyFilename);
232 GotHierarchyFilename =
true;
234 SetSaveRequiredFlag(
true);
237 _HierarchyFileOFN.lpstrFile =
NULL;
248 case CC_SPINNER_CHANGE:
250 switch (LOWORD(wParam))
253 if (RangeLowSpin->GetIVal() > RangeHighSpin->GetIVal())
255 RangeHighSpin->SetValue (RangeLowSpin->GetIVal(),
FALSE);
260 if (RangeHighSpin->GetIVal() < RangeLowSpin->GetIVal())
262 RangeLowSpin->SetValue(RangeHighSpin->GetIVal(),
FALSE);
272void W3dOptionsDialogClass::Dialog_Init()
274 CenterWindow(
Hwnd, GetParent(
Hwnd));
275 SetCursor(LoadCursor (
NULL, IDC_ARROW));
278 if (
Options->ExportHierarchy) {
282 if (Options->LoadHierarchy) {
291 Options->RelativeHierarchyFilename[0] = 0;
292 Options->HierarchyFilename[0] = 0;
296 if (Options->RelativeHierarchyFilename[0] != 0)
300 SetWindowText(butHwnd, Options->RelativeHierarchyFilename);
303 Options->RelativeHierarchyFilename);
304 GotHierarchyFilename =
true;
306 }
else if (Options->HierarchyFilename[0] != 0) {
309 SetWindowText(butHwnd, Options->HierarchyFilename);
310 GotHierarchyFilename =
true;
316 Disable_WHT_Export();
320 if (Options->ExportGeometry) {
325 Disable_WTM_Export();
328 if (Options->SmoothBetweenMeshes && Options->ExportGeometry) {
345 sprintf(
string,
"Current FPS: %d", GetFrameRate());
355 ComboBox_ResetContent(HwndReduce);
356 ComboBox_ResetContent(HwndFlavor);
358 for (
int i=1; i<100; i++) {
359 sprintf(
string,
"%d", i);
360 ComboBox_AddString(HwndReduce,
string);
363 ComboBox_AddString(HwndFlavor,
"TimeCoded");
364 ComboBox_AddString(HwndFlavor,
"Adaptive Delta");
367 if ((Options->ReduceAnimationPercent < 1) || (Options->ReduceAnimationPercent > 99)) {
368 Options->ReduceAnimationPercent = 50;
372 if ((Options->CompressAnimationFlavor < 0) || (Options->CompressAnimationFlavor >=
ANIM_FLAVOR_VALID)) {
373 Options->CompressAnimationFlavor = 0;
376 ComboBox_SetCurSel(HwndReduce, Options->ReduceAnimationPercent-1);
377 ComboBox_SetCurSel(HwndFlavor, Options->CompressAnimationFlavor);
383 sprintf(
string,
"%f", Options->CompressAnimationTranslationError);
384 Edit_SetText(HwndTError,
string);
386 sprintf(
string,
"%f", Options->CompressAnimationRotationError);
387 Edit_SetText(HwndRError,
string);
392 WHA_Compress_Animation_Check_Changed();
394 if (Options->ExportAnimation) {
399 Disable_WHA_Export();
404 int ticksperframe = GetTicksPerFrame();
405 int startframe = MaxInterface->GetAnimRange().Start() / ticksperframe;
406 int endframe = MaxInterface->GetAnimRange().End() / ticksperframe;
408 RangeLowSpin = SetupIntSpinner
418 RangeHighSpin = SetupIntSpinner
433#if ENABLE_MESH_OPTIMIZING
438BOOL W3dOptionsDialogClass::Dialog_Ok()
440 bool changed =
false;
444 changed = changed || (Options->ExportHierarchy != export_h);
445 Options->ExportHierarchy = export_h;
448 changed = changed || (Options->LoadHierarchy != load_h);
449 Options->LoadHierarchy = load_h;
452 changed = changed || (Options->ExportAnimation != export_a);
453 Options->ExportAnimation = export_a;
456 changed = changed || (Options->ExportGeometry != export_g);
457 Options->ExportGeometry = export_g;
461 changed = changed || (Options->SmoothBetweenMeshes != smooth_meshes);
462 Options->SmoothBetweenMeshes = smooth_meshes;
465 changed = changed || (Options->DisableExportAABTrees != disable_export_aabs);
466 Options->DisableExportAABTrees = disable_export_aabs;
469 changed = changed || (Options->EnableMaterialColorToTextureConversion != convert_materials);
470 Options->EnableMaterialColorToTextureConversion = convert_materials;
472#if ENABLE_MESH_OPTIMIZING
474 changed = changed || (Options->EnableOptimizeMeshData != optimize_mesh_data);
475 Options->EnableOptimizeMeshData = optimize_mesh_data;
477 Options->EnableOptimizeMeshData =
false;
481 Options->SmoothBetweenMeshes =
false;
482 Options->DisableExportAABTrees =
false;
483 Options->EnableOptimizeMeshData =
false;
484 Options->EnableMaterialColorToTextureConversion =
false;
489 changed = changed || (Options->TranslationOnly != xlation_only);
490 Options->TranslationOnly = xlation_only;
493 changed = changed || (Options->EnableTerrainMode != terrain_mode);
494 Options->EnableTerrainMode = terrain_mode;
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);
503 RawFileClass file(Options->HierarchyFilename);
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);
514 int start_frame = RangeLowSpin->GetIVal();
515 changed = changed || (Options->StartFrame != start_frame);
516 Options->StartFrame = start_frame;
518 int end_frame = RangeHighSpin->GetIVal();
519 changed = changed || (Options->EndFrame != end_frame);
520 Options->EndFrame = end_frame;
523 changed = changed || (Options->CompressAnimation != compress_animation);
524 Options->CompressAnimation = compress_animation;
527 changed = changed || (Options->ReduceAnimation != reduce_animation);
528 Options->ReduceAnimation = reduce_animation;
530 int reduce_percent = ComboBox_GetCurSel(HwndReduce) + 1;
531 changed = changed || (Options->ReduceAnimationPercent != reduce_percent);
532 Options->ReduceAnimationPercent = reduce_percent;
534 int flavor = ComboBox_GetCurSel(HwndFlavor);
535 changed = changed || (Options->CompressAnimationFlavor != flavor);
536 Options->CompressAnimationFlavor = flavor;
539 Edit_GetText(HwndTError,
string, 128);
540 float trans_error = atof(
string);
541 changed = changed || (Options->CompressAnimationTranslationError != trans_error);
542 Options->CompressAnimationTranslationError = trans_error;
544 Edit_GetText(HwndRError,
string, 128);
545 float rot_error = atof(
string);
546 changed = changed || (Options->CompressAnimationRotationError != rot_error);
547 Options->CompressAnimationRotationError = rot_error;
550 changed = changed || (Options->ReviewLog != review_log);
551 Options->ReviewLog = review_log;
555 Options->UseVoxelizer =
false;
557 if (changed) SetSaveRequiredFlag(
true);
561void W3dOptionsDialogClass::Enable_WHT_Export(
void)
569void W3dOptionsDialogClass::Enable_WHT_Load(
void)
577void W3dOptionsDialogClass::Disable_WHT_Export(
void)
582 Disable_WHA_Export();
590void W3dOptionsDialogClass::Enable_WHA_Export(
void)
600 Enable_CompressAnimationOptions_Export();
605void W3dOptionsDialogClass::Disable_WHA_Export(
void)
614 Disable_CompressAnimationOptions_Export();
617void W3dOptionsDialogClass::Enable_ReduceAnimationOptions_Export(
void)
622void W3dOptionsDialogClass::Disable_ReduceAnimationOptions_Export(
void)
627void W3dOptionsDialogClass::Enable_CompressAnimationOptions_Export(
void)
633 WHA_Reduce_Animation_Check_Changed();
634 WHA_Compression_Flavor_Changed();
637void W3dOptionsDialogClass::Disable_CompressAnimationOptions_Export(
void)
646void W3dOptionsDialogClass::Enable_WTM_Export(
void)
650#if ENABLE_MESH_OPTIMIZING
655void W3dOptionsDialogClass::Disable_WTM_Export(
void)
659#if ENABLE_MESH_OPTIMIZING
664void W3dOptionsDialogClass::WHT_Export_Radio_Changed(
void)
671 Disable_WHT_Export();
675void W3dOptionsDialogClass::WHA_Export_Radio_Changed(
void)
680 Disable_WHA_Export();
684void W3dOptionsDialogClass::WTM_Export_Radio_Changed(
void)
689 Disable_WTM_Export();
694void W3dOptionsDialogClass::WHA_Compress_Animation_Check_Changed(
void)
697 Enable_CompressAnimationOptions_Export();
699 Disable_CompressAnimationOptions_Export();
703void W3dOptionsDialogClass::WHA_Reduce_Animation_Check_Changed(
void)
706 Enable_ReduceAnimationOptions_Export();
708 Disable_ReduceAnimationOptions_Export();
712void W3dOptionsDialogClass::WHA_Compression_Flavor_Changed()
714 int flavor = ComboBox_GetCurSel(HwndFlavor);
720 WHA_Reduce_Animation_Check_Changed();
730 Disable_ReduceAnimationOptions_Export();
761BOOL CALLBACK _options_dialog_proc
771 if (message == WM_INITDIALOG) {
773 optdialog->
Hwnd = hwnd;
777 return optdialog->
Dialog_Proc(hwnd, message, wParam, lParam);
798 static char _szhierarchyfilter[] =
"W3D Files (*.W3D)\0*.W3D\0WHT Files (*.WHT)\0*.WHT\0\0";
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;
@ ANIM_FLAVOR_ADAPTIVE_DELTA
BOOL Options(Command_Line_Arguments *Orgs)
void Set_Options(W3dExportOptionsStruct *options)
static char CurrentExportPath[_MAX_DRIVE+_MAX_DIR+1]
W3dOptionsDialogClass(Interface *maxinterface, ExpInterface *exportinterface)
bool Dialog_Proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM)
bool Get_Export_Options(W3dExportOptionsStruct *options)
void Create_Relative_Path(char *rel_path, const char *curr, const char *full_path)
bool Is_Full_Path(char *path)
void Create_Full_Path(char *full_path, const char *curr, const char *rel_path)