14 const double meshVerts[252][3] = {
15 {0.729464, -0.919852, 0.714986},
16 {0.466137, -0.594656, 0.160201},
17 {-0.265897, -1.14704, 0.714986},
18 {0.466137, -0.594656, 0.160201},
19 {-0.177333, -0.741523, 0.160201},
20 {-0.265897, -1.14704, 0.714986},
21 {-0.265897, -1.14704, 0.714986},
22 {-0.177333, -0.741523, 0.160201},
23 {-1.06411, -0.510479, 0.714986},
24 {-0.177333, -0.741523, 0.160201},
25 {-0.693356, -0.330009, 0.160201},
26 {-1.06411, -0.510479, 0.714986},
27 {-1.06411, 0.510479, 0.714986},
28 {-1.06411, -0.510479, 0.714986},
29 {-0.693356, 0.330009, 0.160201},
30 {-0.693356, -0.330009, 0.160201},
31 {-0.693356, 0.330009, 0.160201},
32 {-1.06411, -0.510479, 0.714986},
33 {-0.265897, 1.14704, 0.714986},
34 {-1.06411, 0.510479, 0.714986},
35 {-0.177333, 0.741523, 0.160201},
36 {-0.693356, 0.330009, 0.160201},
37 {-0.177333, 0.741523, 0.160201},
38 {-1.06411, 0.510479, 0.714986},
39 {0.729464, 0.919852, 0.714986},
40 {-0.265897, 1.14704, 0.714986},
41 {0.466137, 0.594656, 0.160201},
42 {-0.177333, 0.741523, 0.160201},
43 {0.466137, 0.594656, 0.160201},
44 {-0.265897, 1.14704, 0.714986},
45 {1.17244, 0.0, 0.714986},
46 {0.729464, 0.919852, 0.714986},
47 {0.752508, 0.0, 0.160201},
48 {0.466137, 0.594656, 0.160201},
49 {0.752508, 0.0, 0.160201},
50 {0.729464, 0.919852, 0.714986},
51 {0.729464, -0.919852, 0.714986},
52 {1.17244, 0.0, 0.714986},
53 {0.466137, -0.594656, 0.160201},
54 {0.752508, 0.0, 0.160201},
55 {0.466137, -0.594656, 0.160201},
56 {1.17244, 0.0, 0.714986},
57 {-0.286334, -1.26822, 1.44995},
58 {0.814187, -1.01703, 1.44995},
59 {-0.265897, -1.14704, 0.714986},
60 {0.729464, -0.919852, 0.714986},
61 {-0.265897, -1.14704, 0.714986},
62 {0.814187, -1.01703, 1.44995},
63 {-1.16888, -0.564412, 1.44995},
64 {-0.286334, -1.26822, 1.44995},
65 {-1.06411, -0.510479, 0.714986},
66 {-0.265897, -1.14704, 0.714986},
67 {-1.06411, -0.510479, 0.714986},
68 {-0.286334, -1.26822, 1.44995},
69 {-1.16888, 0.564411, 1.44995},
70 {-1.16888, -0.564412, 1.44995},
71 {-1.06411, 0.510479, 0.714986},
72 {-1.06411, -0.510479, 0.714986},
73 {-1.06411, 0.510479, 0.714986},
74 {-1.16888, -0.564412, 1.44995},
75 {-1.16888, 0.564411, 1.44995},
76 {-1.06411, 0.510479, 0.714986},
77 {-0.286334, 1.26822, 1.44995},
78 {-1.06411, 0.510479, 0.714986},
79 {-0.265897, 1.14704, 0.714986},
80 {-0.286334, 1.26822, 1.44995},
81 {-0.286334, 1.26822, 1.44995},
82 {-0.265897, 1.14704, 0.714986},
83 {0.814187, 1.01703, 1.44995},
84 {-0.265897, 1.14704, 0.714986},
85 {0.729464, 0.919852, 0.714986},
86 {0.814187, 1.01703, 1.44995},
87 {1.30396, 0.0, 1.44995},
88 {0.814187, 1.01703, 1.44995},
89 {1.17244, 0.0, 0.714986},
90 {0.729464, 0.919852, 0.714986},
91 {1.17244, 0.0, 0.714986},
92 {0.814187, 1.01703, 1.44995},
93 {1.30396, 0.0, 1.44995},
94 {1.17244, 0.0, 0.714986},
95 {0.814187, -1.01703, 1.44995},
96 {1.17244, 0.0, 0.714986},
97 {0.729464, -0.919852, 0.714986},
98 {0.814187, -1.01703, 1.44995},
99 {-0.286334, -1.26822, 1.44995},
100 {-0.227573, -1.05763, 2.16723},
101 {0.814187, -1.01703, 1.44995},
102 {0.814187, -1.01703, 1.44995},
103 {-0.227573, -1.05763, 2.16723},
104 {0.690208, -0.848157, 2.16723},
105 {-1.16888, -0.564412, 1.44995},
106 {-0.963577, -0.470692, 2.16723},
107 {-0.286334, -1.26822, 1.44995},
108 {-0.286334, -1.26822, 1.44995},
109 {-0.963577, -0.470692, 2.16723},
110 {-0.227573, -1.05763, 2.16723},
111 {-1.16888, -0.564412, 1.44995},
112 {-1.16888, 0.564411, 1.44995},
113 {-0.963577, -0.470692, 2.16723},
114 {-1.16888, 0.564411, 1.44995},
115 {-0.963577, 0.470692, 2.16723},
116 {-0.963577, -0.470692, 2.16723},
117 {-1.16888, 0.564411, 1.44995},
118 {-0.286334, 1.26822, 1.44995},
119 {-0.963577, 0.470692, 2.16723},
120 {-0.286334, 1.26822, 1.44995},
121 {-0.227574, 1.05763, 2.16723},
122 {-0.963577, 0.470692, 2.16723},
123 {-0.286334, 1.26822, 1.44995},
124 {0.814187, 1.01703, 1.44995},
125 {-0.227574, 1.05763, 2.16723},
126 {0.814187, 1.01703, 1.44995},
127 {0.690208, 0.848157, 2.16723},
128 {-0.227574, 1.05763, 2.16723},
129 {0.814187, 1.01703, 1.44995},
130 {1.30396, 0.0, 1.44995},
131 {0.690208, 0.848157, 2.16723},
132 {1.30396, 0.0, 1.44995},
133 {1.09866, 0.0, 2.16723},
134 {0.690208, 0.848157, 2.16723},
135 {0.814187, -1.01703, 1.44995},
136 {0.690208, -0.848157, 2.16723},
137 {1.30396, 0.0, 1.44995},
138 {1.30396, 0.0, 1.44995},
139 {0.690208, -0.848157, 2.16723},
140 {1.09866, 0.0, 2.16723},
141 {-0.227573, -1.05763, 2.16723},
142 {-0.154893, -0.759032, 2.72566},
143 {0.690208, -0.848157, 2.16723},
144 {0.690208, -0.848157, 2.16723},
145 {-0.154893, -0.759032, 2.72566},
146 {0.50377, -0.608696, 2.72566},
147 {-0.963577, -0.470692, 2.16723},
148 {-0.683099, -0.337801, 2.72566},
149 {-0.227573, -1.05763, 2.16723},
150 {-0.227573, -1.05763, 2.16723},
151 {-0.683099, -0.337801, 2.72566},
152 {-0.154893, -0.759032, 2.72566},
153 {-0.963577, -0.470692, 2.16723},
154 {-0.963577, 0.470692, 2.16723},
155 {-0.683099, -0.337801, 2.72566},
156 {-0.963577, 0.470692, 2.16723},
157 {-0.683099, 0.337801, 2.72566},
158 {-0.683099, -0.337801, 2.72566},
159 {-0.963577, 0.470692, 2.16723},
160 {-0.227574, 1.05763, 2.16723},
161 {-0.683099, 0.337801, 2.72566},
162 {-0.227574, 1.05763, 2.16723},
163 {-0.154893, 0.759032, 2.72566},
164 {-0.683099, 0.337801, 2.72566},
165 {-0.227574, 1.05763, 2.16723},
166 {0.690208, 0.848157, 2.16723},
167 {-0.154893, 0.759032, 2.72566},
168 {0.690208, 0.848157, 2.16723},
169 {0.50377, 0.608696, 2.72566},
170 {-0.154893, 0.759032, 2.72566},
171 {0.690208, 0.848157, 2.16723},
172 {1.09866, 0.0, 2.16723},
173 {0.50377, 0.608696, 2.72566},
174 {1.09866, 0.0, 2.16723},
175 {0.796903, 0.0, 2.72566},
176 {0.50377, 0.608696, 2.72566},
177 {1.09866, 0.0, 2.16723},
178 {0.690208, -0.848157, 2.16723},
179 {0.796903, 0.0, 2.72566},
180 {0.690208, -0.848157, 2.16723},
181 {0.50377, -0.608696, 2.72566},
182 {0.796903, 0.0, 2.72566},
183 {0.50377, -0.608696, 2.72566},
184 {-0.154893, -0.759032, 2.72566},
185 {0.259722, -0.299638, 3.11175},
186 {-0.154893, -0.759032, 2.72566},
187 {-0.0645132, -0.373643, 3.11175},
188 {0.259722, -0.299638, 3.11175},
189 {-0.154893, -0.759032, 2.72566},
190 {-0.683099, -0.337801, 2.72566},
191 {-0.0645132, -0.373643, 3.11175},
192 {-0.683099, -0.337801, 2.72566},
193 {-0.324529, -0.166287, 3.11175},
194 {-0.0645132, -0.373643, 3.11175},
195 {-0.683099, -0.337801, 2.72566},
196 {-0.683099, 0.337801, 2.72566},
197 {-0.324529, -0.166287, 3.11175},
198 {-0.683099, 0.337801, 2.72566},
199 {-0.324529, 0.166287, 3.11175},
200 {-0.324529, -0.166287, 3.11175},
201 {-0.683099, 0.337801, 2.72566},
202 {-0.154893, 0.759032, 2.72566},
203 {-0.324529, 0.166287, 3.11175},
204 {-0.154893, 0.759032, 2.72566},
205 {-0.0645132, 0.373642, 3.11175},
206 {-0.324529, 0.166287, 3.11175},
207 {-0.154893, 0.759032, 2.72566},
208 {0.50377, 0.608696, 2.72566},
209 {-0.0645132, 0.373642, 3.11175},
210 {0.50377, 0.608696, 2.72566},
211 {0.259722, 0.299638, 3.11175},
212 {-0.0645132, 0.373642, 3.11175},
213 {0.50377, 0.608696, 2.72566},
214 {0.796903, 0.0, 2.72566},
215 {0.259722, 0.299638, 3.11175},
216 {0.796903, 0.0, 2.72566},
217 {0.40402, 0.0, 3.11175},
218 {0.259722, 0.299638, 3.11175},
219 {0.796903, 0.0, 2.72566},
220 {0.50377, -0.608696, 2.72566},
221 {0.40402, 0.0, 3.11175},
222 {0.50377, -0.608696, 2.72566},
223 {0.259722, -0.299638, 3.11175},
224 {0.40402, 0.0, 3.11175},
225 {-0.177333, -0.741523, 0.160201},
226 {0.466137, -0.594656, 0.160201},
227 {-0.00334214, 0.0, 0.00443203},
228 {-0.693356, -0.330009, 0.160201},
229 {-0.177333, -0.741523, 0.160201},
230 {-0.00334214, 0.0, 0.00443203},
231 {-0.693356, 0.330009, 0.160201},
232 {-0.693356, -0.330009, 0.160201},
233 {-0.00334214, 0.0, 0.00443203},
234 {-0.177333, 0.741523, 0.160201},
235 {-0.693356, 0.330009, 0.160201},
236 {-0.00334214, 0.0, 0.00443203},
237 {0.466137, 0.594656, 0.160201},
238 {-0.177333, 0.741523, 0.160201},
239 {-0.00334214, 0.0, 0.00443203},
240 {0.752508, 0.0, 0.160201},
241 {0.466137, 0.594656, 0.160201},
242 {-0.00334214, 0.0, 0.00443203},
243 {0.466137, -0.594656, 0.160201},
244 {0.752508, 0.0, 0.160201},
245 {-0.00334214, 0.0, 0.00443203},
246 {0.259722, -0.299638, 3.11175},
247 {-0.0645132, -0.373643, 3.11175},
248 {0.0207683, 0.0, 3.20912},
249 {-0.0645132, -0.373643, 3.11175},
250 {-0.324529, -0.166287, 3.11175},
251 {0.0207683, 0.0, 3.20912},
252 {-0.324529, -0.166287, 3.11175},
253 {-0.324529, 0.166287, 3.11175},
254 {0.0207683, 0.0, 3.20912},
255 {-0.324529, 0.166287, 3.11175},
256 {-0.0645132, 0.373642, 3.11175},
257 {0.0207683, 0.0, 3.20912},
258 {-0.0645132, 0.373642, 3.11175},
259 {0.259722, 0.299638, 3.11175},
260 {0.0207683, 0.0, 3.20912},
261 {0.259722, 0.299638, 3.11175},
262 {0.40402, 0.0, 3.11175},
263 {0.0207683, 0.0, 3.20912},
264 {0.40402, 0.0, 3.11175},
265 {0.259722, -0.299638, 3.11175},
266 {0.0207683, 0.0, 3.20912}
271 #pragma warning(disable: 4800) 280 int IsPublic() {
return TRUE; }
281 void *Create(BOOL loading = FALSE) {
return new MaxEggPlugin(); }
282 const TCHAR *ClassName() {
return GetString(IDS_CLASS_NAME); }
283 SClass_ID SuperClassID() {
return HELPER_CLASS_ID; }
284 Class_ID ClassID() {
return MaxEggPlugin_CLASS_ID; }
285 const TCHAR *Category() {
return GetString(IDS_CATEGORY); }
287 const TCHAR *InternalName() {
return _T(
"MaxEggPlugin"); }
294 ClassDesc* GetMaxEggPluginDesc() {
return &MaxEggPluginDesc; }
297 Mesh MaxEggPlugin::mesh;
298 short MaxEggPlugin::meshBuilt=0;
299 HWND MaxEggPlugin::hMaxEggParams = NULL;
300 IObjParam *MaxEggPlugin::iObjParams;
306 INT_PTR CALLBACK MaxEggPluginOptionsDlgProc( HWND hWnd, UINT message,
307 WPARAM wParam, LPARAM lParam )
314 if ( !imp && message != WM_INITDIALOG )
return FALSE;
321 SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam);
322 SetDlgFont( hWnd, imp->iObjParams->GetAppHFont() );
323 MaxEggPlugin::hMaxEggParams = hWnd;
326 case WM_MOUSEACTIVATE:
327 imp->iObjParams->RealizeParamPanel();
333 imp->iObjParams->RollupMouseMessage(hWnd,message,wParam,lParam);
339 switch( LOWORD(wParam) ) {
340 case IDC_OVERWRITE_CHECK:
342 (IsDlgButtonChecked(hWnd, IDC_OVERWRITE_CHECK) == BST_CHECKED);
344 case IDC_PVIEW_CHECK:
346 (IsDlgButtonChecked(hWnd, IDC_PVIEW_CHECK) == BST_CHECKED);
350 (IsDlgButtonChecked(hWnd, IDC_LOGGING) == BST_CHECKED);
354 tempEgg->SetMaxInterface(imp->iObjParams);
355 tempEgg->SetAnimRange();
356 res = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EGG_DETAILS),
357 hWnd, MaxOptionsDialogProc, (LPARAM)tempEgg);
359 imp->SaveCheckState();
360 imp->AddEgg(tempEgg);
366 sel = ListView_GetSelectionMark(GetDlgItem(hWnd, IDC_LIST_EGGS));
370 tempEgg->SetAnimRange();
371 tempEgg->CullBadNodes();
372 DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EGG_DETAILS),
373 hWnd, MaxOptionsDialogProc, (LPARAM)tempEgg);
375 imp->SaveCheckState();
380 sel = ListView_GetSelectionMark(GetDlgItem(hWnd, IDC_LIST_EGGS));
382 imp->SaveCheckState();
395 MaxEggPlugin::MaxEggPlugin() :
396 autoOverwrite(
false), pview(
true), logOutput(
false), numEggs(0), maxEggs(5)
402 MaxEggPlugin::~MaxEggPlugin() {
403 for (
int i = 0; i < numEggs; i++)
delete eggList[i];
408 if (numEggs >= maxEggs) {
412 for (
int i = 0; i < numEggs; i++) newList[i] = eggList[i];
417 eggList[numEggs++] = newEgg;
420 void MaxEggPlugin::RemoveEgg(
int i) {
421 if (i >= 0 && i < numEggs) {
423 for (
int j = i+1; j < numEggs;) eggList[i++] = eggList[j++];
428 void MaxEggPlugin::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
431 for (
int i=0; i<numEggs; i++) {
432 eggList[i]->SetMaxInterface(ip);
435 if ( !hMaxEggParams ) {
436 hMaxEggParams = ip->AddRollupPage(hInstance,
437 MAKEINTRESOURCE(IDD_PANEL),
438 MaxEggPluginOptionsDlgProc,
439 GetString(IDS_PARAMS),
441 ip->RegisterDlgWnd(hMaxEggParams);
443 SetWindowLongPtr( hMaxEggParams, GWLP_USERDATA, (LPARAM)
this );
449 void MaxEggPlugin::EndEditParams( IObjParam *ip, ULONG flags,Animatable *prev)
452 if ( flags&END_EDIT_REMOVEUI ) {
453 ip->UnRegisterDlgWnd(hMaxEggParams);
454 ip->DeleteRollupPage(hMaxEggParams);
455 hMaxEggParams = NULL;
457 SetWindowLongPtr( hMaxEggParams, GWLP_USERDATA, NULL );
461 void MaxEggPlugin::SaveCheckState() {
462 if (!hMaxEggParams)
return;
463 HWND lv = GetDlgItem(hMaxEggParams, IDC_LIST_EGGS);
464 for (
int i = 0; i < numEggs; i++)
465 eggList[i]->_checked = ListView_GetCheckState(lv, i);
468 void MaxEggPlugin::UpdateUI() {
469 HWND lv = GetDlgItem(hMaxEggParams, IDC_LIST_EGGS);
472 if (ListView_GetColumnWidth(lv, 1) <= 0 || ListView_GetColumnWidth(lv, 1) > 10000) {
474 ListView_SetExtendedListViewStyleEx(lv, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT,
475 LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
477 pCol.fmt = LVCFMT_LEFT;
479 pCol.pszText = _T(
"Filename");
480 pCol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
482 ListView_InsertColumn(lv, 0, &pCol);
485 pCol.pszText = _T(
"Type");
486 ListView_InsertColumn(lv, 1, &pCol);
490 ListView_DeleteAllItems(lv);
492 Item.mask = LVIF_TEXT;
494 for (
int i = 0; i < numEggs; i++) {
497 Item.pszText = eggList[i]->_short_name;
498 ListView_InsertItem(lv, &Item);
500 switch(eggList[i]->_anim_type) {
501 case MaxEggOptions::AT_chan: Item.pszText = _T(
"Animation");
break;
502 case MaxEggOptions::AT_both: Item.pszText = _T(
"Both");
break;
503 case MaxEggOptions::AT_pose: Item.pszText = _T(
"Static");
break;
504 case MaxEggOptions::AT_model: Item.pszText = _T(
"Model");
break;
505 default: Item.pszText = _T(
"Model");
break;
507 ListView_SetItem(lv, &Item);
508 ListView_SetCheckState(lv, i, eggList[i]->_checked);
512 CheckDlgButton(hMaxEggParams, IDC_OVERWRITE_CHECK,
513 autoOverwrite ? BST_CHECKED : BST_UNCHECKED);
514 CheckDlgButton(hMaxEggParams, IDC_PVIEW_CHECK,
515 pview ? BST_CHECKED : BST_UNCHECKED);
516 CheckDlgButton(hMaxEggParams, IDC_LOGGING,
517 logOutput ? BST_CHECKED : BST_UNCHECKED);
520 void MaxEggPlugin::DoExport() {
521 int good = 0, bad = 0;
523 std::basic_stringstream<TCHAR> status;
527 for (
int i = 0; i < numEggs; i++) {
528 if (eggList[i]->_checked) {
531 bool do_write =
true;
533 if (!autoOverwrite && GetFileAttributes(eggList[i]->_file_name) != INVALID_FILE_ATTRIBUTES) {
535 _stprintf(msg, _T(
"Overwrite file \"%s.egg\"?"), eggList[i]->_short_name);
536 do_write = (MessageBox(hMaxEggParams, msg, _T(
"Panda3D Exporter"), MB_YESNO | MB_ICONQUESTION) == IDYES);
542 status << _T(
"Successfully created ") << eggList[i]->_short_name << _T(
".egg\n");
545 status << _T(
"Could not export ") << eggList[i]->_short_name << _T(
".egg\n");
549 status << _T(
"Skipped file ") << eggList[i]->_short_name << _T(
".egg\n");
556 if (good == 0 && bad == 0) {
557 mask |= MB_ICONEXCLAMATION;
558 MessageBox(hMaxEggParams, _T(
"Nothing to export!"), _T(
"Panda3D Export results"), mask);
560 if (bad > 0) mask |= MB_ICONEXCLAMATION;
561 else mask |= MB_ICONINFORMATION;
562 MessageBox(hMaxEggParams, status.str().c_str(), _T(
"Panda3D Export results"), mask);
566 if (pview && good > 0) {
567 for (i = 0; i < numEggs; i++) {
568 if (eggList[i]->_checked && eggList[i]->_successful) {
569 if (eggList[i]->_anim_type != MaxEggOptions::AT_chan) {
570 PROCESS_INFORMATION pi;
573 memset(&si, 0,
sizeof(si));
578 if (numEggs == 2 && eggList[i]->_anim_type == MaxEggOptions::AT_model &&
579 eggList[1-i]->_checked && eggList[1-i]->_successful &&
580 eggList[1-i]->_anim_type == MaxEggOptions::AT_chan) {
581 _stprintf(cmdLine, _T(
"pview \"%s\" \"%s\""), eggList[i]->_file_name, eggList[1-i]->_file_name);
583 _stprintf(cmdLine, _T(
"pview \"%s\""), eggList[i]->_file_name);
585 CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, CREATE_NEW_CONSOLE,
586 NULL, NULL, &si, &pi);
595 void MaxEggPlugin::BuildMesh()
598 if(meshBuilt)
return;
600 mesh.setNumVerts(252);
601 mesh.setNumFaces(84);
602 mesh.setSmoothFlags(0);
603 mesh.setNumTVerts (0);
604 mesh.setNumTVFaces (0);
606 for (i=0; i<252; i++)
607 mesh.setVert(i, meshVerts[i][0]*10, meshVerts[i][1]*10, meshVerts[i][2]*10);
608 for (i=0; i<84; i++) {
609 mesh.faces[i].setEdgeVisFlags(1, 1, 0);
610 mesh.faces[i].setSmGroup(0);
611 mesh.faces[i].setVerts(i*3, i*3+1, i*3+2);
614 mesh.InvalidateGeomCache();
615 mesh.BuildStripsAndEdges();
627 int proc( ViewExp *vpt,
int msg,
int point,
int flags, IPoint2 m, Matrix3& mat );
630 int MaxEggPluginCreateMouseCallBack::proc(ViewExp *vpt,
int msg,
int point,
int flags, IPoint2 m, Matrix3& mat )
632 if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
635 mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
638 mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
639 if (msg==MOUSE_POINT)
return CREATE_STOP;
642 }
else if (msg == MOUSE_ABORT) {
645 return CREATE_CONTINUE;
650 CreateMouseCallBack* MaxEggPlugin::GetCreateMouseCallBack()
651 {
return &MaxEggCreateMouseCB; }
657 void MaxEggPlugin::GetMat(TimeValue t, INode* inode, ViewExp* vpt, Matrix3& tm)
659 tm = inode->GetObjectTM(t);
661 PN_stdfloat scaleFactor = vpt->NonScalingObjectSize()*vpt->GetVPWorldWidth(tm.GetTrans())/(PN_stdfloat)360.0;
662 tm.Scale(Point3(scaleFactor,scaleFactor,scaleFactor));
665 void MaxEggPlugin::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel )
667 box = mesh.getBoundingBox(tm);
670 void MaxEggPlugin::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
672 Matrix3 m = inode->GetObjectTM(t);
675 PN_stdfloat scaleFactor = vpt->GetVPWorldWidth(m.GetTrans())/360.0f;
676 box = mesh.getBoundingBox();
677 box.Scale(scaleFactor);
680 void MaxEggPlugin::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
682 int i, nv; Matrix3 tm; Point3 pt;
683 GetMat(t,inode,vpt,tm);
684 nv = mesh.getNumVerts();
687 box += tm*mesh.getVert(i);
690 int MaxEggPlugin::HitTest(TimeValue t, INode *inode,
int type,
int crossing,
int flags, IPoint2 *p, ViewExp *vpt)
697 MakeHitRegion(hitRegion,type,crossing,4,p);
698 gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
699 GetMat(t,inode,vpt,m);
702 if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
707 int MaxEggPlugin::Display(TimeValue t, INode* inode, ViewExp *vpt,
int flags)
713 GetMat(t,inode,vpt,m);
715 DWORD rlim = gw->getRndLimits();
716 gw->setRndLimits(GW_WIREFRAME|GW_BACKCULL);
717 if (inode->Selected())
718 gw->setColor( LINE_COLOR, GetSelColor());
719 else if(!inode->IsFrozen())
720 gw->setColor( LINE_COLOR, GetUIColor(COLOR_TAPE_OBJ));
721 mesh.render( gw, mtl, NULL, COMP_ALL);
725 RefResult MaxEggPlugin::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message )
731 ObjectState MaxEggPlugin::Eval(TimeValue time)
733 return ObjectState(
this);
736 Interval MaxEggPlugin::ObjectValidity(TimeValue t)
739 ivalid.SetInfinite();
743 RefTargetHandle MaxEggPlugin::Clone(RemapDir& remap)
753 IOResult MaxEggPlugin::Save(ISave *isave) {
755 for (
int i = 0; i < numEggs; i++)
756 eggList[i]->Save(isave);
757 ChunkSave(isave, CHUNK_OVERWRITE_FLAG, autoOverwrite);
758 ChunkSave(isave, CHUNK_PVIEW_FLAG, pview);
759 ChunkSave(isave, CHUNK_LOG_OUTPUT, logOutput);
764 IOResult MaxEggPlugin::Load(ILoad *iload) {
765 IOResult res = iload->OpenChunk();
768 while (res == IO_OK) {
769 switch(iload->CurChunkID()) {
770 case CHUNK_OVERWRITE_FLAG: autoOverwrite = ChunkLoadBool(iload);
break;
771 case CHUNK_PVIEW_FLAG: pview = ChunkLoadBool(iload);
break;
772 case CHUNK_LOG_OUTPUT: logOutput = ChunkLoadBool(iload);
break;
773 case CHUNK_EGG_EXP_OPTIONS:
775 temp->SetMaxInterface(iObjParams);
781 res = iload->OpenChunk();
793 extern ClassDesc* GetMaxEggPluginDesc();
796 int controlsInit = FALSE;
804 BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
806 hInstance = hinstDLL;
811 #if MAX_VERSION_MAJOR < 14 815 InitCustomControls(hInstance);
817 InitCommonControls();
825 __declspec( dllexport )
const TCHAR* LibDescription()
827 return GetString(IDS_LIBDESCRIPTION);
832 __declspec( dllexport )
int LibNumberClasses()
838 __declspec( dllexport ) ClassDesc* LibClassDesc(
int i)
841 case 0:
return GetMaxEggPluginDesc();
842 default:
return NULL;
849 __declspec( dllexport ) ULONG LibVersion()
851 return VERSION_3DSMAX;
854 TCHAR *GetString(
int id)
856 static TCHAR buf[256];
859 return LoadString(hInstance,
id, buf,
sizeof(buf)) ? buf : NULL;
bool convert(MaxEggOptions *options)
Fills up the egg_data structure according to the global Max model data.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
Defines the way an object appears in the presence of lighting.
This class supervises the construction of an EggData structure from a Max model.