30 #include "maxImportRes.h" 42 class MaxEggImporter :
public SceneImport
49 const TCHAR * Ext(
int n);
50 const TCHAR * LongDesc();
51 const TCHAR * ShortDesc();
52 const TCHAR * AuthorName();
53 const TCHAR * CopyrightMessage();
54 const TCHAR * OtherMessage1();
55 const TCHAR * OtherMessage2();
56 unsigned int Version();
57 void ShowAbout(HWND hWnd);
58 int DoImport(
const TCHAR *name,ImpInterface *ei,Interface *i, BOOL suppressPrompts);
63 static BOOL _importmodel;
64 static BOOL _importanim;
67 BOOL MaxEggImporter::_merge = TRUE;
68 BOOL MaxEggImporter::_importmodel = TRUE;
69 BOOL MaxEggImporter::_importanim = FALSE;
71 MaxEggImporter::MaxEggImporter()
75 MaxEggImporter::~MaxEggImporter()
79 int MaxEggImporter::ExtCount()
85 const TCHAR * MaxEggImporter::Ext(
int n)
89 case 0:
return _T(
"egg");
90 default:
return _T(
"");
94 const TCHAR * MaxEggImporter::LongDesc()
96 return _T(
"Panda3D Egg Importer");
99 const TCHAR * MaxEggImporter::ShortDesc()
101 return _T(
"Panda3D Egg");
104 const TCHAR * MaxEggImporter::AuthorName()
106 return _T(
"Joshua Yelon");
109 const TCHAR * MaxEggImporter::CopyrightMessage()
111 return _T(
"Copyight (c) 2005 Josh Yelon");
114 const TCHAR * MaxEggImporter::OtherMessage1()
119 const TCHAR * MaxEggImporter::OtherMessage2()
124 unsigned int MaxEggImporter::Version()
129 static INT_PTR CALLBACK AboutBoxDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
133 CenterWindow(hWnd, GetParent(hWnd));
136 switch (LOWORD(wParam)) {
148 void MaxEggImporter::ShowAbout(HWND hWnd)
150 DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX),
151 hWnd, AboutBoxDlgProc, 0);
155 static INT_PTR CALLBACK ImportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
157 MaxEggImporter *imp = (MaxEggImporter*) GetWindowLongPtr(hWnd, GWLP_USERDATA);
160 imp = (MaxEggImporter*)lParam;
161 SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);
162 CenterWindow(hWnd, GetParent(hWnd));
163 CheckDlgButton(hWnd, IDC_MERGE, imp->_merge);
164 CheckDlgButton(hWnd, IDC_IMPORTMODEL, imp->_importmodel);
165 CheckDlgButton(hWnd, IDC_IMPORTANIM, imp->_importanim);
168 switch (LOWORD(wParam)) {
170 imp->_merge = IsDlgButtonChecked(hWnd, IDC_MERGE);
171 imp->_importmodel = IsDlgButtonChecked(hWnd, IDC_IMPORTMODEL);
172 imp->_importanim = IsDlgButtonChecked(hWnd, IDC_IMPORTANIM);
187 DoImport(
const TCHAR *name, ImpInterface *ii, Interface *i, BOOL suppressPrompts) {
189 if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IMPORT_DLG),
190 i->GetMAXHWnd(), ImportDlgProc, (LPARAM)
this)) {
194 std::ostringstream log;
200 wcstombs(sname, name, 2047);
201 bool ok = MaxLoadEggFile(sname, _merge ?
true:
false, _importmodel ?
true:
false, _importanim ?
true:
false);
203 bool ok = MaxLoadEggFile(name, _merge ?
true:
false, _importmodel ?
true:
false, _importanim ?
true:
false);
206 std::string txt = log.str();
208 MessageBoxA(
nullptr, txt.c_str(),
"Panda3D Importer", MB_OK);
210 MessageBoxA(
nullptr,
"Import Failed, unknown reason\n",
"Panda3D Importer", MB_OK);
223 BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) {
224 static int controlsInit = FALSE;
225 hInstance = hinstDLL;
232 #if MAX_VERSION_MAJOR < 14 233 InitCustomControls(hInstance);
235 InitCommonControls();
241 #define PANDAEGGIMP_CLASS_ID1 0x377193ab 242 #define PANDAEGGIMP_CLASS_ID2 0x897afe12 244 class MaxEggImporterClassDesc:
public ClassDesc {
246 int IsPublic() {
return 1;}
247 void *Create(BOOL loading = FALSE) {
return new MaxEggImporter;}
248 const TCHAR *ClassName() {
return _T(
"MaxEggImporter");}
249 SClass_ID SuperClassID() {
return SCENE_IMPORT_CLASS_ID;}
250 Class_ID ClassID() {
return Class_ID(PANDAEGGIMP_CLASS_ID1,PANDAEGGIMP_CLASS_ID2);}
251 const TCHAR *Category() {
return _T(
"Chrutilities");}
254 static MaxEggImporterClassDesc MaxEggImporterDesc;
256 __declspec( dllexport )
const TCHAR* LibDescription()
258 return _T(
"Panda3D Egg Importer");
261 __declspec( dllexport )
int LibNumberClasses()
266 __declspec( dllexport ) ClassDesc* LibClassDesc(
int i)
269 case 0:
return &MaxEggImporterDesc;
274 __declspec( dllexport ) ULONG LibVersion()
276 return VERSION_3DSMAX;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static Notify * ptr()
Returns the pointer to the global Notify object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_ostream_ptr(std::ostream *ostream_ptr, bool delete_later)
Changes the ostream that all subsequent Notify messages will be written to.