51static const char *BROWSE_FILTER =
"W3D Files (*.W3D)\0*.W3D\0WHT Files (*.WHT)\0*.WHT\0\0";
60 MaxInterface (maxinterface),
63 ParentWnd (parent_wnd),
66 ::memset (PaneWnds, 0,
sizeof (PaneWnds));
91 ParentWnd, Real_Message_Proc, (LPARAM)
this);
102PresetExportOptionsDialogClass::Real_Message_Proc
116 if (message == WM_INITDIALOG) {
118 dialog_obj->Wnd = wnd;
119 ::SetProp (wnd,
"DIALOG_OBJ", (HANDLE)dialog_obj);
128 if (dialog_obj !=
NULL) {
129 retval = dialog_obj->Message_Proc (message, wparam, lparam);
135 if (message == WM_DESTROY) {
136 ::RemoveProp (wnd,
"DIALOG_OBJ");
149PresetExportOptionsDialogClass::Settings_Pane_Message_Proc
163 if (message == WM_INITDIALOG) {
165 ::SetProp (wnd,
"DIALOG_OBJ", (HANDLE)dialog_obj);
174 if (dialog_obj !=
NULL) {
175 retval = dialog_obj->Pane_Message_Proc (message, wparam, lparam);
181 if (message == WM_DESTROY) {
182 ::RemoveProp (wnd,
"DIALOG_OBJ");
195PresetExportOptionsDialogClass::Pane_Message_Proc
206 case WM_CUSTEDIT_ENTER:
215 ICustEdit *edit_ctrl = GetICustEdit ((HWND)lparam);
216 if (edit_ctrl !=
NULL) {
217 Options->StartFrame = edit_ctrl->GetInt ();
222 if (Options->StartFrame > Options->EndFrame) {
223 Options->StartFrame = Options->EndFrame;
236 ICustEdit *edit_ctrl = GetICustEdit ((HWND)lparam);
237 if (edit_ctrl !=
NULL) {
238 Options->EndFrame = edit_ctrl->GetInt ();
243 if (Options->EndFrame < Options->StartFrame) {
244 Options->EndFrame = Options->StartFrame;
255 case CC_SPINNER_BUTTONUP:
257 ISpinnerControl *spin_ctrl = (ISpinnerControl *)lparam;
258 if (spin_ctrl !=
NULL) {
260 switch (LOWORD (wparam))
266 Options->StartFrame = spin_ctrl->GetIVal ();
271 if (Options->StartFrame > Options->EndFrame) {
272 Options->StartFrame = Options->EndFrame;
281 Options->EndFrame = spin_ctrl->GetIVal ();
286 if (Options->EndFrame < Options->StartFrame) {
287 Options->EndFrame = Options->StartFrame;
299 HWND control_wnd =
reinterpret_cast <HWND
> (lparam);
300 bool update_controls =
true;
302 switch (LOWORD (wparam))
305 Options->SmoothBetweenMeshes = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
309 Options->DisableExportAABTrees = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) != 1);
314 Options->EnableOptimizeMeshData = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
319 Options->LoadHierarchy = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
323 Options->CompressAnimation = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
328 OPENFILENAME ofn = {
sizeof (OPENFILENAME), 0 };
329 ofn.lpstrFilter = BROWSE_FILTER;
330 ofn.nMaxFile = _MAX_PATH;
331 ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT;
332 ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT;
333 ofn.lpstrDefExt =
"wht";
335 ofn.lpstrFile = Options->HierarchyFilename;
337 if (::GetOpenFileName (&ofn)) {
355 AnimationCompressionSettingsDialogClass dialog (MaxInterface, Wnd);
356 dialog.Set_Options (Options);
362 Options->EnableMaterialColorToTextureConversion = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
366 update_controls =
false;
370 if (update_controls) {
387PresetExportOptionsDialogClass::Message_Proc
403 RECT parent_rect = { 0 };
405 ::GetWindowRect (ParentWnd, &parent_rect);
406 ::GetWindowRect (Wnd, &rect);
407 int width = parent_rect.right - parent_rect.left;
408 int height = parent_rect.bottom - parent_rect.top;
409 ::SetWindowPos ( Wnd,
NULL,
410 parent_rect.left + (width / 2) - ((rect.right - rect.left) / 2),
411 parent_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2),
412 0, 0, SWP_NOZORDER | SWP_NOSIZE);
417 Create_Settings_Panes ();
418 Initialize_Controls ();
420 Determine_Preset_Type ();
426 retval = On_Command (wparam, lparam);
440PresetExportOptionsDialogClass::On_Command (WPARAM wparam, LPARAM lparam)
444 switch (LOWORD (wparam))
447 Show_Settings_Pane (PANE_HLOD);
451 Show_Settings_Pane (PANE_ANIM_HLOD);
455 Show_Settings_Pane (PANE_ANIM);
459 Show_Settings_Pane (PANE_TERRAIN);
463 Show_Settings_Pane (PANE_SKELETON);
467 Show_Settings_Pane (PANE_MESH);
471 ::memcpy (Options, &OrigOptions,
sizeof (OrigOptions));
472 EndDialog (Wnd, IDCANCEL);
477 EndDialog (Wnd, IDOK);
491PresetExportOptionsDialogClass::Show_Settings_Pane (
int pane_id)
493 if (pane_id != CurrentPane) {
498 ::ShowWindow (PaneWnds[pane_id], SW_SHOW);
499 if (CurrentPane >= 0) {
500 ::ShowWindow (PaneWnds[CurrentPane], SW_HIDE);
502 CurrentPane = pane_id;
515PresetExportOptionsDialogClass::Create_Settings_Panes (
void)
518 Wnd, Settings_Pane_Message_Proc, (LPARAM)
this);
521 Wnd, Settings_Pane_Message_Proc, (LPARAM)
this);
524 Wnd, Settings_Pane_Message_Proc, (LPARAM)
this);
527 Wnd, Settings_Pane_Message_Proc, (LPARAM)
this);
530 Wnd, Settings_Pane_Message_Proc, (LPARAM)
this);
533 Wnd, Settings_Pane_Message_Proc, (LPARAM)
this);
540 RECT group_rect = { 0 };
541 ::GetWindowRect (::GetDlgItem (Wnd,
IDC_GROUP_BOX), &group_rect);
542 ::ScreenToClient (Wnd, (LPPOINT)&group_rect);
543 ::ScreenToClient (Wnd, ((LPPOINT)&group_rect) + 1);
544 int width = group_rect.right - group_rect.left;
545 int height = group_rect.bottom - group_rect.top;
550 for (
int index = 0; index < PANE_MAX; index ++) {
551 HWND pane_wnd = PaneWnds[index];
557 ::GetWindowRect (pane_wnd, &rect);
562 ::SetWindowPos ( pane_wnd, ::GetDlgItem (Wnd,
IDC_GROUP_BOX),
563 group_rect.left + (width / 2) - ((rect.right - rect.left) / 2),
564 group_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2),
578PresetExportOptionsDialogClass::Destroy_Settings_Panes (
void)
583 for (
int index = 0; index < PANE_MAX; index ++) {
584 ::DestroyWindow (PaneWnds[index]);
585 PaneWnds[index] =
NULL;
598PresetExportOptionsDialogClass::Determine_Preset_Type (
void)
605 if (Options->EnableTerrainMode) {
610 Show_Settings_Pane (PANE_TERRAIN);
613 }
else if (Options->ExportGeometry ==
false) {
615 if (Options->ExportAnimation ==
false) {
620 Show_Settings_Pane (PANE_SKELETON);
627 Show_Settings_Pane (PANE_ANIM);
631 }
else if (Options->ExportHierarchy ==
false && Options->LoadHierarchy ==
false) {
636 Show_Settings_Pane (PANE_MESH);
639 }
else if (Options->ExportAnimation ==
false) {
644 Show_Settings_Pane (PANE_HLOD);
652 Show_Settings_Pane (PANE_ANIM_HLOD);
666PresetExportOptionsDialogClass::Initialize_Controls (
void)
676 int ticksperframe = ::GetTicksPerFrame();
677 int startframe = MaxInterface->GetAnimRange ().Start () / ticksperframe;
678 int endframe = MaxInterface->GetAnimRange ().End () / ticksperframe;
683 if (startframe > Options->StartFrame) {
684 Options->StartFrame = startframe;
686 if (endframe < Options->EndFrame) {
687 Options->EndFrame = endframe;
693 for (
int index = 0; index < PANE_MAX; index ++) {
694 HWND pane_wnd = PaneWnds[index];
701 ISpinnerControl *low_spin =
NULL;
702 ISpinnerControl *high_spin =
NULL;
705 startframe, endframe, 0);
708 startframe, endframe, 0);
710 ::SetProp (::GetDlgItem (pane_wnd,
IDC_RANGE_LOW_SPIN),
"ISpinnerControl", (HANDLE)low_spin);
711 ::SetProp (::GetDlgItem (pane_wnd,
IDC_RANGE_HIGH_SPIN),
"ISpinnerControl", (HANDLE)high_spin);
725PresetExportOptionsDialogClass::Update_Controls (
void)
730 for (
int index = 0; index < PANE_MAX; index ++) {
731 HWND pane_wnd = PaneWnds[index];
738#if ENABLE_MESH_OPTIMIZING
749 if (compress_settings_btn !=
NULL) {
750 ::EnableWindow (compress_settings_btn, Options->CompressAnimation);
757 if (skeleten_browse_btn !=
NULL) {
762 if (Options->RelativeHierarchyFilename[0] != 0) {
763 SetWindowText (skeleten_browse_btn, Options->RelativeHierarchyFilename);
766 Options->RelativeHierarchyFilename);
768 }
else if (Options->HierarchyFilename[0] != 0) {
769 SetWindowText (skeleten_browse_btn, Options->HierarchyFilename);
772 Options->HierarchyFilename);
778 ::EnableWindow (skeleten_browse_btn, Options->LoadHierarchy);
786 if (low_spin_wnd !=
NULL && high_spin_wnd !=
NULL) {
791 ISpinnerControl *low_spin =
NULL;
792 ISpinnerControl *high_spin =
NULL;
793 low_spin = (ISpinnerControl *)::GetProp (low_spin_wnd,
"ISpinnerControl");
794 high_spin = (ISpinnerControl *)::GetProp (high_spin_wnd,
"ISpinnerControl");
799 low_spin->SetValue (Options->StartFrame,
FALSE);
800 high_spin->SetValue (Options->EndFrame,
FALSE);
814PresetExportOptionsDialogClass::Save_Settings (
void)
824 Options->ExportHierarchy =
true;
825 Options->LoadHierarchy =
false;
826 Options->ExportAnimation =
false;
827 Options->ExportGeometry =
true;
828 Options->CompressAnimation =
false;
829 Options->ReduceAnimation =
false;
830 Options->EnableTerrainMode =
true;
831 Options->DisableExportAABTrees =
false;
832 Options->EnableMaterialColorToTextureConversion =
false;
838 Options->ExportHierarchy =
true;
839 Options->LoadHierarchy =
false;
840 Options->ExportAnimation =
false;
841 Options->ExportGeometry =
false;
842 Options->CompressAnimation =
false;
843 Options->ReduceAnimation =
false;
844 Options->EnableTerrainMode =
false;
845 Options->EnableOptimizeMeshData =
false;
846 Options->DisableExportAABTrees =
true;
847 Options->SmoothBetweenMeshes =
false;
848 Options->EnableTerrainMode =
false;
849 Options->EnableMaterialColorToTextureConversion =
false;
855 Options->ExportHierarchy =
false;
856 Options->LoadHierarchy =
false;
857 Options->ExportAnimation =
false;
858 Options->ExportGeometry =
true;
859 Options->CompressAnimation =
false;
860 Options->ReduceAnimation =
false;
861 Options->EnableTerrainMode =
false;
862 Options->EnableOptimizeMeshData =
false;
863 Options->SmoothBetweenMeshes =
false;
864 Options->EnableTerrainMode =
false;
870 Options->ExportHierarchy = !Options->LoadHierarchy;
871 Options->ExportAnimation =
false;
872 Options->ExportGeometry =
true;
873 Options->CompressAnimation =
false;
874 Options->ReduceAnimation =
false;
875 Options->EnableTerrainMode =
false;
881 Options->ExportHierarchy = !Options->LoadHierarchy;
882 Options->ExportAnimation =
true;
883 Options->ExportGeometry =
true;
884 Options->EnableTerrainMode =
false;
890 Options->ExportHierarchy = !Options->LoadHierarchy;
891 Options->ExportAnimation =
true;
892 Options->ExportGeometry =
false;
893 Options->EnableTerrainMode =
false;
894 Options->EnableOptimizeMeshData =
false;
895 Options->DisableExportAABTrees =
true;
896 Options->SmoothBetweenMeshes =
false;
897 Options->EnableMaterialColorToTextureConversion =
false;
903 Options->ReviewLog = (::IsDlgButtonChecked (Wnd,
IDC_REVIEW_LOG) == 1);
908 if (::memcmp (Options, &OrigOptions,
sizeof (OrigOptions)) != 0) {
909 SetSaveRequiredFlag (
true);
PresetExportOptionsDialogClass(Interface *maxinterface, HWND parent_wnd=NULL)
~PresetExportOptionsDialogClass(void)
static char CurrentExportPath[_MAX_DRIVE+_MAX_DIR+1]
void Create_Relative_Path(char *rel_path, const char *curr, const char *full_path)
void Create_Full_Path(char *full_path, const char *curr, const char *rel_path)