goat3d
diff exporters/maxgoat/src/maxgoat.cc @ 61:fdece14403ff
max gui
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 31 Mar 2014 09:41:47 +0300 |
parents | 0c3576325480 |
children | 3751aabbc5b3 |
line diff
1.1 --- a/exporters/maxgoat/src/maxgoat.cc Sun Mar 30 08:53:33 2014 +0300 1.2 +++ b/exporters/maxgoat/src/maxgoat.cc Mon Mar 31 09:41:47 2014 +0300 1.3 @@ -15,6 +15,8 @@ 1.4 #include "goat3d.h" 1.5 #include "minwin.h" 1.6 #include "config.h" 1.7 +#include "logger.h" 1.8 +#include "resource.h" 1.9 1.10 1.11 #pragma comment (lib, "core.lib") 1.12 @@ -32,8 +34,7 @@ 1.13 #define VERSION(major, minor) \ 1.14 ((major) * 100 + ((minor) < 10 ? (minor) * 10 : (minor))) 1.15 1.16 -static FILE *logfile; 1.17 -static HINSTANCE hinst; 1.18 +HINSTANCE hinst; 1.19 1.20 class GoatExporter : public SceneExport { 1.21 private: 1.22 @@ -116,10 +117,45 @@ 1.23 MessageBoxA(win, "Goat3D exporter plugin", "About this plugin", 0); 1.24 } 1.25 1.26 +static INT_PTR CALLBACK handle_dlg_events(HWND win, unsigned int msg, WPARAM wparam, LPARAM lparam) 1.27 +{ 1.28 + switch(msg) { 1.29 + case WM_INITDIALOG: 1.30 + CheckDlgButton(win, IDC_GOAT_NODES, 1); 1.31 + CheckDlgButton(win, IDC_GOAT_MESHES, 1); 1.32 + CheckDlgButton(win, IDC_GOAT_LIGHTS, 1); 1.33 + CheckDlgButton(win, IDC_GOAT_CAMERAS, 1); 1.34 + break; 1.35 + 1.36 + case WM_COMMAND: 1.37 + switch(LOWORD(wparam)) { 1.38 + case IDOK: 1.39 + EndDialog(win, 1); 1.40 + break; 1.41 + 1.42 + case IDCANCEL: 1.43 + EndDialog(win, 0); 1.44 + break; 1.45 + 1.46 + default: 1.47 + return 0; 1.48 + } 1.49 + break; 1.50 + 1.51 + default: 1.52 + return 0; 1.53 + } 1.54 + 1.55 + return 1; 1.56 +} 1.57 + 1.58 int GoatExporter::DoExport(const MCHAR *name, ExpInterface *eiface, Interface *iface, 1.59 BOOL non_interactive, DWORD opt) 1.60 { 1.61 - mw_test(); 1.62 + if(!DialogBox(hinst, MAKEINTRESOURCE(IDD_GOAT_SCE), 0, handle_dlg_events)) { 1.63 + maxlog("canceled!\n"); 1.64 + return IMPEXP_CANCEL; 1.65 + } 1.66 1.67 mtlmap.clear(); 1.68 nodemap.clear(); 1.69 @@ -127,9 +163,9 @@ 1.70 char fname[512]; 1.71 wcstombs(fname, name, sizeof fname - 1); 1.72 1.73 - fprintf(logfile, "Exporting Goat3D Scene (text) file: %s\n", fname); 1.74 + maxlog("Exporting Goat3D Scene (text) file: %s\n", fname); 1.75 if(!(igame = GetIGameInterface())) { 1.76 - fprintf(logfile, "failed to get the igame interface\n"); 1.77 + maxlog("failed to get the igame interface\n"); 1.78 return IMPEXP_FAIL; 1.79 } 1.80 IGameConversionManager *cm = GetConversionManager(); 1.81 @@ -451,18 +487,13 @@ 1.82 SHGetFolderPathA(0, CSIDL_PERSONAL, 0, 0, path); 1.83 strcat(path, "/testexp.log"); 1.84 1.85 - if((logfile = fopen(path, "w"))) { 1.86 - setvbuf(logfile, 0, _IONBF, 0); 1.87 - } 1.88 + maxlog_open(path); 1.89 return TRUE; 1.90 } 1.91 1.92 __declspec(dllexport) int LibShutdown() 1.93 { 1.94 - if(logfile) { 1.95 - fclose(logfile); 1.96 - logfile = 0; 1.97 - } 1.98 + maxlog_close(); 1.99 return TRUE; 1.100 } 1.101