void plExportDlgImp::IDoExport() { fExporting = true; // Hide the window, since we don't get control back until the export is done ShowWindow(fDlg, SW_HIDE); // Do the export wchar_t exportPathTEMP[MAX_PATH]; GetDlgItemTextW(fDlg, IDC_CLIENT_PATH, exportPathTEMP, arrsize(exportPathTEMP)); plFileName exportPath = plFileName::Join(plString::FromWchar(exportPathTEMP), "Export.prd"); // For export time stats DWORD exportTime = timeGetTime(); if (fExportFile) IExportCurrentFile(exportPath.AsString().c_str()); else { std::vector<plFileName> sources = plFileSystem::ListDir(fExportSourceDir, "*.max"); for (auto iter = sources.begin(); iter != sources.end(); ++iter) { if (GetCOREInterface()->LoadFromFile(iter->AsString().c_str())) IExportCurrentFile(exportPath.AsString().c_str()); } } fLastExportTime = (timeGetTime() - exportTime) / 1000; IDestroy(); fExporting = false; }
void plExportDlgImp::IDoExport() { fExporting = true; // Hide the window, since we don't get control back until the export is done ShowWindow(fDlg, SW_HIDE); // Do the export char exportPath[MAX_PATH]; GetDlgItemText(fDlg, IDC_CLIENT_PATH, exportPath, sizeof(exportPath)); strcat(exportPath, "Export.prd"); // For export time stats DWORD exportTime = timeGetTime(); if (fExportFile) IExportCurrentFile(exportPath); else { hsFolderIterator sourceDir(fExportSourceDir); while (sourceDir.NextFileSuffix(".max")) { char exportFile[MAX_PATH]; sourceDir.GetPathAndName(exportFile); if (GetCOREInterface()->LoadFromFile(exportFile)) IExportCurrentFile(exportPath); } } fLastExportTime = (timeGetTime() - exportTime) / 1000; IDestroy(); fExporting = false; }
BOOL plExportDlgImp::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: IInitDlg(hDlg); return TRUE; case WM_COMMAND: { int cmd = HIWORD(wParam); int resID = LOWORD(wParam); if (cmd == BN_CLICKED) { if (resID == IDCANCEL) { IDestroy(); return TRUE; } else if (resID == IDC_EXPORT) { IDoExport(); return TRUE; } else if (resID == IDC_PRESHADE_CHECK) { fPreshade = (IsDlgButtonChecked(hDlg, IDC_PRESHADE_CHECK) == BST_CHECKED); return TRUE; } else if (resID == IDC_PHYSICAL_CHECK) { fPhysicalsOnly = (IsDlgButtonChecked(hDlg, IDC_PHYSICAL_CHECK) == BST_CHECKED); return TRUE; } else if (resID == IDC_LIGHTMAP_CHECK) { fLightMap = (IsDlgButtonChecked(hDlg, IDC_LIGHTMAP_CHECK) == BST_CHECKED); return TRUE; } else if (resID == IDC_DIR) { // Get a new client path const char* path = plMaxConfig::GetClientPath(true); if (path) SetDlgItemText(hDlg, IDC_CLIENT_PATH, path); return TRUE; } else if (resID == IDC_RADIO_FILE || resID == IDC_RADIO_DIR) { IGetRadio(hDlg); return TRUE; } else if (resID == IDC_BROWSE_EXPORT) { plBrowseFolder::GetFolder(fExportSourceDir, fExportSourceDir, "Choose the source directory", hDlg); SetDlgItemText(hDlg, IDC_EXPORT_PATH, fExportSourceDir); return TRUE; } } else if (cmd == CBN_SELCHANGE && resID == IDC_PAGE_COMBO) { int sel = ComboBox_GetCurSel((HWND)lParam); // If the user selected a page, save it if (sel != 0 && sel != CB_ERR) ComboBox_GetText((HWND)lParam, fExportPage, sizeof(fExportPage)); // Else, clear it (export all pages) else fExportPage[0] = '\0'; return TRUE; } } break; } return FALSE; }