Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
w3dutil.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/* $Header: /Commando/Code/Tools/max2w3d/w3dutil.cpp 45 8/21/01 10:28a Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/w3dutil.cpp $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 8/21/01 9:41a $*
31 * *
32 * $Revision:: 45 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38
39#include "w3dutil.h"
40#include "w3ddesc.h"
41#include "rcmenu.h"
42#include "util.h"
43#include "nodelist.h"
44#include "tchar.h"
45#include "gamemtl.h"
46#include "notify.h"
47#include "gennamesdialog.h"
48#include "genmtlnamesdialog.h"
50#include "floaterdialog.h"
51#include <StdMat.h>
52
53
54#define DAZZLE_SETTINGS_FILENAME "dazzle.ini"
55#define DAZZLE_TYPES_SECTION "Dazzles_List"
56#define DAZZLE_SECTION_BUFFERSIZE 32767
57
58
59static BOOL CALLBACK _settings_form_dlg_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
60static BOOL CALLBACK _w3d_utility_tools_dlg_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
61
62static VisibleSelectedINodeFilter _INodeFilter;
63
64
65/**********************************************************************************************
66**
67** MaterialReferenceMaker - Class to support Export Utilities in the W3D Tools panel.
68**
69**********************************************************************************************/
70class MaterialReferenceMaker : public ReferenceMaker
71{
72 public:
73
74 ~MaterialReferenceMaker() {DeleteAllRefs();}
75
76 virtual int NumRefs();
77 virtual RefTargetHandle GetReference (int i);
78 virtual void SetReference (int i, RefTargetHandle rtarg);
79 RefResult NotifyRefChanged (Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message);
80
82 static int ReferenceCount;
83};
84
89
91{
92 assert (i < ReferenceCount);
93 return (MaterialPtr);
94}
95
96void MaterialReferenceMaker::SetReference (int i, RefTargetHandle rtarg)
97{
98 assert (i < ReferenceCount);
99 MaterialPtr = (Mtl*) rtarg;
100}
101
102RefResult MaterialReferenceMaker::NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message)
103{
104 return (REF_SUCCEED);
105}
106
108
109
110/**********************************************************************************************
111**
112** SettingsFormClass - code for the W3DUTILITY_SETTINGS_DIALOG. Used in the command panel
113** and in the floating settings dialog.
114**
115**********************************************************************************************/
117{
118public:
119
120 SettingsFormClass(HWND hwnd);
121 ~SettingsFormClass(void);
122
123 bool Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM);
124 void Selection_Changed(void);
125
126 static void Update_All_Instances(void);
127
128private:
129
130 void Init(void);
131 void Destroy(void);
132 void Disable_Controls(void);
133 void Update_Controls(INodeListClass * nodelist = NULL);
134
135 HWND Hwnd;
136 ISpinnerControl * RegionSpin;
137 SettingsFormClass * Next;
138
139 static SettingsFormClass * ActiveList;
140
141};
142
143
144/**********************************************************************************************
145**
146** W3DUtilityClass - Utility plugin which presents windows controls for setting all of
147** the W3D export options for the currently selected nodes
148**
149**********************************************************************************************/
150class W3DUtilityClass : public UtilityObj
151{
152public:
153
156
157 void BeginEditParams(Interface *ip,IUtil *iu);
158 void EndEditParams(Interface *ip,IUtil *iu);
159 void SelectionSetChanged(Interface *ip,IUtil *iu);
160 void DeleteThis() {}
161
162 void Select_Hierarchy(void);
163 void Select_Geometry(void);
164 void Select_Alpha(void);
165 void Select_Physical(void);
166 void Select_Projectile(void);
167 void Select_Vis(void);
168
169public:
170
171 Interface * InterfacePtr;
176
180
182
183 enum {
184 NONE = 0,
195 };
196
202
232
233 /*
234 ** Evaluate the status of nodes in the given list
235 */
236 static int eval_tri_state(int totalcount,int oncount);
237 static void eval_node_states(INodeListClass * node_list,NodeStatesStruct * ns);
238
239 /*
240 ** Update the controls in any active settings panels
241 */
242 static void update_settings_controls(INodeListClass * node_list = NULL);
243
244 /*
245 ** Modify the state of all selected nodes
246 */
247 static void set_hierarchy_in_all_selected(INodeListClass * list,bool onoff);
248 static void set_geometry_in_all_selected(INodeListClass * list,bool onoff);
249 static void enable_hidden_in_all_selected(INodeListClass * list,bool onoff);
250 static void enable_two_sided_in_all_selected(INodeListClass * list,bool onoff);
251 static void enable_znormals_in_all_selected(INodeListClass * list,bool onoff);
252 static void enable_vertex_alpha_in_all_selected(INodeListClass * list,bool onoff);
253 static void enable_shadow_in_all_selected(INodeListClass * list,bool onoff);
254 static void enable_shatterable_in_all_selected(INodeListClass * list,bool onoff);
255 static void enable_npatches_in_all_selected(INodeListClass * list,bool onoff);
256 static void enable_physical_collision_in_all_selected(INodeListClass * list,bool onoff);
257 static void enable_projectile_collision_in_all_selected(INodeListClass * list,bool onoff);
258 static void enable_vis_collision_in_all_selected(INodeListClass * list,bool onoff);
259 static void enable_camera_collision_in_all_selected(INodeListClass * list,bool onoff);
260 static void enable_vehicle_collision_in_all_selected(INodeListClass * list,bool onoff);
261
262 static void set_geometry_type_in_all_selected(INodeListClass * list,int geotype);
263 static void set_dazzle_type_in_all_selected(INodeListClass * list,char * dazzletype);
264
265 static void set_region_in_all_selected(INodeListClass * list,char region);
266
267 /*
268 ** Functions used by the tools rollup in the command panel
269 */
270 void descend_tree(INode * node,int action);
271 void hide_node(INode * node);
272 void select_geometry_node(INode * node);
273 void select_hierarchy_node(INode * node);
274 void select_alpha_node(INode * node);
275 void select_physical_node(INode * node);
276 void select_projectile_node(INode * node);
277 void select_vis_node(INode * node);
278 bool is_alpha_material(Mtl * nodemtl);
279 bool is_alpha_mesh(INode * node,Mtl * nodemtl);
280
281 void generate_names(void);
282 void generate_node_name(INode * node);
283 void generate_material_names(void);
284 void generate_material_names_for_node(INode * node);
285 void generate_material_names(Mtl * mtl);
286 void generate_lod_extensions(void);
287 void generate_lod_ext(INode * node);
288
289 void create_floater(void);
290
292 int convert_materials (MaterialConversionEnum conversion, MaterialReferenceMaker *gamenodematerials);
293 StdMat * new_standard_material (GameMtl *gamemtl);
294
295 static W3DAppData0Struct * get_app_data_0(INode * node);
296 static W3DAppData1Struct * get_app_data_1(INode * node);
297 static W3DAppData2Struct * get_app_data_2(INode * node);
298 static W3DDazzleAppDataStruct * get_dazzle_app_data(INode * node);
299};
300
301static W3DUtilityClass TheW3DUtility;
302
303
304/**********************************************************************************************
305**
306** W3DUtilityClassDesc - Class Descriptor for the W3D Utility
307**
308**********************************************************************************************/
309class W3DUtilityClassDesc:public ClassDesc
310{
311public:
312
313 int IsPublic() { return 1; }
314 void * Create(BOOL loading = FALSE) { return &TheW3DUtility; }
316 SClass_ID SuperClassID() { return UTILITY_CLASS_ID; }
317 Class_ID ClassID() { return W3DUtilityClassID; }
318 const TCHAR* Category() { return Get_String(IDS_W3DMENU_CATEGORY); }
319};
320
321static W3DUtilityClassDesc W3DUtilityDesc;
322
323ClassDesc * Get_W3D_Utility_Desc(void)
324{
325 return &W3DUtilityDesc;
326}
327
328/**********************************************************************************************
329**
330** W3DUtilityClass Implementation
331**
332**********************************************************************************************/
340
344
345void W3DUtilityClass::BeginEditParams(Interface *ip,IUtil *iu)
346{
347 InterfacePtr = ip;
348
349 SettingsPanelHWND = InterfacePtr->AddRollupPage(
351 MAKEINTRESOURCE(IDD_W3DUTILITY_SETTINGS_DIALOG),
352 _settings_form_dlg_proc,
354 0);
355
356 ToolsPanelHWND = InterfacePtr->AddRollupPage(
358 MAKEINTRESOURCE(IDD_W3DUTILITY_TOOLS_DIALOG),
359 _w3d_utility_tools_dlg_proc,
361 0);
362
363
364// TheRCMenu.Bind(TheW3DUtility.InterfacePtr,&TheW3DUtility);
365// RightClickMenuManager *rcm = ip->GetRightClickMenuManager();
366// if (TheRCMenu.Installed!=TRUE) {
367// rcm->Register(&TheRCMenu);
368// }
369
371}
372
373void W3DUtilityClass::EndEditParams(Interface *ip,IUtil *iu)
374{
376
377 ip->DeleteRollupPage(SettingsPanelHWND);
378 ip->DeleteRollupPage(ToolsPanelHWND);
379
382}
383
384void W3DUtilityClass::SelectionSetChanged(Interface *ip,IUtil *iu)
385{
386 // (gth) the settings panels which need to respond to the selection set changing
387 // are now registered directly with MAX and don't need to be updated here
388 // update_dialog();
389}
390
391int W3DUtilityClass::eval_tri_state(int totalcount,int oncount)
392{
393 if (oncount == 0) {
394 return 0;
395 }
396 if (oncount == totalcount) {
397 return 1;
398 }
399 return 2;
400}
401
403{
404 // initialize the counters and booleans
405 ns->ExportHierarchy = 0;
406 ns->ExportGeometry = 0;
407 ns->GeometryHidden = 0;
408 ns->GeometryTwoSided = 0;
409 ns->GeometryZNormals = 0;
410 ns->GeometryVertexAlpha = 0;
411 ns->GeometryCastShadow = 0;
412 ns->GeometryShatterable = 0;
413 ns->GeometryNPatch = 0;
414 ns->CollisionPhysical = 0;
415 ns->CollisionProjectile = 0;
416 ns->CollisionVis = 0;
417 ns->CollisionCamera = 0;
418 ns->CollisionVehicle = 0;
419
420 ns->GeometryCameraAligned = false;
421 ns->GeometryCameraOriented = false;
422 ns->GeometryNormal = false;
423 ns->GeometryAABox = false;
424 ns->GeometryOBBox = false;
425 ns->GeometryNull = false;
426 ns->GeometryDazzle = false;
427 ns->GeometryAggregate = false;
428
429 /*
430 ** ns->DamageRegion will be MAX_DAMAGE_REGIONS if not all
431 ** of the selected nodes are in the same damage region. If
432 ** they are, then ns->DamageRegion will be the region they
433 ** share.
434 */
435 if (list->Num_Nodes() > 0)
436 {
437 // Use the first damage region for comparing to the others.
438 W3DAppData1Struct *wdata = get_app_data_1((*list)[0]);
439 ns->DamageRegion = wdata->DamageRegion;
440 }
441 else
443
444 /*
445 ** ns->DazzleType will be DEFAULT if not all of the selected
446 ** nodes are the same. If they are the same, it will be the
447 ** dazzle type that they all share
448 */
449 ns->DazzleCount = 0;
450 if (list->Num_Nodes() > 0) {
451 W3DDazzleAppDataStruct * dazzledata = get_dazzle_app_data((*list)[0]);
452 strncpy(ns->DazzleType,dazzledata->DazzleType,sizeof(ns->DazzleType));
453 } else {
454 strcpy(ns->DazzleType,"DEFAULT");
455 }
456
457 /*
458 ** evaluate each node
459 */
460 for (unsigned int ni=0; ni<list->Num_Nodes(); ni++) {
461
462 W3DAppData2Struct * wdata = get_app_data_2((*list)[ni]);
463 assert(wdata);
464
465 ns->ExportHierarchy += (wdata->Is_Bone() ? 1 : 0);
466 ns->ExportGeometry += (wdata->Is_Geometry() ? 1 : 0);
467 ns->GeometryHidden += (wdata->Is_Hidden_Enabled() ? 1 : 0);
468 ns->GeometryTwoSided += (wdata->Is_Two_Sided_Enabled() ? 1 : 0);
469 ns->GeometryZNormals += (wdata->Is_ZNormals_Enabled() ? 1 : 0);
470 ns->GeometryVertexAlpha += (wdata->Is_Vertex_Alpha_Enabled() ? 1 : 0);
471 ns->GeometryCastShadow += (wdata->Is_Shadow_Enabled() ? 1 : 0);
472 ns->GeometryShatterable += (wdata->Is_Shatterable_Enabled() ? 1 : 0);
473 ns->GeometryNPatch += (wdata->Is_NPatchable_Enabled() ? 1 : 0);
474 ns->CollisionPhysical += (wdata->Is_Physical_Collision_Enabled() ? 1 : 0);
475 ns->CollisionProjectile += (wdata->Is_Projectile_Collision_Enabled() ? 1 : 0);
476 ns->CollisionVis += (wdata->Is_Vis_Collision_Enabled() ? 1 : 0);
477 ns->CollisionCamera += (wdata->Is_Camera_Collision_Enabled() ? 1 : 0);
478 ns->CollisionVehicle += (wdata->Is_Vehicle_Collision_Enabled() ? 1 : 0);
479
480 switch (wdata->Get_Geometry_Type()) {
484 case W3DAppData2Struct::GEO_TYPE_AABOX: ns->GeometryAABox = true; break;
485 case W3DAppData2Struct::GEO_TYPE_OBBOX: ns->GeometryOBBox = true; break;
486 case W3DAppData2Struct::GEO_TYPE_NULL: ns->GeometryNull = true; break;
489 }
490
491 // Compare this damage region to our existing one. If it's not the same,
492 // use MAX_DAMAGE_REGION (an invalid value) as a sentinel value.
494 {
495 W3DAppData1Struct *wdata1 = get_app_data_1((*list)[ni]);
496 assert(wdata1);
497 if (wdata1->DamageRegion != ns->DamageRegion)
499 }
500
501 // compare this objects dazzle type to our existing one. If its not
502 // the same, use 'DEFAULT'.
503 W3DDazzleAppDataStruct * dazzledata = get_dazzle_app_data((*list)[ni]);
504 if (strcmp(ns->DazzleType,dazzledata->DazzleType) != 0) {
505 strcpy(ns->DazzleType,"DEFAULT");
506 }
507 }
508
509 // If any of the counters are zero, that means none of the objects had that
510 // bit set. If any of them are equal to the number of objects, then they
511 // all had that bit set. Otherwise, there was a mix and we should use the
512 // third state for the checkbox (greyed out check).
513 int count = list->Num_Nodes();
525 ns->CollisionVis = eval_tri_state(count, ns->CollisionVis);
528
529}
530
535
537{
538 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
539 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
540 wdata->Enable_Export_Transform(onoff);
541 }
542 update_settings_controls(node_list);
543}
544
546{
547 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
548 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
549 wdata->Enable_Export_Geometry(onoff);
550 }
551 update_settings_controls(node_list);
552}
553
555{
556 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
557 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
558 wdata->Enable_Hidden(onoff);
559 }
560 update_settings_controls(node_list);
561}
562
564{
565 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
566 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
567 wdata->Enable_Two_Sided(onoff);
568 }
569 update_settings_controls(node_list);
570}
571
573{
574 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
575 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
576 wdata->Enable_ZNormals(onoff);
577 }
578 update_settings_controls(node_list);
579}
580
582{
583 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
584 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
585 wdata->Enable_Vertex_Alpha(onoff);
586 }
587 update_settings_controls(node_list);
588}
589
591{
592 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
593 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
594 wdata->Enable_Shadow(onoff);
595 }
596 update_settings_controls(node_list);
597}
598
600{
601 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
602 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
603 wdata->Enable_Shatterable(onoff);
604 }
605 update_settings_controls(node_list);
606}
607
609{
610 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
611 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
612 wdata->Enable_NPatchable(onoff);
613 }
614 update_settings_controls(node_list);
615}
616
618{
619 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
620 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
621 wdata->Enable_Physical_Collision(onoff);
622 }
623 update_settings_controls(node_list);
624}
625
627{
628 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
629 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
630 wdata->Enable_Projectile_Collision(onoff);
631 }
632 update_settings_controls(node_list);
633}
634
636{
637 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
638 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
639 wdata->Enable_Vis_Collision(onoff);
640 }
641 update_settings_controls(node_list);
642}
643
645{
646 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
647 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
648 wdata->Enable_Camera_Collision(onoff);
649 }
650 update_settings_controls(node_list);
651}
652
654{
655 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
656 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
657 wdata->Enable_Vehicle_Collision(onoff);
658 }
659 update_settings_controls(node_list);
660}
661
663{
664 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
665 W3DAppData2Struct * wdata = get_app_data_2((*node_list)[ni]);
667 }
668 update_settings_controls(node_list);
669}
670
672{
673 for (unsigned int ni=0; ni<node_list->Num_Nodes(); ni++) {
674 W3DDazzleAppDataStruct * dazzledata = get_dazzle_app_data((*node_list)[ni]);
675 strncpy(dazzledata->DazzleType,dazzle_type,sizeof(dazzledata->DazzleType) - 1);
676 }
677 update_settings_controls(node_list);
678}
679
681{
682 if (list->Num_Nodes() == 0) return;
683
684 // Damage regions are stored in each node's AppData1.
685 for (int i = 0; i < list->Num_Nodes(); i++)
686 {
687 W3DAppData1Struct *wdata = get_app_data_1((*list)[i]);
688 wdata->DamageRegion = region;
689 }
691}
692
694{
696 bool retval = dialog.Get_Options(&NameOptions);
697 WorkingNameIndex = NameOptions.NameIndex;
698
699 if (retval) {
701 }
702}
703
705{
707 bool retval = dialog.Get_Options(&MtlNameOptions);
709
710 if (retval) {
712 }
713}
714
716{
718 bool retval = dialog.Get_Options(&LodExtensionOptions);
719
720 if (retval) {
722 }
723}
724
726{
727 /*
728 ** Only works on selected nodes.
729 */
730 if (!node->Selected())
731 return;
732
733 /*
734 ** If this node already has an LOD extension, we'll replace it
735 ** with the new LOD index. Otherwise we'll tack it on the end.
736 ** Display a error message if the name is too long to append
737 ** the extension, and skip the node without changing the name.
738 */
739 char msg[256];
740 char newname[W3D_NAME_LEN];
741 char *oldname = node->GetName();
742 char *ext = strrchr(oldname, '.');
743 int old_lod;
744 if ( (ext != NULL) && (sscanf(ext, ".%d", &old_lod) == 1) )
745 {
746 /*
747 ** An existing LOD index. If it's different than the new
748 ** one, replace it.
749 */
750 if (old_lod == LodExtensionOptions.LodIndex)
751 return; // same lod index
752
753 /*
754 ** Room for the new extension? (2 because when we export, the extension will,
755 ** be replaced by a single character [A..Z] to indicate the LOD level.
756 ** ie. 2==strlen("A")+1)
757 */
758 if (ext - oldname + 2 <= W3D_NAME_LEN)
759 {
760 *ext = '\0';
761 sprintf(newname, "%s.%02d", oldname, LodExtensionOptions.LodIndex);
762 *ext = '.';
763 node->SetName(newname);
764 }
765 else
766 {
767 *ext = '\0';
768 sprintf(msg, "The maximum W3D object name is %d characters. Adding the LOD "
769 "extension to \"%s\" will pass this limit! Please shorten its name.",
770 W3D_NAME_LEN - 1, oldname);
771 *ext = '.';
772 MessageBox(NULL, msg, "Error", MB_OK);
773 }
774 }
775 else
776 {
777 /*
778 ** Room for the new extension? (2 because when we export, the extension will,
779 ** be replaced by a single character [A..Z] to indicate the LOD level.
780 ** ie. 2==strlen("A")+1)
781 */
782 if (strlen(oldname) + 2 <= W3D_NAME_LEN)
783 {
784 sprintf(newname, "%s.%02d", oldname, LodExtensionOptions.LodIndex);
785 node->SetName(newname);
786 }
787 else
788 {
789 sprintf(msg, "The maximum W3D object name is %d characters. Adding the LOD "
790 "extension to \"%s\" will pass this limit! Please shorten its name.",
791 W3D_NAME_LEN - 1, oldname);
792 MessageBox(NULL, msg, "Error", MB_OK);
793 }
794 }
795}
796
802
804{
805 char *convertingmessage = "Converting materials...";
806
807 // Count the no. of references to game materials.
809
810 MaterialReferenceMaker *gamenodematerials = NULL;
811
814 assert (gamenodematerials != NULL);
815 }
816
817 InterfacePtr->PushPrompt (convertingmessage);
818 SetCursor (LoadCursor (NULL, IDC_WAIT));
819 convert_materials (GAME_TO_STANDARD, gamenodematerials);
820 InterfacePtr->PopPrompt();
821 InterfacePtr->FileExport();
822 UpdateWindow (InterfacePtr->GetMAXHWnd());
823 InterfacePtr->PushPrompt (convertingmessage);
824 SetCursor (LoadCursor (NULL, IDC_WAIT));
825 convert_materials (STANDARD_TO_GAME, gamenodematerials);
826 InterfacePtr->PopPrompt();
827
828 // Clean-up.
829 if (gamenodematerials != NULL) delete [] gamenodematerials;
830}
831
833{
834 int gamenodematerialindex = 0;
835
836 INode *rootnode = InterfacePtr->GetRootNode();
837 if (rootnode != NULL) {
838
839 INodeListClass *meshlist = new INodeListClass (rootnode, 0);
840 if (meshlist != NULL) {
841
842 for (unsigned nodeindex = 0; nodeindex < meshlist->Num_Nodes(); nodeindex++) {
843
844 Mtl *nodemtl = ((*meshlist) [nodeindex])->GetMtl();
845
846 // Is this a non-null material?
847 if (nodemtl != NULL) {
848
849 // Is this not a multi-material?
850 if (!nodemtl->IsMultiMtl()) {
851
852 switch (conversion) {
853
855 if (nodemtl->ClassID() == GameMaterialClassID) {
856 assert (((GameMtl*) nodemtl)->Substitute_Material() == NULL);
857 }
858 break;
859
860 case GAME_TO_STANDARD:
861
862 if (nodemtl->ClassID() == GameMaterialClassID) {
863
864 // Make a reference to the game material to ensure that it is not deleted by the system.
865 gamenodematerials [gamenodematerialindex].MakeRefByID (FOREVER, gamenodematerialindex, nodemtl);
866
867 // Does this material already have an equivalent standard material?
868 if (((GameMtl*) nodemtl)->Substitute_Material() == NULL) {
869 ((GameMtl*) nodemtl)->Set_Substitute_Material (new_standard_material ((GameMtl*) nodemtl));
870 }
871 ((*meshlist) [nodeindex])->SetMtl (((GameMtl*) nodemtl)->Substitute_Material());
872
873 } else {
874 gamenodematerials [gamenodematerialindex].MaterialPtr = NULL;
875 }
876 break;
877
878 case STANDARD_TO_GAME:
879
880 // Change materials to game materials if they were previously game materials before being
881 // converted to standard materials.
882 if (gamenodematerials [gamenodematerialindex].MaterialPtr != NULL) {
883 ((*meshlist) [nodeindex])->SetMtl (gamenodematerials [gamenodematerialindex].MaterialPtr);
884 ((GameMtl*) gamenodematerials [gamenodematerialindex].MaterialPtr)->Set_Substitute_Material (NULL);
885 }
886 break;
887 }
888 gamenodematerialindex++;
889
890 } else {
891
892 // For each sub-material...
893 for (int materialindex = 0; materialindex < nodemtl->NumSubMtls(); materialindex++) {
894
895 Mtl *submaterial = nodemtl->GetSubMtl (materialindex);
896
897 // Is this a non-null submaterial?
898 if (submaterial != NULL) {
899
900 switch (conversion) {
901
903 if (submaterial->ClassID() == GameMaterialClassID) {
904 assert (((GameMtl*) submaterial)->Substitute_Material() == NULL);
905 }
906 break;
907
908 case GAME_TO_STANDARD:
909
910 if (submaterial->ClassID() == GameMaterialClassID) {
911
912 // Make a reference to the game material to ensure that it is not deleted by the system.
913 gamenodematerials [gamenodematerialindex].MakeRefByID (FOREVER, gamenodematerialindex, submaterial);
914
915 // Does this material already have an equivalent standard material?
916 if (((GameMtl*) submaterial)->Substitute_Material() == NULL) {
917 ((GameMtl*) submaterial)->Set_Substitute_Material (new_standard_material ((GameMtl*) submaterial));
918 }
919 nodemtl->SetSubMtl (materialindex, ((GameMtl*) submaterial)->Substitute_Material());
920
921 } else {
922 gamenodematerials [gamenodematerialindex].MaterialPtr = NULL;
923 }
924 break;
925
926 case STANDARD_TO_GAME:
927
928 // Change materials to game materials if they were previously game materials before being
929 // converted to standard materials.
930 if (gamenodematerials [gamenodematerialindex].MaterialPtr != NULL) {
931 nodemtl->SetSubMtl (materialindex, gamenodematerials [gamenodematerialindex].MaterialPtr);
932 ((GameMtl*) gamenodematerials [gamenodematerialindex].MaterialPtr)->Set_Substitute_Material (NULL);
933 }
934 break;
935 }
936 gamenodematerialindex++;
937 }
938 }
939 }
940 }
941 }
942
943 // Clean-up.
944 delete meshlist;
945 }
946 }
947
948 return (gamenodematerialindex);
949}
950
952{
953 Color emissive;
954
955 // Create a new standard material.
956 StdMat *stdmtl = NewDefaultStdMat();
957
958 // Set its properties by translating the supplied game material.
959 // NOTE 0: Only consider pass 0 in the game material - ignore all other passes.
960 // NOTE 1: Use defaults for all standard material attributes that cannot be
961 // converted from the game material in a meaningful way.
962 stdmtl->SetName (gamemtl->GetName());
963 stdmtl->SetAmbient (gamemtl->GetAmbient(), 0);
964 stdmtl->SetDiffuse (gamemtl->GetDiffuse(), 0);
965 stdmtl->SetSpecular (gamemtl->GetSpecular(), 0);
966 stdmtl->SetOpacity (gamemtl->Get_Opacity (0, 0), 0);
967 stdmtl->SetShininess (gamemtl->Get_Shininess (0, 0), 0);
968 stdmtl->SetShinStr (gamemtl->GetShinStr(), 0);
969 stdmtl->SetSubTexmap (ID_DI, gamemtl->Get_Texture (0, 0));
970 emissive = gamemtl->Get_Emissive (0, 0);
971 stdmtl->SetSelfIllum ((emissive.r + emissive.g + emissive.b) / 3.0f, 0);
972
973 return (stdmtl);
974}
975
977{
978 InterfacePtr->SelectNode(NULL);
979 INode * root = InterfacePtr->GetRootNode();
981 InterfacePtr->ForceCompleteRedraw();
982}
983
985{
986 InterfacePtr->SelectNode(NULL);
987 INode * root = InterfacePtr->GetRootNode();
989 InterfacePtr->ForceCompleteRedraw();
990}
991
993{
994 InterfacePtr->SelectNode(NULL);
995 INode * root = InterfacePtr->GetRootNode();
997 InterfacePtr->ForceCompleteRedraw();
998}
999
1001{
1002 InterfacePtr->SelectNode(NULL);
1003 INode * root = InterfacePtr->GetRootNode();
1005 InterfacePtr->ForceCompleteRedraw();
1006}
1007
1009{
1010 InterfacePtr->SelectNode(NULL);
1011 INode * root = InterfacePtr->GetRootNode();
1013 InterfacePtr->ForceCompleteRedraw();
1014}
1015
1017{
1018 InterfacePtr->SelectNode(NULL);
1019 INode * root = InterfacePtr->GetRootNode();
1021 InterfacePtr->ForceCompleteRedraw();
1022}
1023
1024void W3DUtilityClass::descend_tree(INode * node,int func)
1025{
1026 if (!node) return;
1027
1028 switch (func)
1029 {
1030 case HIDE:
1031 hide_node(node);
1032 break;
1033
1034 case SELECT_GEOM:
1036 break;
1037
1038 case SELECT_HIER:
1040 break;
1041
1042 case SELECT_ALPHA:
1043 select_alpha_node(node);
1044 break;
1045
1046 case SELECT_PHYSICAL:
1048 break;
1049
1050 case SELECT_PROJECTILE:
1052 break;
1053
1054 case SELECT_VIS:
1055 select_vis_node(node);
1056 break;
1057
1058 case GENERATE_NAME:
1059 generate_node_name(node);
1060 break;
1061
1064 break;
1065
1067 generate_lod_ext(node);
1068 break;
1069
1070 default:
1071 break;
1072 };
1073
1074 for (int i=0; i<node->NumberOfChildren(); i++) {
1075 INode * child = node->GetChildNode(i);
1076 descend_tree(child,func);
1077 }
1078}
1079
1081{
1082 if (!node->IsHidden()) node->Hide(TRUE);
1083 InterfacePtr->NodeInvalidateRect(node);
1084}
1085
1087{
1088 if (Is_Geometry(node) && !node->IsHidden()) {
1089 InterfacePtr->SelectNode(node,0);
1090 }
1091}
1092
1094{
1095 if (Is_Bone(node) && !node->IsHidden()) {
1096 InterfacePtr->SelectNode(node,0);
1097 }
1098}
1099
1101{
1102 if (node->IsHidden() || !Is_Geometry(node)) {
1103 return;
1104 }
1105
1106 Mtl * nodemtl = node->GetMtl();
1107 if (is_alpha_material(nodemtl)) {
1108 if (is_alpha_mesh(node,nodemtl)) {
1109 InterfacePtr->SelectNode(node,0);
1110 }
1111 }
1112}
1113
1115{
1116 if (!node->IsHidden() && Is_Geometry(node) && Is_Physical_Collision(node)) {
1117 InterfacePtr->SelectNode(node,0);
1118 }
1119}
1120
1122{
1123 if (!node->IsHidden() && Is_Geometry(node) && Is_Projectile_Collision(node)) {
1124 InterfacePtr->SelectNode(node,0);
1125 }
1126}
1127
1129{
1130 if (!node->IsHidden() && Is_Geometry(node) && Is_Vis_Collision(node)) {
1131 InterfacePtr->SelectNode(node,0);
1132 }
1133}
1134
1136{
1137 if (nodemtl == NULL) {
1138 return false;
1139 }
1140
1141 bool is_alpha = false;
1142 if (nodemtl->IsMultiMtl()) {
1143 for (int mi=0; mi<nodemtl->NumSubMtls(); mi++) {
1144 is_alpha |= is_alpha_material(nodemtl->GetSubMtl(mi));
1145 }
1146 } else {
1147 if (nodemtl->ClassID() == GameMaterialClassID) {
1148 GameMtl * gamemtl = (GameMtl *)nodemtl;
1149
1150 if ( (gamemtl->Get_Dest_Blend(0) == W3DSHADER_DESTBLENDFUNC_SRC_ALPHA) ||
1155 {
1156 is_alpha = true;
1157 }
1158 }
1159 }
1160 return is_alpha;
1161}
1162
1163bool W3DUtilityClass::is_alpha_mesh(INode * node,Mtl * nodemtl)
1164{
1165 Object * obj = node->EvalWorldState(0).obj;
1166 TriObject * tri = (TriObject *)obj->ConvertToType(0, triObjectClassID);
1167
1168 if (tri != NULL) {
1169 Mesh & mesh = tri->mesh;
1170
1171 int face_index;
1172 int mat_index;
1173
1174 if (nodemtl == NULL) {
1175
1176 return false;
1177
1178 } else if (nodemtl->NumSubMtls() <= 1) {
1179
1180 return is_alpha_material(nodemtl);
1181
1182 } else {
1183
1184 int sub_mtl_count = nodemtl->NumSubMtls();
1185 bool * sub_mtl_flags = new bool[sub_mtl_count];
1186
1187 // Initialize each sub-material flag to false (indicates that the material is un-used)
1188 for (mat_index=0; mat_index<sub_mtl_count; mat_index++) {
1189 sub_mtl_flags[mat_index] = false;
1190 }
1191
1192 // Set a true for each material actually referenced by the mesh
1193 for (face_index=0; face_index<mesh.getNumFaces(); face_index++) {
1194 int max_mat_index = mesh.faces[face_index].getMatID();
1195 int mat_index = (max_mat_index % sub_mtl_count);
1196 sub_mtl_flags[mat_index] = true;
1197 }
1198
1199 // Loop over the used materials and return true if any are alpha materials
1200 for (mat_index=0; mat_index<sub_mtl_count; mat_index++) {
1201 if (sub_mtl_flags[mat_index]) {
1202 if (is_alpha_material(nodemtl->GetSubMtl(mat_index))) {
1203 return true;
1204 }
1205 }
1206 }
1207 }
1208 }
1209 return false;
1210}
1211
1213{
1214 TCHAR temp_string[256];
1215
1216 if (NameOptions.OnlyAffectSelected && !node->Selected()) {
1217 return;
1218 }
1219
1220 if (!Is_Bone(node) && !Is_Geometry(node)) {
1221 return;
1222 }
1223
1224 if (NameOptions.AssignNames) {
1225 _stprintf(temp_string,"%s%03d",NameOptions.RootName,WorkingNameIndex);
1226 node->SetName(temp_string);
1228 }
1229
1230 if (NameOptions.AssignPrefix) {
1231 _stprintf(temp_string,"%s%s",NameOptions.PrefixName,node->GetName());
1232 node->SetName(temp_string);
1233 }
1234
1235 if (NameOptions.AssignSuffix) {
1236 _stprintf(temp_string,"%s%s",node->GetName(),NameOptions.SuffixName);
1237 node->SetName(temp_string);
1238 }
1239
1240 if (NameOptions.AssignCollisionBits) {
1241
1243 assert(wdata);
1244
1245 wdata->Enable_Physical_Collision(NameOptions.PhysicalCollision);
1246 wdata->Enable_Projectile_Collision(NameOptions.ProjectileCollision);
1247 wdata->Enable_Vis_Collision(NameOptions.VisCollision);
1248 wdata->Enable_Camera_Collision(NameOptions.CameraCollision);
1249 wdata->Enable_Vehicle_Collision(NameOptions.VehicleCollision);
1250 }
1251}
1252
1254{
1255 if (MtlNameOptions.OnlyAffectSelected && !node->Selected()) {
1256 return;
1257 }
1258 generate_material_names(node->GetMtl());
1259}
1260
1262{
1263 if (mtl == NULL) {
1264 return;
1265 }
1266
1267 // set the name of this material and increment the index
1269 _stprintf(newname,"%s%03d",MtlNameOptions.RootName,WorkingNameIndex);
1270 mtl->SetName(newname);
1272
1273 // recurse into children
1274 if (mtl->IsMultiMtl()) {
1275 for (int mi=0; mi<mtl->NumSubMtls(); mi++) {
1276 generate_material_names(mtl->GetSubMtl(mi));
1277 }
1278 }
1279}
1280
1281
1283{
1284 /*
1285 ** Try to get our AppData which has the export flags
1286 */
1287 W3DAppData0Struct * wdata = NULL;
1288 AppDataChunk * appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,0);
1289
1290 /*
1291 ** If there wasn't one, return NULL since this app data chunk is obsolete now.
1292 ** If there was one, get the data from it
1293 */
1294 if (appdata) {
1295 wdata = (W3DAppData0Struct *)(appdata->data);
1296 }
1297
1298 return wdata;
1299}
1300
1301
1303{
1304 // Try to get our AppData which has the damage region
1305 W3DAppData1Struct * wdata = NULL;
1306 AppDataChunk * appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,1);
1307
1308 // If there wasn't one, add one. If there was one, get the data from it
1309 if (appdata) {
1310 wdata = (W3DAppData1Struct *)(appdata->data);
1311 } else {
1312 wdata = new W3DAppData1Struct;
1313 node->AddAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,1,sizeof(W3DAppData1Struct),wdata);
1314
1315 appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,1);
1316 assert(appdata);
1317 }
1318
1319 return wdata;
1320}
1321
1322
1327
1328
1333
1334
1335/**********************************************************************************************
1336**
1337** Dialog procs for the W3DUtilityClass
1338**
1339**********************************************************************************************/
1340static BOOL CALLBACK _w3d_utility_tools_dlg_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
1341{
1342 switch (msg) {
1343
1344 case WM_LBUTTONDOWN:
1345 case WM_LBUTTONUP:
1346 case WM_MOUSEMOVE:
1347 TheW3DUtility.InterfacePtr->RollupMouseMessage(hWnd,msg,wParam,lParam);
1348 break;
1349
1350 case WM_COMMAND:
1351 {
1352 switch (LOWORD(wParam))
1353 {
1354 /*
1355 ** Buttons
1356 */
1358 TheW3DUtility.Select_Geometry();
1359 break;
1360
1362 TheW3DUtility.Select_Hierarchy();
1363 break;
1364
1366 TheW3DUtility.Select_Alpha();
1367 break;
1368
1370 TheW3DUtility.Select_Physical();
1371 break;
1372
1374 TheW3DUtility.Select_Projectile();
1375 break;
1376
1377 case IDC_SELECT_VIS:
1378 TheW3DUtility.Select_Vis();
1379 break;
1380
1382 TheW3DUtility.generate_names();
1383 TheW3DUtility.update_settings_controls();
1384 break;
1385
1387 TheW3DUtility.generate_material_names();
1388 TheW3DUtility.update_settings_controls();
1389 break;
1390
1392 TheW3DUtility.generate_lod_extensions();
1393 TheW3DUtility.update_settings_controls();
1394 break;
1395
1397 TheW3DUtility.export_with_standard_materials();
1398 break;
1399
1401 TheW3DUtility.create_floater();
1402 break;
1403 }
1404 return TRUE;
1405 }
1406
1407 default:
1408 return FALSE;
1409 }
1410 return TRUE;
1411}
1412
1413
1414
1415/**********************************************************************************************
1416**
1417** SettingsFormClass Implementation
1418** NOTE: When you use the _settings_form_dlg_proc, a SettingsFormClass will automatically
1419** be allocated and attached to the dialog. You can cause all of the active forms to
1420** refresh their status by calling Update_All_Instances. The forms will be destroyed when
1421** the window is destroyed.
1422**
1423**********************************************************************************************/
1424SettingsFormClass * SettingsFormClass::ActiveList = NULL;
1425
1426BOOL CALLBACK _settings_form_dlg_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
1427{
1428 if (msg == WM_INITDIALOG) {
1429 SettingsFormClass * form = new SettingsFormClass(hWnd);
1430 ::SetProp(hWnd,"SettingsFormClass",(HANDLE)form);
1431 }
1432
1433 SettingsFormClass * form = (SettingsFormClass *)::GetProp(hWnd,"SettingsFormClass");
1434 if (form) {
1435 return form->Dialog_Proc(hWnd,msg,wParam,lParam);
1436 } else {
1437 return FALSE;
1438 }
1439}
1440
1441static void _settings_form_selection_changed_callback(void * param,NotifyInfo * info)
1442{
1444}
1445
1447 Hwnd(hwnd),
1448 RegionSpin(NULL)
1449{
1450 /*
1451 ** Link into the active list
1452 */
1453 Next = ActiveList;
1454 ActiveList = this;
1455
1456 /*
1457 ** Register with MAX
1458 */
1459 ::RegisterNotification(_settings_form_selection_changed_callback, this, NOTIFY_SELECTIONSET_CHANGED);
1460}
1461
1463{
1464 /*
1465 ** Unregister from MAX
1466 */
1467 ::UnRegisterNotification(_settings_form_selection_changed_callback, this, NOTIFY_SELECTIONSET_CHANGED);
1468
1469 /*
1470 ** Unlink from the active list
1471 */
1472 if (ActiveList == this) {
1473 ActiveList = Next;
1474 } else {
1475
1476 SettingsFormClass * prev = ActiveList;
1477 SettingsFormClass * cur = ActiveList->Next;
1478
1479 while ((cur != this) && (cur != NULL)) {
1480 cur = cur->Next;
1481 prev = prev->Next;
1482 }
1483
1484 assert(cur == this);
1485 if (cur == this) {
1486 prev->Next = cur->Next;
1487 }
1488 }
1489
1490 Hwnd = NULL;
1491}
1492
1493
1495{
1496 if (ActiveList == NULL) {
1497 return;
1498 }
1499
1500 /*
1501 ** Build a list of the selected nodes
1502 */
1503 INodeListClass node_list( ::GetCOREInterface()->GetRootNode(),
1504 ::GetCOREInterface()->GetTime(),
1505 &_INodeFilter );
1506
1507 /*
1508 ** Update all settings forms
1509 */
1510 SettingsFormClass * form = ActiveList;
1511 while (form != NULL) {
1512 form->Update_Controls(&node_list);
1513 form = form->Next;
1514 }
1515}
1516
1517
1518void SettingsFormClass::Init(void)
1519{
1520 // Initialize the contents of the dazzle combo
1521 // Reset the dazzle combo
1522 HWND dazzle_combo = GetDlgItem(Hwnd,IDC_DAZZLE_COMBO);
1523 assert(dazzle_combo != NULL);
1524 SendMessage(dazzle_combo,CB_RESETCONTENT,0,0);
1525
1526 // Load the section of Dazzle.INI that defines all of the types. The windows function
1527 // that I'm using here, reads in a NULL-terminated string for each entry in the section. Each
1528 // string is of the form 'key=value'. Based on my testing, it appears that windows removes any white
1529 // space before or after the equal sign as well.
1530 char dllpath[_MAX_PATH];
1531 ::GetModuleFileName(AppInstance,dllpath,sizeof(dllpath));
1532 char * last_slash = strrchr(dllpath,'\\');
1533 last_slash++;
1534 strcpy(last_slash,DAZZLE_SETTINGS_FILENAME);
1535
1536 char * dazzle_types_buffer = new char[DAZZLE_SECTION_BUFFERSIZE]; // max size of a section for Win95
1537
1538 ::GetPrivateProfileSection( DAZZLE_TYPES_SECTION, dazzle_types_buffer, DAZZLE_SECTION_BUFFERSIZE, dllpath);
1539
1540 // Now we need to handle each string in the section buffer; skipping the 'key=' and adding
1541 // the dazzle type name into the combo box.
1542 char * entry = dazzle_types_buffer;
1543 if (entry != NULL) {
1544 while (*entry != NULL) {
1545 entry = strchr(entry,'=');
1546 if (entry != NULL) {
1547 entry++;
1548 ::SendMessage(dazzle_combo,CB_ADDSTRING,0,(LPARAM)entry);
1549 entry += strlen(entry) + 1;
1550 }
1551 }
1552 } else {
1553 ::SendMessage(dazzle_combo,CB_ADDSTRING,0,(LPARAM)"Default");
1554 }
1555
1556 ::SendMessage(dazzle_combo,CB_SETCURSEL,(WPARAM)0,0);
1557
1558 delete dazzle_types_buffer;
1559
1560 /*
1561 ** Setup the damage region spinner control.
1562 */
1563 RegionSpin = SetupIntSpinner
1564 (
1565 Hwnd,
1569 );
1570
1571}
1572
1573void SettingsFormClass::Destroy(void)
1574{
1575 ReleaseISpinner(RegionSpin);
1576 RegionSpin = NULL;
1577}
1578
1579bool SettingsFormClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
1580{
1581 int check;
1582
1583 switch (message) {
1584 case WM_INITDIALOG:
1585 Init();
1586 break;
1587
1588 case WM_DESTROY:
1589 Destroy();
1590 delete this;
1591 break;
1592
1593 case WM_COMMAND:
1594 {
1595 /*
1596 ** handle the tri-state checkboxes.
1597 ** MAKE SURE YOU PUT ANY NEW CHECKBOX ID's IN HERE!!!
1598 */
1599 int control_id = LOWORD(wParam);
1600 if ( (control_id == IDC_HIERARCHY_CHECK) ||
1601 (control_id == IDC_GEOMETRY_CHECK) ||
1602 (control_id == IDC_GEOMETRY_HIDE) ||
1603 (control_id == IDC_GEOMETRY_TWO_SIDED) ||
1604 (control_id == IDC_GEOMETRY_ZNORMALS) ||
1605 (control_id == IDC_GEOMETRY_VERTEX_ALPHA) ||
1606 (control_id == IDC_GEOMETRY_CAST_SHADOW) ||
1607 (control_id == IDC_GEOMETRY_SHATTERABLE) ||
1608 (control_id == IDC_GEOMETRY_NPATCH) ||
1609 (control_id == IDC_COLLISION_PHYSICAL) ||
1610 (control_id == IDC_COLLISION_PROJECTILE) ||
1611 (control_id == IDC_COLLISION_VIS) ||
1612 (control_id == IDC_COLLISION_CAMERA) ||
1613 (control_id == IDC_COLLISION_VEHICLE))
1614 {
1615 check = !SendDlgItemMessage(hWnd,LOWORD(wParam),BM_GETCHECK,0,0L);
1616 SendDlgItemMessage(hWnd,LOWORD(wParam),BM_SETCHECK,check,0L);
1617 }
1618
1619 INodeListClass node_list( ::GetCOREInterface()->GetRootNode(),
1620 ::GetCOREInterface()->GetTime(),
1621 &_INodeFilter );
1622
1623
1624 switch (LOWORD(wParam))
1625 {
1626 /*
1627 ** Tri-State Checkboxes, make sure that the ID of all checkboxes is present
1628 ** in the 'if' statement above!
1629 */
1630 case IDC_HIERARCHY_CHECK:
1631 W3DUtilityClass::set_hierarchy_in_all_selected(&node_list,check == BST_CHECKED);
1632 break;
1633
1634 case IDC_GEOMETRY_CHECK:
1635 W3DUtilityClass::set_geometry_in_all_selected(&node_list,check == BST_CHECKED);
1636 break;
1637
1638 case IDC_GEOMETRY_HIDE:
1639 W3DUtilityClass::enable_hidden_in_all_selected(&node_list,check == BST_CHECKED);
1640 break;
1641
1643 W3DUtilityClass::enable_two_sided_in_all_selected(&node_list,check == BST_CHECKED);
1644 break;
1645
1647 W3DUtilityClass::enable_znormals_in_all_selected(&node_list,check == BST_CHECKED);
1648 break;
1649
1651 W3DUtilityClass::enable_vertex_alpha_in_all_selected(&node_list,check == BST_CHECKED);
1652 break;
1653
1655 W3DUtilityClass::enable_shadow_in_all_selected(&node_list,check == BST_CHECKED);
1656 break;
1657
1659 W3DUtilityClass::enable_shatterable_in_all_selected(&node_list,check == BST_CHECKED);
1660 break;
1661
1663 W3DUtilityClass::enable_npatches_in_all_selected(&node_list,check == BST_CHECKED);
1664 break;
1665
1667 W3DUtilityClass::enable_physical_collision_in_all_selected(&node_list,check == BST_CHECKED);
1668 break;
1669
1671 W3DUtilityClass::enable_projectile_collision_in_all_selected(&node_list,check == BST_CHECKED);
1672 break;
1673
1674 case IDC_COLLISION_VIS:
1675 W3DUtilityClass::enable_vis_collision_in_all_selected(&node_list,check == BST_CHECKED);
1676 break;
1677
1679 W3DUtilityClass::enable_camera_collision_in_all_selected(&node_list,check == BST_CHECKED);
1680 break;
1681
1683 W3DUtilityClass::enable_vehicle_collision_in_all_selected(&node_list,check == BST_CHECKED);
1684 break;
1685
1686 /*
1687 ** Radio buttons for the Geometry type
1688 */
1691 break;
1692
1695 break;
1696
1699 break;
1700
1701 case IDC_GEOMETRY_NULL:
1703 break;
1704
1705 case IDC_GEOMETRY_AABOX:
1707 break;
1708
1709 case IDC_GEOMETRY_OBBOX:
1711 break;
1712
1715 break;
1716
1719 break;
1720
1721 /*
1722 ** Dazzle type setting. Whenever the user changes the selected dazzle type, apply
1723 ** the new setting to all selected nodes.
1724 */
1725 case IDC_DAZZLE_COMBO:
1726 if (HIWORD(wParam) == CBN_SELCHANGE) {
1727
1728 HWND dazzle_combo = GetDlgItem(hWnd,IDC_DAZZLE_COMBO);
1729 if (dazzle_combo != NULL) {
1730
1731 char dazzle_type[128];
1732 int cursel = ::SendMessage(dazzle_combo,CB_GETCURSEL,0,0);
1733 int len = ::SendMessage(dazzle_combo,CB_GETLBTEXTLEN,cursel,0);
1734 if (len < 128) {
1735 ::SendMessage(dazzle_combo,CB_GETLBTEXT,(WPARAM)cursel,(LPARAM)dazzle_type);
1737 }
1738 }
1739 }
1740 break;
1741
1742 }
1743 return TRUE;
1744 }
1745
1746 /*
1747 ** Spinners
1748 */
1749 case CC_SPINNER_CHANGE:
1750 {
1751 INodeListClass node_list( ::GetCOREInterface()->GetRootNode(),
1752 ::GetCOREInterface()->GetTime(),
1753 &_INodeFilter );
1754
1755 W3DUtilityClass::set_region_in_all_selected(&node_list,RegionSpin->GetIVal());
1756 break;
1757 }
1758
1759 /*
1760 ** Max Custom Edit boxes
1761 */
1762 case WM_CUSTEDIT_ENTER:
1763 {
1764 INodeListClass node_list( ::GetCOREInterface()->GetRootNode(),
1765 ::GetCOREInterface()->GetTime(),
1766 &_INodeFilter );
1767
1768 ICustEdit * edit_ctrl = GetICustEdit(GetDlgItem(hWnd,wParam));
1769 if (wParam == IDC_OBJ_NAME) {
1770 if (edit_ctrl && node_list.Num_Nodes() == 1) {
1771 char buffer[64];
1772 edit_ctrl->GetText(buffer,sizeof(buffer));
1773 node_list[0]->SetName(buffer);
1775 }
1776 }
1777 ReleaseICustEdit(edit_ctrl);
1778 break;
1779 }
1780
1781
1782 default:
1783 return FALSE;
1784 }
1785 return TRUE;
1786}
1787
1789{
1790 INodeListClass node_list( ::GetCOREInterface()->GetRootNode(),
1791 ::GetCOREInterface()->GetTime(),
1792 &_INodeFilter );
1793
1794 Update_Controls(&node_list);
1795}
1796
1797void SettingsFormClass::Update_Controls(INodeListClass * node_list)
1798{
1799 /*
1800 ** Update name of currently selected object
1801 ** "Multiple" if more than one, "None" if no selected objs...
1802 */
1803 ICustEdit * edit_ctrl = GetICustEdit(GetDlgItem(Hwnd,IDC_OBJ_NAME));
1804 if (edit_ctrl != NULL) {
1805 if (node_list->Num_Nodes() == 0) {
1806 edit_ctrl->Enable(FALSE);
1807 edit_ctrl->SetText(Get_String(IDS_NO_OBJECT));
1808 } else if (node_list->Num_Nodes() == 1) {
1809 edit_ctrl->Enable(TRUE);
1810 edit_ctrl->SetText((*node_list)[0]->GetName());
1811 } else {
1812 edit_ctrl->Enable(FALSE);
1813 edit_ctrl->SetText(Get_String(IDS_MULTIPLE_OBJECTS));
1814 }
1815
1816 ReleaseICustEdit(edit_ctrl);
1817 }
1818
1819 if (node_list->Num_Nodes() == 0) {
1820 Disable_Controls();
1821 return;
1822 }
1823
1824 W3DUtilityClass::NodeStatesStruct ns;
1825 W3DUtilityClass::eval_node_states(node_list,&ns);
1826
1827 /*
1828 ** Enable hierarchy and geometry checks since they are always available
1829 */
1830 EnableWindow(GetDlgItem(Hwnd,IDC_HIERARCHY_CHECK),TRUE);
1831 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CHECK),TRUE);
1832
1833 /*
1834 ** Enable/Disable the geometry controls
1835 */
1836 if (ns.ExportGeometry == 1) {
1837
1838 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAMERA_ALIGNED),TRUE);
1839 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAMERA_ORIENTED),TRUE);
1840 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NORMAL),TRUE);
1841 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NULL),TRUE);
1842 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_AABOX),TRUE);
1843 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_OBBOX),TRUE);
1844 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_AGGREGATE),TRUE);
1845 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_DAZZLE),TRUE);
1846 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_HIDE),TRUE);
1847 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_TWO_SIDED),TRUE);
1848 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_ZNORMALS),TRUE);
1849 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_VERTEX_ALPHA),TRUE);
1850 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAST_SHADOW),TRUE);
1851 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_SHATTERABLE),TRUE);
1852 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NPATCH),TRUE);
1853
1854 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PHYSICAL),TRUE);
1855 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PROJECTILE),TRUE);
1856 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VIS),TRUE);
1857 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_CAMERA),TRUE);
1858 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VEHICLE),TRUE);
1859
1860 } else {
1861
1862 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAMERA_ALIGNED),FALSE);
1863 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAMERA_ORIENTED),FALSE);
1864 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NORMAL),FALSE);
1865 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NULL),FALSE);
1866 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_AABOX),FALSE);
1867 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_OBBOX),FALSE);
1868 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_AGGREGATE),FALSE);
1869 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_DAZZLE),FALSE);
1870 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_HIDE),FALSE);
1871 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_TWO_SIDED),FALSE);
1872 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_ZNORMALS),FALSE);
1873 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_VERTEX_ALPHA),FALSE);
1874 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAST_SHADOW),FALSE);
1875 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_SHATTERABLE),FALSE);
1876 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NPATCH),FALSE);
1877
1878 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PHYSICAL),FALSE);
1879 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PROJECTILE),FALSE);
1880 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VIS),FALSE);
1881 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_CAMERA),FALSE);
1882 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VEHICLE),FALSE);
1883 }
1884
1885 /*
1886 ** Set the checks based on the nodes states:
1887 ** no check - none of the selected nodes had this setting
1888 ** check - all of the selected nodes had this setting
1889 ** grey check - some of the selected nodes had this setting
1890 */
1891 SendDlgItemMessage(Hwnd,IDC_HIERARCHY_CHECK,BM_SETCHECK,ns.ExportHierarchy,0L);
1892 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_CHECK,BM_SETCHECK,ns.ExportGeometry,0L);
1893 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_HIDE,BM_SETCHECK,ns.GeometryHidden,0L);
1894 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_TWO_SIDED,BM_SETCHECK,ns.GeometryTwoSided,0L);
1895 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_ZNORMALS,BM_SETCHECK,ns.GeometryZNormals,0L);
1896 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_VERTEX_ALPHA,BM_SETCHECK,ns.GeometryVertexAlpha,0L);
1897 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_CAST_SHADOW,BM_SETCHECK,ns.GeometryCastShadow,0L);
1898 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_SHATTERABLE,BM_SETCHECK,ns.GeometryShatterable,0L);
1899 SendDlgItemMessage(Hwnd,IDC_GEOMETRY_NPATCH,BM_SETCHECK,ns.GeometryNPatch,0L);
1900 SendDlgItemMessage(Hwnd,IDC_COLLISION_PHYSICAL,BM_SETCHECK,ns.CollisionPhysical,0L);
1901 SendDlgItemMessage(Hwnd,IDC_COLLISION_PROJECTILE,BM_SETCHECK,ns.CollisionProjectile,0L);
1902 SendDlgItemMessage(Hwnd,IDC_COLLISION_VIS,BM_SETCHECK,ns.CollisionVis,0L);
1903 SendDlgItemMessage(Hwnd,IDC_COLLISION_CAMERA,BM_SETCHECK,ns.CollisionCamera,0L);
1904 SendDlgItemMessage(Hwnd,IDC_COLLISION_VEHICLE,BM_SETCHECK,ns.CollisionVehicle,0L);
1905
1906 /*
1907 ** The damage region spinner should only be enabled if
1908 ** Export Hierarchy is checked for all selected nodes.
1909 */
1910 BOOL spinner_enable = false;
1911 if (ns.ExportHierarchy == 1)
1912 {
1914 {
1915 // Show the damage region in the spinner.
1916 RegionSpin->SetIndeterminate(FALSE);
1917 RegionSpin->SetValue(ns.DamageRegion, FALSE);
1918 }
1919 else
1920 {
1921 // The selected objects aren't all in the same region.
1922 RegionSpin->SetIndeterminate(TRUE);
1923 }
1924
1925 spinner_enable = true;
1926 }
1927 EnableWindow(GetDlgItem(Hwnd,IDC_DAMREG_INDEX_EDIT),spinner_enable);
1928 EnableWindow(GetDlgItem(Hwnd,IDC_DAMREG_INDEX_SPIN),spinner_enable);
1929
1930 /*
1931 ** The dazzle combo box should only be enabled if
1932 ** Export Geometry, and geometry type dazzle is set for all
1933 ** selected nodes.
1934 */
1935 bool dazzle_combo_enable = false;
1936 if (ns.ExportGeometry == 1) {
1937 if (ns.DazzleCount == node_list->Num_Nodes()) {
1938 dazzle_combo_enable = true;
1939 }
1940 }
1941 HWND dazzle_combo = GetDlgItem(Hwnd,IDC_DAZZLE_COMBO);
1942 EnableWindow(dazzle_combo,dazzle_combo_enable);
1943 int selindex = ::SendMessage(dazzle_combo,CB_FINDSTRING,(WPARAM)0,(LPARAM)ns.DazzleType);
1944 if (selindex != CB_ERR) {
1945 ::SendMessage(dazzle_combo,CB_SETCURSEL,(WPARAM)selindex,(LPARAM)0);
1946 } else {
1947 ::SendMessage(dazzle_combo,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
1948 }
1949
1950 /*
1951 ** Set any radio buttons present
1952 */
1953 CheckDlgButton(Hwnd,IDC_GEOMETRY_CAMERA_ALIGNED,(ns.GeometryCameraAligned ? BST_CHECKED : BST_UNCHECKED));
1954 CheckDlgButton(Hwnd,IDC_GEOMETRY_CAMERA_ORIENTED,(ns.GeometryCameraOriented ? BST_CHECKED : BST_UNCHECKED));
1955 CheckDlgButton(Hwnd,IDC_GEOMETRY_NORMAL,(ns.GeometryNormal ? BST_CHECKED : BST_UNCHECKED));
1956 CheckDlgButton(Hwnd,IDC_GEOMETRY_NULL,(ns.GeometryNull ? BST_CHECKED : BST_UNCHECKED));
1957 CheckDlgButton(Hwnd,IDC_GEOMETRY_AABOX,(ns.GeometryAABox ? BST_CHECKED : BST_UNCHECKED));
1958 CheckDlgButton(Hwnd,IDC_GEOMETRY_OBBOX,(ns.GeometryOBBox ? BST_CHECKED : BST_UNCHECKED));
1959 CheckDlgButton(Hwnd,IDC_GEOMETRY_AGGREGATE,(ns.GeometryAggregate ? BST_CHECKED : BST_UNCHECKED));
1960 CheckDlgButton(Hwnd,IDC_GEOMETRY_DAZZLE,(ns.GeometryDazzle ? BST_CHECKED : BST_UNCHECKED));
1961}
1962
1963
1964void SettingsFormClass::Disable_Controls(void)
1965{
1966 EnableWindow(GetDlgItem(Hwnd,IDC_OBJ_NAME),FALSE);
1967
1968 EnableWindow(GetDlgItem(Hwnd,IDC_HIERARCHY_CHECK),FALSE);
1969 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CHECK),FALSE);
1970 EnableWindow(GetDlgItem(Hwnd,IDC_DAMREG_INDEX_EDIT),FALSE);
1971 EnableWindow(GetDlgItem(Hwnd,IDC_DAMREG_INDEX_SPIN),FALSE);
1972
1973 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NORMAL),FALSE);
1974 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAMERA_ALIGNED),FALSE);
1975 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAMERA_ORIENTED),FALSE);
1976 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_AABOX),FALSE);
1977 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_OBBOX),FALSE);
1978 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NULL),FALSE);
1979 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_AGGREGATE),FALSE);
1980 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_DAZZLE),FALSE);
1981
1982 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_HIDE),FALSE);
1983 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_TWO_SIDED),FALSE);
1984 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_ZNORMALS),FALSE);
1985 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_VERTEX_ALPHA),FALSE);
1986 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_CAST_SHADOW),FALSE);
1987 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_SHATTERABLE),FALSE);
1988 EnableWindow(GetDlgItem(Hwnd,IDC_GEOMETRY_NPATCH),FALSE);
1989
1990 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PHYSICAL),FALSE);
1991 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PROJECTILE),FALSE);
1992 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VIS),FALSE);
1993 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_CAMERA),FALSE);
1994 EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VEHICLE),FALSE);
1995
1996 EnableWindow(GetDlgItem(Hwnd,IDC_DAZZLE_COMBO),FALSE);
1997
1998 CheckDlgButton(Hwnd,IDC_HIERARCHY_CHECK,BST_UNCHECKED);
1999 CheckDlgButton(Hwnd,IDC_GEOMETRY_CHECK,BST_UNCHECKED);
2000
2001 CheckDlgButton(Hwnd,IDC_GEOMETRY_CAMERA_ALIGNED,BST_UNCHECKED);
2002 CheckDlgButton(Hwnd,IDC_GEOMETRY_CAMERA_ORIENTED,BST_UNCHECKED);
2003 CheckDlgButton(Hwnd,IDC_GEOMETRY_NORMAL,BST_UNCHECKED);
2004 CheckDlgButton(Hwnd,IDC_GEOMETRY_AABOX,BST_UNCHECKED);
2005 CheckDlgButton(Hwnd,IDC_GEOMETRY_OBBOX,BST_UNCHECKED);
2006 CheckDlgButton(Hwnd,IDC_GEOMETRY_NULL,BST_UNCHECKED);
2007 CheckDlgButton(Hwnd,IDC_GEOMETRY_AGGREGATE,BST_UNCHECKED);
2008 CheckDlgButton(Hwnd,IDC_GEOMETRY_DAZZLE,BST_UNCHECKED);
2009
2010 CheckDlgButton(Hwnd,IDC_GEOMETRY_HIDE,BST_UNCHECKED);
2011 CheckDlgButton(Hwnd,IDC_GEOMETRY_TWO_SIDED,BST_UNCHECKED);
2012 CheckDlgButton(Hwnd,IDC_GEOMETRY_ZNORMALS,BST_UNCHECKED);
2013 CheckDlgButton(Hwnd,IDC_GEOMETRY_VERTEX_ALPHA,BST_UNCHECKED);
2014 CheckDlgButton(Hwnd,IDC_GEOMETRY_CAST_SHADOW,BST_UNCHECKED);
2015 CheckDlgButton(Hwnd,IDC_GEOMETRY_SHATTERABLE,BST_UNCHECKED);
2016 CheckDlgButton(Hwnd,IDC_GEOMETRY_NPATCH,BST_UNCHECKED);
2017
2018 CheckDlgButton(Hwnd,IDC_COLLISION_PHYSICAL,BST_UNCHECKED);
2019 CheckDlgButton(Hwnd,IDC_COLLISION_PROJECTILE,BST_UNCHECKED);
2020 CheckDlgButton(Hwnd,IDC_COLLISION_VIS,BST_UNCHECKED);
2021 CheckDlgButton(Hwnd,IDC_COLLISION_CAMERA,BST_UNCHECKED);
2022 CheckDlgButton(Hwnd,IDC_COLLISION_VEHICLE,BST_UNCHECKED);
2023}
2024
2025
2026/*
2027** Functions to access the W3D AppData of any INode.
2028*/
2030{
2031 return TheW3DUtility.get_app_data_0(node);
2032}
2033
2035{
2036 return TheW3DUtility.get_app_data_1(node);
2037}
2038
2040{
2041 return TheW3DUtility.get_app_data_2(node);
2042}
2043
2045{
2046 return TheW3DUtility.get_dazzle_app_data(node);
2047}
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
@ FOREVER
Definition GameCommon.h:196
@ W3DSHADER_DESTBLENDFUNC_SRC_ALPHA
Definition w3d_file.h:777
@ W3DSHADER_SRCBLENDFUNC_ONE_MINUS_SRC_ALPHA
Definition w3d_file.h:797
@ W3DSHADER_SRCBLENDFUNC_SRC_ALPHA
Definition w3d_file.h:796
@ W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA
Definition w3d_file.h:778
@ W3DSHADER_ALPHATEST_ENABLE
Definition w3d_file.h:770
#define W3D_NAME_LEN
Definition w3d_file.h:319
unsigned int UINT
Definition bittype.h:63
#define IDC_HIERARCHY_CHECK
Definition resource.h:158
#define IDC_DAZZLE_COMBO
Definition resource.h:368
#define IDD_W3DUTILITY_SETTINGS_DIALOG
Definition resource.h:100
#define IDC_SELECT_PHYSICAL
Definition resource.h:184
#define IDC_GEOMETRY_DAZZLE
Definition resource.h:216
#define IDC_SELECT_VIS
Definition resource.h:196
#define IDC_SELECT_ALPHA_MESHES
Definition resource.h:162
#define IDC_SELECT_GEOMETRY
Definition resource.h:167
#define IDC_GEOMETRY_ZNORMALS
Definition resource.h:286
#define IDC_COLLISION_CAMERA
Definition resource.h:291
#define IDC_GEOMETRY_CHECK
Definition resource.h:174
#define IDC_COLLECTION_NAMES_GENERATE
Definition resource.h:179
#define IDC_GEOMETRY_CAST_SHADOW
Definition resource.h:289
#define IDC_GEOMETRY_NULL
Definition resource.h:210
#define IDC_GEOMETRY_AGGREGATE
Definition resource.h:213
#define IDC_GEOMETRY_HIDE
Definition resource.h:285
#define IDS_W3DMENU_CATEGORY
Definition resource.h:45
#define IDC_SELECT_PROJECTILE
Definition resource.h:193
#define IDS_W3DUTILITY_SETTINGS
Definition resource.h:425
#define IDC_COLLISION_PHYSICAL
Definition resource.h:194
#define IDS_W3DUTILITY_TOOLS
Definition resource.h:426
#define IDC_GEOMETRY_CAMERA_ALIGNED
Definition resource.h:186
#define IDC_GEOMETRY_VERTEX_ALPHA
Definition resource.h:287
#define IDC_GEOMETRY_OBBOX
Definition resource.h:198
#define IDC_GEOMETRY_TWO_SIDED
Definition resource.h:283
#define IDC_CREATE_SETTINGS_FLOATER
Definition resource.h:369
#define IDC_DAMREG_INDEX_SPIN
Definition resource.h:326
#define IDS_W3D_UTILITY_CLASS_NAME
Definition resource.h:44
#define IDC_SELECT_HIERARCHY
Definition resource.h:172
#define IDC_DAMREG_INDEX_EDIT
Definition resource.h:325
#define IDC_GEOMETRY_AABOX
Definition resource.h:192
#define IDD_W3DUTILITY_TOOLS_DIALOG
Definition resource.h:101
#define IDS_MULTIPLE_OBJECTS
Definition resource.h:401
#define IDC_EXPORT_STANDARD_MATERIALS
Definition resource.h:349
#define IDC_OBJ_NAME
Definition resource.h:201
#define IDC_LOD_EXTENSION_GENERATE
Definition resource.h:212
#define IDC_GEOMETRY_CAMERA_ORIENTED
Definition resource.h:188
#define IDC_GEOMETRY_NPATCH
Definition resource.h:294
#define IDS_NO_OBJECT
Definition resource.h:402
#define IDC_COLLISION_VEHICLE
Definition resource.h:304
#define IDC_MATERIAL_NAMES_GENERATE
Definition resource.h:206
#define IDC_GEOMETRY_SHATTERABLE
Definition resource.h:292
#define IDC_COLLISION_VIS
Definition resource.h:284
#define IDC_COLLISION_PROJECTILE
Definition resource.h:301
#define IDC_GEOMETRY_NORMAL
Definition resource.h:190
#define BOOL
Definition Wnd_File.h:57
Int Color
Definition Xfer.h:45
int Get_Src_Blend(int pass)
Definition GameMtl.cpp:2643
float Get_Shininess(int pass, TimeValue t)
Definition GameMtl.cpp:2562
Color Get_Emissive(int pass, TimeValue t)
Definition GameMtl.cpp:2556
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE)
Definition gamemtl.h:167
float Get_Opacity(int pass, TimeValue t)
Definition GameMtl.cpp:2568
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE)
Definition gamemtl.h:166
int Get_Alpha_Test(int pass)
Definition GameMtl.cpp:2619
Texmap * Get_Texture(int pass, int stage)
Definition GameMtl.cpp:2791
int Get_Dest_Blend(int pass)
Definition GameMtl.cpp:2625
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE)
Definition gamemtl.h:170
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE)
Definition gamemtl.h:165
bool Get_Options(OptionsStruct *options)
bool Get_Options(OptionsStruct *options)
bool Get_Options(OptionsStruct *options)
unsigned Num_Nodes(void) const
Definition nodelist.h:75
virtual RefTargetHandle GetReference(int i)
Definition w3dutil.cpp:90
virtual int NumRefs()
Definition w3dutil.cpp:85
static int ReferenceCount
Definition w3dutil.cpp:82
virtual void SetReference(int i, RefTargetHandle rtarg)
Definition w3dutil.cpp:96
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
Definition w3dutil.cpp:102
bool Dialog_Proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM)
Definition w3dutil.cpp:1579
static void Update_All_Instances(void)
Definition w3dutil.cpp:1494
void Selection_Changed(void)
Definition w3dutil.cpp:1788
SettingsFormClass(HWND hwnd)
Definition w3dutil.cpp:1446
Class_ID ClassID()
Definition w3dutil.cpp:317
const TCHAR * ClassName()
Definition w3dutil.cpp:315
SClass_ID SuperClassID()
Definition w3dutil.cpp:316
const TCHAR * Category()
Definition w3dutil.cpp:318
void * Create(BOOL loading=FALSE)
Definition w3dutil.cpp:314
static void set_hierarchy_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:536
static void eval_node_states(INodeListClass *node_list, NodeStatesStruct *ns)
Definition w3dutil.cpp:402
void DeleteThis()
Definition w3dutil.cpp:160
static void enable_camera_collision_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:644
static void enable_npatches_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:608
void Select_Alpha(void)
Definition w3dutil.cpp:992
void select_hierarchy_node(INode *node)
Definition w3dutil.cpp:1093
bool is_alpha_material(Mtl *nodemtl)
Definition w3dutil.cpp:1135
static void update_settings_controls(INodeListClass *node_list=NULL)
Definition w3dutil.cpp:531
HWND SettingsPanelHWND
Definition w3dutil.cpp:173
void EndEditParams(Interface *ip, IUtil *iu)
Definition w3dutil.cpp:373
static W3DAppData2Struct * get_app_data_2(INode *node)
Definition w3dutil.cpp:1323
FloaterDialogClass SettingsFloater
Definition w3dutil.cpp:172
void select_physical_node(INode *node)
Definition w3dutil.cpp:1114
StdMat * new_standard_material(GameMtl *gamemtl)
Definition w3dutil.cpp:951
static void enable_vis_collision_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:635
bool UpdateSpinnerValue
Definition w3dutil.cpp:175
int convert_materials(MaterialConversionEnum conversion, MaterialReferenceMaker *gamenodematerials)
Definition w3dutil.cpp:832
void generate_names(void)
Definition w3dutil.cpp:693
static W3DAppData0Struct * get_app_data_0(INode *node)
Definition w3dutil.cpp:1282
void Select_Hierarchy(void)
Definition w3dutil.cpp:976
void select_vis_node(INode *node)
Definition w3dutil.cpp:1128
void Select_Vis(void)
Definition w3dutil.cpp:1016
static void enable_two_sided_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:563
static int eval_tri_state(int totalcount, int oncount)
Definition w3dutil.cpp:391
static void enable_hidden_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:554
void SelectionSetChanged(Interface *ip, IUtil *iu)
Definition w3dutil.cpp:384
static void enable_vertex_alpha_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:581
Interface * InterfacePtr
Definition w3dutil.cpp:171
static void set_geometry_type_in_all_selected(INodeListClass *list, int geotype)
Definition w3dutil.cpp:662
void generate_material_names_for_node(INode *node)
Definition w3dutil.cpp:1253
static W3DAppData1Struct * get_app_data_1(INode *node)
Definition w3dutil.cpp:1302
void BeginEditParams(Interface *ip, IUtil *iu)
Definition w3dutil.cpp:345
static void enable_shatterable_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:599
void Select_Geometry(void)
Definition w3dutil.cpp:984
void Select_Physical(void)
Definition w3dutil.cpp:1000
void generate_node_name(INode *node)
Definition w3dutil.cpp:1212
static void set_region_in_all_selected(INodeListClass *list, char region)
Definition w3dutil.cpp:680
GenNamesDialogClass::OptionsStruct NameOptions
Definition w3dutil.cpp:177
void generate_material_names(void)
Definition w3dutil.cpp:704
GenLodExtensionDialogClass::OptionsStruct LodExtensionOptions
Definition w3dutil.cpp:179
void select_alpha_node(INode *node)
Definition w3dutil.cpp:1100
static void set_dazzle_type_in_all_selected(INodeListClass *list, char *dazzletype)
Definition w3dutil.cpp:671
static void set_geometry_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:545
void hide_node(INode *node)
Definition w3dutil.cpp:1080
static void enable_znormals_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:572
void descend_tree(INode *node, int action)
Definition w3dutil.cpp:1024
void generate_lod_extensions(void)
Definition w3dutil.cpp:715
static void enable_shadow_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:590
static W3DDazzleAppDataStruct * get_dazzle_app_data(INode *node)
Definition w3dutil.cpp:1329
GenMtlNamesDialogClass::OptionsStruct MtlNameOptions
Definition w3dutil.cpp:178
void create_floater(void)
Definition w3dutil.cpp:797
static void enable_vehicle_collision_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:653
static void enable_physical_collision_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:617
void select_projectile_node(INode *node)
Definition w3dutil.cpp:1121
void export_with_standard_materials()
Definition w3dutil.cpp:803
void Select_Projectile(void)
Definition w3dutil.cpp:1008
bool is_alpha_mesh(INode *node, Mtl *nodemtl)
Definition w3dutil.cpp:1163
void select_geometry_node(INode *node)
Definition w3dutil.cpp:1086
void generate_lod_ext(INode *node)
Definition w3dutil.cpp:725
static void enable_projectile_collision_in_all_selected(INodeListClass *list, bool onoff)
Definition w3dutil.cpp:626
HINSTANCE AppInstance
Definition dllmain.cpp:67
TCHAR * Get_String(int id)
Definition dllmain.cpp:198
Class_ID GameMaterialClassID
MSG msg
Definition patch.cpp:409
void Enable_Export_Transform(bool onoff)
Definition w3dappdata.h:307
int Get_Geometry_Type(void) const
Definition w3dappdata.h:281
void Enable_Projectile_Collision(bool onoff)
Definition w3dappdata.h:321
void Enable_Export_Geometry(bool onoff)
Definition w3dappdata.h:308
void Enable_Two_Sided(bool onoff)
Definition w3dappdata.h:313
void Enable_Camera_Collision(bool onoff)
Definition w3dappdata.h:323
void Set_Geometry_Type(GeometryTypeEnum type)
Definition w3dappdata.h:310
bool Is_Bone(void) const
Definition w3dappdata.h:278
bool Is_Physical_Collision_Enabled(void) const
Definition w3dappdata.h:298
bool Is_Vertex_Alpha_Enabled(void) const
Definition w3dappdata.h:292
void Enable_Vehicle_Collision(bool onoff)
Definition w3dappdata.h:324
void Enable_NPatchable(bool onoff)
Definition w3dappdata.h:318
bool Is_NPatchable_Enabled(void) const
Definition w3dappdata.h:296
void Enable_Vis_Collision(bool onoff)
Definition w3dappdata.h:322
bool Is_Geometry(void) const
Definition w3dappdata.h:279
static W3DAppData2Struct * Get_App_Data(INode *node, bool create_if_missing=true)
void Enable_Physical_Collision(bool onoff)
Definition w3dappdata.h:320
void Enable_Shadow(bool onoff)
Definition w3dappdata.h:314
bool Is_ZNormals_Enabled(void) const
Definition w3dappdata.h:293
bool Is_Vis_Collision_Enabled(void) const
Definition w3dappdata.h:300
bool Is_Two_Sided_Enabled(void) const
Definition w3dappdata.h:291
bool Is_Hidden_Enabled(void) const
Definition w3dappdata.h:290
bool Is_Shatterable_Enabled(void) const
Definition w3dappdata.h:295
void Enable_Shatterable(bool onoff)
Definition w3dappdata.h:317
void Enable_ZNormals(bool onoff)
Definition w3dappdata.h:316
void Enable_Hidden(bool onoff)
Definition w3dappdata.h:312
bool Is_Camera_Collision_Enabled(void) const
Definition w3dappdata.h:301
void Enable_Vertex_Alpha(bool onoff)
Definition w3dappdata.h:315
bool Is_Vehicle_Collision_Enabled(void) const
Definition w3dappdata.h:302
bool Is_Shadow_Enabled(void) const
Definition w3dappdata.h:294
bool Is_Projectile_Collision_Enabled(void) const
Definition w3dappdata.h:299
static W3DDazzleAppDataStruct * Get_App_Data(INode *node, bool create_if_missing=true)
bool Is_Geometry(INode *node)
bool Is_Projectile_Collision(INode *node)
bool Is_Vis_Collision(INode *node)
bool Is_Bone(INode *node)
bool Is_Physical_Collision(INode *node)
#define MAX_DAMAGE_REGIONS
Definition w3dappdata.h:224
#define NO_DAMAGE_REGION
Definition w3dappdata.h:226
W3DAppData1Struct * GetW3DAppData1(INode *node)
Definition w3dutil.cpp:2034
W3DAppData2Struct * GetW3DAppData2(INode *node)
Definition w3dutil.cpp:2039
ClassDesc * Get_W3D_Utility_Desc(void)
Definition w3dutil.cpp:323
W3DDazzleAppDataStruct * GetW3DDazzleAppData(INode *node)
Definition w3dutil.cpp:2044
W3DAppData0Struct * GetW3DAppData0(INode *node)
Definition w3dutil.cpp:2029
#define DAZZLE_TYPES_SECTION
Definition w3dutil.cpp:55
#define DAZZLE_SETTINGS_FILENAME
Definition w3dutil.cpp:54
#define DAZZLE_SECTION_BUFFERSIZE
Definition w3dutil.cpp:56
#define W3DUtilityClassID
Definition w3dutil.h:49