source: GTP/trunk/App/Demos/Illum/Ogre/ogreExporter.mel @ 2219

Revision 2219, 38.6 KB checked in by szirmay, 17 years ago (diff)
Line 
1// ===== Initialization
2namespace -add "ogreExporter";
3namespace -set "ogreExporter";
4
5// ===== Load Plug-in
6loadPlugin "ogreExporter";
7
8// ===== Create Ogre menu
9setParent "MayaWindow";
10menu -label "Ogre" -tearOff false;
11        menuItem -label "Export" -command "ogreExporter";
12
13// ===== Launch exporter UI
14global proc ogreExporter()
15{
16        defineUIView();
17        string $valStrings[];
18        $valStrings = `fileInfo -q "ogreExporter_savedSettings"`;
19        if (`gmatch $valStrings[0] "1"`)
20                loadSettings();
21        else
22                defaultSettings();
23}
24
25// ===== Export
26global proc runOgreExport()
27{
28        global int $numClips;
29        saveSettings();
30        // ===== Files and directories
31        string $sceneFile    = `file -query -sceneName`;
32        string $mayaFile     = basename($sceneFile, "");
33        string $sceneDir     = dirname($sceneFile);
34        string $baseFile     = basename($sceneFile, ".mb");
35        string $outputDir    = (`textField -query -text OutputDirectory`);
36        if (!endsWith($outputDir,"\\") && !endsWith($outputDir,"/") && (size($outputDir)>0))
37                $outputDir += "/";
38        string $meshFile     = (`textField -query -text ExportMeshFilename`);
39        string $materialFile = (`textField -query -text ExportMaterialFilename`);
40        string $skeletonFile = (`textField -query -text ExportSkeletonFilename`);
41        string $animFile     = (`textField -query -text ExportAnimCurvesFilename`);
42        string $camerasFile  = (`textField -query -text ExportCamerasFilename`);
43        string $particlesFile= (`textField -query -text ExportParticlesFilename`);
44
45        // ===== Options
46        string $options = "";
47        string $selectedExportTypeButton = `radioCollection -query -select ExportTypeCollection`;
48        if ($selectedExportTypeButton == "RadioButtonSelected")
49        {
50                $options += " -sel";
51        }
52        else
53        {
54                $options += " -all";
55        }
56        string $selectedCoordsTypeButton = `radioCollection -query -select CoordsTypeCollection`;
57        if ($selectedCoordsTypeButton == "RadioButtonWorld")
58        {
59                $options += " -world";
60        }
61        else
62        {
63                $options += " -obj";
64        }
65
66       
67        // --- Mesh export
68        int $exportMesh = `checkBox -query -value ExportMesh`;
69        if ($exportMesh)
70        {
71                $options += " -mesh";
72                $options += " \"" + encodeString(toNativePath($outputDir+$meshFile)) + "\"";
73
74                if (`checkBox -query -value UseSharedGeometry`)
75                {
76                        $options += " -shared";
77                }
78
79            if (`checkBox -query -value ExportVBA`)
80                {
81                        $options += " -v";
82                }
83
84                if (`checkBox -query -value ExportMeshNormals`)
85                {
86                        $options += " -n";
87                }
88
89                if (`checkBox -query -value ExportMeshColoursWhite`)
90                {
91                        $options += " -cw";
92                }
93                else if (`checkBox -query -value ExportMeshColours`)
94                {
95                        $options += " -c";
96                }
97
98                if (`checkBox -query -value ExportMeshUVs`)
99                {
100                        $options += " -t";
101                }
102        }
103       
104        // --- Material export
105        int $exportMaterial = `checkBox -query -value ExportMaterial`;
106        if ($exportMaterial)
107        {
108                $options += " -mat \"" + encodeString(toNativePath($outputDir+$materialFile)) + "\"";
109                string $matPrefix = `textField -query -text ExportMaterialPrefix`;
110                if ($matPrefix != "")
111                {
112                        $options += " -matPrefix \"" + $matPrefix + "\"";
113                }
114                if (`checkBox -query -value CopyTextures`)
115                {
116                        $options += " -copyTex \"" + encodeString(toNativePath($outputDir)) + "\"";
117                }
118                if (`checkBox -query -value MatLightingOff`)
119                {
120                        $options += " -lightOff";
121                }
122        }
123
124        // --- Skeleton export
125        int $exportSkeleton = `checkBox -query -value ExportSkeleton`;
126        if ($exportSkeleton)
127        {
128                $options += " -skel \"" + encodeString(toNativePath($outputDir+$skeletonFile)) + "\"";
129        }       
130
131        // --- Animations export
132        int $exportAnims = `checkBox -query -value ExportAnims`;
133        if ($exportAnims)
134        {
135                $options += " -anims";
136        }
137        // neutral pose
138        int $neutralPose = `radioButtonGrp -q -select NeutralPoseRadio`;
139        if ($neutralPose == 1)
140        {
141                $options += " -np curFrame";
142        }
143        else if ($neutralPose == 2)
144        {
145                $options += " -np bindPose";
146        }
147        else if ($neutralPose == 3)
148        {
149                int $nposeFrame = `intField -q -v NeutralPoseFrame`;
150                $options += " -np frame " + $nposeFrame;
151        }
152        // clips
153        int $i;
154        for ($i=1; $i<=$numClips; $i++)
155        {
156                string $command = "checkBox -q -v ExportClip" + $i;
157                if(eval($command))
158                {
159                        $options += " -clip ";
160                        // clip name
161                        $options += eval("textField -q -tx ClipName"+$i);
162                        // clip range
163                        int $clipRangeType = eval("radioButtonGrp -q -sl ClipRangeRadio"+$i);
164                        if ($clipRangeType == 1)
165                        {
166                                $options += " startEnd ";
167                                $options += eval("floatField -q -v ClipRangeStart"+$i);
168                                $options += " " + eval("floatField -q -v ClipRangeEnd"+$i);
169                                int $rangeUnits = eval("radioButtonGrp -q -sl ClipRangeUnits"+$i);
170                                if ($rangeUnits == 1)
171                                        $options += " frames";
172                                else
173                                        $options += " seconds";
174                        }
175                        else
176                                $options += " timeSlider";
177                        // sample rate
178                        int $clipRateType = eval("radioButtonGrp -q -sl ClipRateType"+$i);
179                        if ($clipRateType == 1)
180                        {
181                                $options += " sampleByFrames ";
182                                $options += eval("intField -q -v ClipRateFrames"+$i);
183                        }
184                        else
185                        {
186                                $options += " sampleBySec ";
187                                $options += eval("floatField -q -v ClipRateSeconds"+$i);
188                        }
189                }
190        }
191
192        // --- Anim Curves export
193        int $exportAnimCurves = `checkBox -query -value ExportAnimCurves`;
194        if ($exportAnimCurves)
195        {
196                $options += " -animCur \"" + encodeString(toNativePath($outputDir+$animFile)) + "\"";
197        }
198
199        // --- Cameras export
200        int $exportCameras = `checkBox -query -value ExportCameras`;
201        if ($exportCameras)
202        {
203                $options += " -cam \"" + encodeString(toNativePath($outputDir+$camerasFile)) + "\"";
204                if (`checkBox -query -value ExportCamerasAnim`)
205                {
206                        $options += " -camAnim";
207                }
208        }
209
210        // --- Particles export
211        int $exportParticles = `checkBox -query -value ExportParticles`;
212        if ($exportParticles)
213        {
214                $options += " -particles \"" + encodeString(toNativePath($outputDir+$particlesFile)) + "\"";
215        }
216               
217        // ===== Export
218        print ("ogreExport" + $options + ";\n");
219        eval ("ogreExport" + $options);
220
221        // ===== Create binary files
222        string $commands;
223        $commands += "set path=" + toNativePath(`internalVar -userScriptDir`) + ";%path%" + "\n";
224        if (`checkBox -query -value ExportMeshBin`)
225        {
226                string $meshBinFile = $meshFile;
227                if (endsWith($meshBinFile,".xml"))
228                {
229                        int $size = size($meshBinFile);
230                        $size -= 4;
231                        $meshBinFile = `substring $meshBinFile 1 $size`;
232                }
233                $commands += "OgreXMLConverter ";
234                if (!`checkBox -query -value BuildEdges`)
235                        $commands += "-e ";
236                if (`checkBox -query -value BuildTangents`)
237                        $commands += "-t ";
238                $commands += "\"" + toNativePath($outputDir+$meshFile) + "\" \"" + toNativePath($outputDir+$meshBinFile) + "\"\n";
239        }
240        if (`checkBox -query -value ExportSkeletonBin`)
241        {
242                string $skelBinFile = $skeletonFile;
243                if (endsWith($skelBinFile,".xml"))
244                {
245                        int $size = size($skelBinFile);
246                        $size -= 4;
247                        $skelBinFile = `substring $skelBinFile 1 $size`;
248                }
249                $commands += "OgreXMLConverter \"" + toNativePath($outputDir+$skeletonFile) + "\" \"" + toNativePath($outputDir+$skelBinFile) + "\"\n";
250        }
251        $commands += "pause" + "\n";
252       
253        string $commandFile = `internalVar -userScriptDir` + "maya2ogre_mel.bat";
254        $fileID = `fopen $commandFile "w"`;
255        fprint $fileID $commands;
256        fclose $fileID;
257
258        system("start \"" + `toNativePath $commandFile` + "\"");
259}
260
261// ===== Format UI
262// (Primarily enabling/disabling controls)
263global proc formatUI()
264{
265        global int $numClips;
266        // --- Common parameters
267
268        // --- Mesh Export
269        int $exportMesh = `checkBox -q -v ExportMesh`;
270        checkBox -edit -enable $exportMesh UseSharedGeometry;
271      checkBox -edit -enable $exportMesh ExportVBA;
272        checkBox -edit -enable $exportMesh ExportMeshNormals;
273        checkBox -edit -enable $exportMesh ExportMeshColours;
274        int $exportColours = `checkBox -query -value ExportMeshColours`;
275        checkBox -edit -enable ($exportMesh && $exportColours) ExportMeshColoursWhite;
276        if (!$exportColours)
277        {
278                checkBox -edit -value false ExportMeshColoursWhite;
279        }
280        checkBox -edit -enable $exportMesh ExportMeshUVs;
281        text -edit -enable $exportMesh ExportMeshFilenameLabel;
282        textField -edit -enable $exportMesh ExportMeshFilename;
283        if (!$exportMesh)
284                checkBox -edit -value false ExportMeshBin;
285        checkBox -edit -enable $exportMesh ExportMeshBin;
286        int $exportMeshBin = `checkBox -query -value ExportMeshBin`;
287        if (!$exportMeshBin)
288        {
289                checkBox -edit -value false BuildEdges;
290                checkBox -edit -value false BuildTangents;
291        }
292        checkBox -edit -enable $exportMeshBin BuildEdges;
293        checkBox -edit -enable $exportMeshBin BuildTangents;
294       
295        // --- Material Export
296        int $exportMaterial = `checkBox -query -value ExportMaterial`;
297        text -edit -enable $exportMaterial ExportMaterialFilenameLabel;
298        textField -edit -enable $exportMaterial ExportMaterialFilename;
299        text -edit -enable $exportMaterial ExportMaterialPrefixLabel;
300        textField -edit -enable $exportMaterial ExportMaterialPrefix;
301        if (!$exportMaterial)
302                checkBox -edit -value false CopyTextures;
303        checkBox -edit -enable $exportMaterial CopyTextures;
304        if (!$exportMaterial)
305                checkBox -edit -value false MatLightingOff;
306        checkBox -edit -enable $exportMaterial MatLightingOff;
307
308        // --- Skeleton Export
309        int $exportSkeleton = `checkBox -query -value ExportSkeleton`;
310        text -edit -enable $exportSkeleton ExportSkeletonFilenameLabel;
311        textField -edit -enable $exportSkeleton ExportSkeletonFilename;
312        if (!$exportSkeleton)
313                checkBox -edit -value false ExportSkeletonBin;
314        checkBox -edit -enable $exportSkeleton ExportSkeletonBin;
315
316        // --- Animations Export
317        if (!$exportSkeleton)
318                checkBox -edit -value false ExportAnims;
319        checkBox -edit -enable $exportSkeleton ExportAnims;
320        int $exportAnims = `checkBox -query -value ExportAnims`;
321        text -edit -enable $exportAnims NeutralPoseLabel;
322        radioButtonGrp -edit -enable $exportAnims NeutralPoseRadio;
323        int $neutralPoseType = `radioButtonGrp -query -select NeutralPoseRadio`;
324        intField -edit -enable (($neutralPoseType == 3)&&($exportAnims)) NeutralPoseFrame;
325        int $i;
326        for ($i=1; $i<=$numClips; $i++)
327        {
328                if (!$exportAnims)
329                        checkBox -edit -value false ("ExportClip"+$i);
330                checkBox -edit -enable $exportAnims ("ExportClip"+$i);
331               
332                int $exportClip = `checkBox -query -value ("ExportClip"+$i)`;
333                textField -edit -enable $exportClip ("ClipName"+$i);
334                text -edit -enable $exportClip ("ClipRangeLabel"+$i);
335                radioButtonGrp -edit -enable $exportClip ("ClipRangeRadio"+$i);
336                text -edit -enable $exportClip ("ClipRateTypeLabel"+$i);
337                radioButtonGrp -edit -enable $exportClip ("ClipRateType"+$i);
338
339                int $rangeType = `radioButtonGrp -query -select ("ClipRangeRadio"+$i)`;
340                text -edit -enable (($rangeType == 1)&&($exportClip)) ("ClipRangeStartLabel"+$i);
341                floatField -edit -enable (($rangeType == 1)&&($exportClip)) ("ClipRangeStart"+$i);
342                text -edit -enable (($rangeType == 1)&&($exportClip)) ("ClipRangeEndLabel"+$i);
343                floatField -edit -enable (($rangeType == 1)&&($exportClip)) ("ClipRangeEnd"+$i);
344                radioButtonGrp -edit -enable (($rangeType == 1)&&($exportClip)) ("ClipRangeUnits"+$i);
345
346                int $rateType = `radioButtonGrp -query -select ("ClipRateType"+$i)`;
347                intField -edit -enable (($rateType == 1)&&($exportClip)) ("ClipRateFrames"+$i);
348                floatField -edit -enable (($rateType == 2)&&($exportClip)) ("ClipRateSeconds"+$i);
349        }
350               
351        // --- Anim Curves Export
352        int $exportAnimCurves = `checkBox -query -value ExportAnimCurves`;
353        text -edit -enable $exportAnimCurves ExportAnimCurvesFilenameLabel;
354        textField -edit -enable $exportAnimCurves ExportAnimCurvesFilename;
355
356        // --- Camera Export
357        int $exportCameras = `checkBox -query -value ExportCameras`;
358        checkBox -edit -enable ($exportCameras && $exportAnimCurves) ExportCamerasAnim;
359        if (!$exportAnimCurves)
360        {
361                checkBox -edit -value false ExportCamerasAnim;
362        }
363        text -edit -enable $exportCameras ExportCamerasFilenameLabel;
364        textField -edit -enable $exportCameras ExportCamerasFilename;
365
366        // --- particles Export
367        int $exportParticles = `checkBox -query -value ExportParticles`;
368        text -edit -enable $exportParticles ExportParticlesFilenameLabel;
369        textField -edit -enable $exportParticles ExportParticlesFilename;
370}
371
372// ===== Initialization code
373// Initializes parameters that are not stored in fileInfo
374// Also provides defaults for params that may not yet be stored in fileInfo
375global proc initUI()
376{
377        // --- Common parameters
378        string $sceneFile = `file -query -sceneName`;
379        string $sceneDir = dirname($sceneFile);
380        string $baseFile = basename($sceneFile, ".mb");
381        textField -edit -fileName $sceneDir SceneDirectory;
382       
383        // --- Mesh Export
384        string $meshFile = $baseFile + ".mesh.xml";
385        textField -edit -fileName $meshFile ExportMeshFilename;
386       
387        // --- Material Export
388        string $matFile = $baseFile + ".material";
389        textField -edit -fileName $matFile ExportMaterialFilename;
390
391        // --- Skeleton Export
392        string $skelFile = $baseFile + ".skeleton.xml";
393        textField -edit -fileName $skelFile ExportSkeletonFilename;
394
395        // --- Camera Export
396        string $camFile = $baseFile + ".camera";
397        textField -edit -fileName $camFile ExportCamerasFilename;
398
399        // --- Anim Curves Export
400        string $animFile = $baseFile + ".anim";
401        textField -edit -fileName $animFile ExportAnimCurvesFilename;
402
403        // --- Particles Export
404        string $particlesFile = $baseFile + ".particles.xml";
405        textField -edit -fileName $particlesFile ExportParticlesFilename;
406}
407
408// ===== Define UI
409global proc defineUIView()
410{
411        global int $numClips;
412        $numClips = 0;
413
414        // --- Main window for Ogre exporter
415        if (`window -exists OgreExportWindow`)
416        {
417        deleteUI OgreExportWindow;
418        }
419        window
420        -title "Ogre Exporter"
421                OgreExportWindow;
422        scrollLayout
423        OgreExportScrollLayout;
424        columnLayout
425        OgreExportLayout;
426
427                // --- Common Parameters Frame
428                frameLayout
429                        -parent OgreExportLayout
430                        -label "Common Parameters"
431                        -collapsable true
432                CommonFrame;
433
434                        columnLayout
435                                -parent CommonFrame
436                                -columnAttach "left" 20
437                        CommonLayout;
438
439                                text 
440                                        -parent CommonLayout   
441                                        -label "Current Directory"
442                                SceneDirectoryLabel;
443                               
444                                textField
445                                        -parent CommonLayout
446                                        -width 305
447                                        -editable false
448                                SceneDirectory;
449
450                                text 
451                                        -parent CommonLayout   
452                                        -label "Output Directory"
453                                OutputDirectoryLabel;
454                               
455                                textField
456                                        -parent CommonLayout
457                                        -width 305
458                                OutputDirectory;
459
460                                rowColumnLayout
461                                        -parent CommonLayout
462                                        -numberOfColumns 3
463                                ExportTypeLayout;
464
465                                        text -label "Export:";
466                                        string $radioButton1, $radioButton2;
467                                        radioCollection ExportTypeCollection;
468                                        radioButton -label "all" -select RadioButtonAll;
469                                        radioButton -label "selected" RadioButtonSelected;
470
471                                rowColumnLayout
472                                        -parent CommonLayout
473                                        -numberOfColumns 3
474                                CoordsType;
475
476                                        text -label "Coordinate space:";
477                                //      string $radioButtonWorld, $radioButtonObject;
478                                        radioCollection CoordsTypeCollection;
479                                        radioButton -label "world" -select RadioButtonWorld;
480                                        radioButton -label "object" RadioButtonObject;
481
482
483                // --- Mesh
484                frameLayout
485                        -parent OgreExportLayout
486                        -collapsable true
487                        -label "Mesh"
488                MeshFrame;
489
490                        columnLayout
491                                -parent MeshFrame
492                                -columnAttach "left" 20
493                        MeshLayout;
494                               
495                                checkBox
496                                        -parent MeshLayout
497                                        -value false
498                                        -changeCommand "formatUI"
499                                        -label "Export mesh to Ogre XML format"
500                                ExportMesh;
501
502                                checkBox
503                                        -parent MeshLayout
504                                        -value false
505                                        -changeCommand "formatUI"
506                                        -label "Use shared geometry"
507                                UseSharedGeometry;
508
509                        checkBox
510                                        -parent MeshLayout
511                                        -value true 
512                                        -enable false
513                                        -label "Include vertex bone assignements"
514                                ExportVBA;
515
516                                checkBox
517                                        -parent MeshLayout
518                                        -value true 
519                                        -enable false
520                                        -label "Include vertex normals"
521                                ExportMeshNormals;
522                               
523                                checkBox
524                                        -parent MeshLayout
525                                        -value false 
526                                        -changeCommand "formatUI"
527                                        -enable false
528                                        -label "Include diffuse vertex colours"
529                                ExportMeshColours;
530                               
531                                checkBox
532                                        -parent MeshLayout
533                                        -value false 
534                                        -enable false
535                                        -label "Export diffuse vertex colours as white"
536                                ExportMeshColoursWhite;
537                               
538                                checkBox
539                                        -parent MeshLayout
540                                        -value true 
541                                        -enable false
542                                        -label "Include texture coordinates"
543                                ExportMeshUVs;
544                               
545                                text     
546                                        -parent MeshLayout
547                                        -label "XML Mesh Filename"
548                                        -enable false
549                                ExportMeshFilenameLabel;
550                               
551                                textField
552                                        -parent MeshLayout
553                                        -width 305
554                                        -enable false
555                                ExportMeshFilename;
556
557                                checkBox
558                                        -parent MeshLayout
559                                        -value false
560                                        -enable false
561                                        -label "Create mesh binary file"
562                                        -changeCommand "formatUI"
563                                ExportMeshBin;
564
565                                checkBox
566                                        -parent MeshLayout
567                                        -value false
568                                        -enable false
569                                        -label "Build edges list (for shadows)"
570                                BuildEdges;
571
572                                checkBox
573                                        -parent MeshLayout
574                                        -value false
575                                        -enable false
576                                        -label "Build tangent vectors (for normal maps)"
577                                BuildTangents;
578
579                // --- Materials
580                frameLayout
581                        -parent OgreExportLayout
582                        -collapsable true
583                        -label "Materials"
584                MaterialFrame;
585
586                        columnLayout
587                                -parent MaterialFrame
588                                -columnAttach "left" 20
589                        MaterialLayout;
590
591                                checkBox
592                                        -parent MaterialLayout
593                                        -value false
594                                        -changeCommand "formatUI"
595                                        -label "Export materials to Ogre .material file"
596                                ExportMaterial;
597                               
598                                text
599                                        -parent MaterialLayout     
600                                        -label "Material Filename"
601                                        -enable false
602                                ExportMaterialFilenameLabel;
603                               
604                                textField
605                                        -parent MaterialLayout
606                                        -width 305
607                                        -enable false
608                                ExportMaterialFilename;
609
610                                text
611                                        -parent MaterialLayout
612                                        -label "Material name prefix"
613                                        -enable false
614                                ExportMaterialPrefixLabel;
615
616                                textField
617                                        -parent MaterialLayout
618                                        -width 305
619                                        -enable false
620                                        -text ""
621                                ExportMaterialPrefix;
622
623                                checkBox
624                                        -parent MaterialLayout
625                                        -value false
626                                        -label "Copy texture files to output dir"
627                                CopyTextures;
628
629                                checkBox
630                                        -parent MaterialLayout
631                                        -value false
632                                        -label "Export with \"ligthing off\" option"
633                                MatLightingOff;
634
635                // --- Skeleton
636                frameLayout
637                        -parent OgreExportLayout
638                        -collapsable true
639                        -label "Skeleton"
640                SkeletonFrame;
641
642                        columnLayout
643                                -parent SkeletonFrame
644                                -columnAttach "left" 20
645                        SkeletonLayout;
646                       
647                                checkBox
648                                        -parent SkeletonLayout
649                                        -value false
650                                        -changeCommand "formatUI"
651                                        -label "Export skeleton to .skeleton.xml file"
652                                ExportSkeleton;
653                               
654                                text
655                                        -parent SkeletonLayout
656                                        -label "Skeleton Filename"
657                                        -enable false
658                                ExportSkeletonFilenameLabel;
659                               
660                                textField
661                                        -parent SkeletonLayout
662                                        -width 305
663                                        -enable false
664                                ExportSkeletonFilename;
665
666                                checkBox
667                                        -parent SkeletonLayout
668                                        -value false
669                                        -enable false
670                                        -label "Create skeleton binary file"
671                                ExportSkeletonBin;
672
673
674                // --- Animations
675                frameLayout
676                        -parent OgreExportLayout
677                        -collapsable true
678                        -label "Animations"
679                        -width 329
680                AnimsFrame;
681
682                        columnLayout
683                                -parent AnimsFrame
684                                -columnAttach "left" 20
685                        AnimsLayout;
686
687                                checkBox
688                                        -parent AnimsLayout
689                                        -value false
690                                        -changeCommand "formatUI"
691                                        -label "Export animations (requires export of skeleton)"
692                                ExportAnims;
693
694                                text
695                                        -parent AnimsLayout
696                                        -label "Frame for neutral pose:"
697                                NeutralPoseLabel;
698
699                                radioButtonGrp
700                                        -parent AnimsLayout
701                                        -numberOfRadioButtons 3
702                                        -labelArray3 "Current frame" "Skin bind pose" "Frame:"
703                                        -cw 1 100
704                                        -cw 2 100
705                                        -cw 3 100
706                                        -select 1
707                                        -changeCommand "formatUI()"
708                                NeutralPoseRadio;
709
710                                columnLayout
711                                        -parent AnimsLayout
712                                        -columnAttach "left" 200
713                                NeutralPoseFrameLayout;
714
715                                        intField
716                                                -parent NeutralPoseFrameLayout
717                                                -value 0
718                                                -width 50
719                                        NeutralPoseFrame;
720
721                                columnLayout
722                                        -parent AnimsLayout
723                                        -columnAttach "left" 0
724                                ClipsLayout;
725
726                                rowLayout
727                                        -parent AnimsLayout
728                                        -numberOfColumns 2
729                                        -columnWidth 1 160
730                                        -columnWidth 2 60
731                                        -columnAttach 1 "left" 100
732                                ClipsButtonsLayout;
733                       
734                                        button
735                                                -parent ClipsButtonsLayout
736                                                -label "Add Clip"
737                                                -width 60
738                                                -command "addClip()"
739                                        ButtonAddClip;
740
741                                        button
742                                                -parent ClipsButtonsLayout
743                                                -label "Delete Clip"
744                                                -width 60
745                                                -command "delClip()"
746                                        ButtonDelClip;
747
748                                                               
749                // --- Anim Curves
750                frameLayout
751                        -parent OgreExportLayout
752                        -collapsable true
753                        -label "Animation Curves"
754                AnimCurvesFrame;
755
756                        columnLayout
757                                -parent AnimCurvesFrame
758                                -columnAttach "left" 20
759                        AnimCurvesLayout;
760                       
761                                checkBox
762                                        -parent AnimCurvesLayout
763                                        -value false
764                                        -changeCommand "formatUI"
765                                        -label "Export animation curves to Ogre .anim file"
766                                ExportAnimCurves;
767                               
768                                text
769                                        -parent AnimCurvesLayout     
770                                        -label "Anim Curves Filename"
771                                        -enable false
772                                ExportAnimCurvesFilenameLabel;
773                               
774                                textField
775                                        -parent AnimCurvesLayout
776                                        -width 305
777                                        -enable false
778                                ExportAnimCurvesFilename;
779
780                // --- Cameras
781                frameLayout
782                        -parent OgreExportLayout
783                        -collapsable true
784                        -label "Cameras"
785                CameraFrame;
786
787                        columnLayout
788                                -parent CameraFrame
789                                -columnAttach "left" 20
790                        CameraLayout;
791
792                                checkBox
793                                        -parent CameraLayout
794                                        -value false
795                                        -changeCommand "formatUI"
796                                        -label "Export cameras to Ogre .camera file"
797                                ExportCameras;
798
799                                checkBox
800                                        -parent CameraLayout
801                                        -value false
802                                        -changeCommand "formatUI"
803                                        -label "Export Camera Animations(requires export of anim curves)"
804                                ExportCamerasAnim;
805
806                                text
807                                        -parent CameraLayout   
808                                        -label "Cameras Filename"
809                                        -enable false
810                                ExportCamerasFilenameLabel;
811                               
812                                textField
813                                        -parent CameraLayout
814                                        -width 305
815                                        -enable false
816                                ExportCamerasFilename;
817
818                // --- Particles
819                frameLayout
820                        -parent OgreExportLayout
821                        -collapsable true
822                        -label "Particles"
823                ParticlesFrame;
824
825                        columnLayout
826                                -parent ParticlesFrame
827                                -columnAttach "left" 20
828                        ParticlesLayout;
829                       
830                                checkBox
831                                        -parent ParticlesLayout
832                                        -value false
833                                        -changeCommand "formatUI"
834                                        -label "Export particles to Ogre .particles file"
835                                ExportParticles;
836                               
837                                text
838                                        -parent ParticlesLayout     
839                                        -label "Particles Filename"
840                                        -enable false
841                                ExportParticlesFilenameLabel;
842                               
843                                textField
844                                        -parent ParticlesLayout
845                                        -width 305
846                                        -enable false
847                                ExportParticlesFilename;
848
849                // --- Export!
850                separator
851                        -parent OgreExportLayout
852                        -style "none"
853                        -height 10;
854
855                button
856                        -parent OgreExportLayout
857                        -label "EXPORT"
858                        -command "runOgreExport"
859                        -width 325
860                ButtonExport;
861
862                // --- Manage settings
863                separator
864                        -parent OgreExportLayout
865                        -style "in"
866                        -width 325
867                        -height 5;
868
869                rowLayout
870                        -parent OgreExportLayout
871                        -numberOfColumns 3
872                        -columnWidth3 110 110 100
873                        -columnAlign 1 "center"
874                        -columnAlign 2 "center"
875                        -columnAlign 3 "center"
876                SettingsButtonsLayout;
877
878                        button
879                                -parent SettingsButtonsLayout
880                                -label "Load settings"
881                                -command "loadSettings"
882                                -width 100
883                        LoadSettingsButton;
884
885                        button
886                                -parent SettingsButtonsLayout
887                                -label "Save settings"
888                                -command "saveSettings"
889                                -width 100
890                        SaveSettingsButton;
891
892                        button
893                                -parent SettingsButtonsLayout
894                                -label "Default settings"
895                                -command "defaultSettings"
896                                -width 100
897                        DefaultSettingsButton;
898
899
900
901        // --- Add an empty clip
902        addClip();
903        // --- Show the Window
904        showWindow OgreExportWindow;
905}
906
907global proc addClip()
908{
909        global int $numClips;
910        $numClips++;
911
912        frameLayout
913                -parent ClipsLayout
914                -width 309
915                -label ("Clip"+$numClips)
916        ("ClipFrame"+$numClips);
917
918                columnLayout
919                        -parent ("ClipFrame"+$numClips)
920                        -columnAttach "left" 0
921                ("ClipLayout"+$numClips);
922
923                rowLayout
924                        -parent ("ClipLayout"+$numClips)
925                        -numberOfColumns 2
926                        -columnWidth2 100 200
927                        -columnOffset2 5 5
928                        -columnAlign 1 "left"
929                        -columnAlign 2 "left"
930                ("ClipNameLayout"+$numClips);
931                                                       
932                        checkBox
933                                -parent ("ClipNameLayout"+$numClips)
934                                -value false
935                                -changeCommand "formatUI"
936                                -label "Clip Name"
937                        ("ExportClip"+$numClips);
938                                       
939                        textField
940                                -parent ("ClipNameLayout"+$numClips)
941                                -width 200
942                                -text ("clip"+$numClips)
943                        ("ClipName"+$numClips);
944
945                        separator
946                                -parent ("ClipLayout"+$numClips)
947                                -style "in"
948                                -width 309
949                                -height 5;
950
951                        rowLayout
952                                -parent ("ClipLayout"+$numClips)
953                                -numberOfColumns 2
954                                -columnWidth2 100 200
955                                -columnAlign 1 "left"
956                                -columnAlign 2 "left"
957                        ("ClipRangeTypeLayout"+$numClips);
958                               
959                                text
960                                        -parent ("ClipRangeTypeLayout"+$numClips)
961                                        -label "Time Range:"
962                                ("ClipRangeLabel"+$numClips);
963                       
964                                radioButtonGrp
965                                        -parent ("ClipRangeTypeLayout"+$numClips)
966                                        -numberOfRadioButtons 2
967                                        -labelArray2 "Start/End" "Time Slider"
968                                        -cw 1 100
969                                        -cw 2 100
970                                        -select 2
971                                        -changeCommand "formatUI()"
972                                ("ClipRangeRadio"+$numClips);
973
974                        columnLayout
975                                -parent ("ClipLayout"+$numClips)
976                                -columnAttach "left" 70
977                        ("ClipRangeLayout"+$numClips);
978
979                                rowLayout
980                                        -parent ("ClipRangeLayout"+$numClips)
981                                        -numberOfColumns 2
982                                        -columnAlign 1 "left"
983                                        -columnAlign 2 "left"
984                                        -columnAttach 1 "both" 0
985                                        -columnAttach 2 "both" 0
986                                        -columnOffset2 5 5
987                                        -columnWidth 1 70
988                                        -columnWidth 2 50
989                                ("ClipRangeStartLayout"+$numClips);
990
991                                        text
992                                                -parent ("ClipRangeStartLayout"+$numClips)
993                                                -label "Start Time:"
994                                                -width 50
995                                        ("ClipRangeStartLabel"+$numClips);
996
997                                        floatField
998                                                -parent ("ClipRangeStartLayout"+$numClips)
999                                                -width 50
1000                                                -value 0.000
1001                                        ("ClipRangeStart"+$numClips);
1002                               
1003                                rowLayout
1004                                        -parent ("ClipRangeLayout"+$numClips)
1005                                        -numberOfColumns 2
1006                                        -columnAlign 1 "left"
1007                                        -columnAlign 2 "left"
1008                                        -columnAttach 1 "both" 0
1009                                        -columnAttach 2 "both" 0
1010                                        -columnOffset2 5 5
1011                                        -columnWidth 1 70
1012                                        -columnWidth 2 50
1013                                ("ClipRangeEndLayout"+$numClips);
1014
1015                                        text
1016                                                -parent ("ClipRangeEndLayout"+$numClips)
1017                                                -label "End Time:"
1018                                        ("ClipRangeEndLabel"+$numClips);
1019
1020                                        floatField
1021                                                -parent ("ClipRangeEndLayout"+$numClips)
1022                                                -value 0.000
1023                                                -width 50
1024                                        ("ClipRangeEnd"+$numClips);
1025
1026                                columnLayout
1027                                        -parent ("ClipRangeLayout"+$numClips)
1028                                        -columnAttach "left" 0
1029                                ("ClipRangeUnitsLayout"+$numClips);
1030
1031                                        radioButtonGrp
1032                                                -parent ("ClipRangeUnitsLayout"+$numClips)
1033                                                -numberOfRadioButtons 2
1034                                                -labelArray2 "Frames" "Seconds"
1035                                                -cw 1 65
1036                                                -cw 2 65
1037                                                -select 1
1038                                        ("ClipRangeUnits"+$numClips);
1039                                       
1040                        separator
1041                                -parent ("ClipLayout"+$numClips)
1042                                -style "in"
1043                                -width 309
1044                                -height 5;
1045
1046                        rowLayout
1047                                -parent ("ClipLayout"+$numClips)
1048                                -numberOfColumns 2
1049                                -columnWidth 1 70
1050                                -columnWidth 2 230
1051                                -columnAlign 1 "left"
1052                                -columnAlign 2 "left"
1053                                -columnAttach 1 "both" 0
1054                                -columnAttach 2 "both" 0
1055                                -columnOffset2 5 5
1056                        ("ClipRateTypeLayout"+$numClips);
1057
1058                                text
1059                                        -parent ("ClipRateTypeLayout"+$numClips)
1060                                        -label "Sample by:"
1061                                ("ClipRateTypeLabel"+$numClips);
1062       
1063                                radioButtonGrp
1064                                        -parent ("ClipRateTypeLayout"+$numClips)
1065                                        -numberOfRadioButtons 2
1066                                        -labelArray2 "Frames" "Seconds"
1067                                        -cw 1 65
1068                                        -cw 2 65
1069                                        -select 1
1070                                        -changeCommand "formatUI()"
1071                                ("ClipRateType"+$numClips);
1072
1073                        rowLayout
1074                                -parent ("ClipLayout"+$numClips)
1075                                -numberOfColumns 2
1076                                -columnWidth 1 125
1077                                -columnWidth 2 80
1078                                -columnAlign 1 "left"
1079                                -columnAlign 2 "left"
1080                                -columnAttach 1 "left" 75
1081                                -columnAttach 2 "both" 15
1082                        ("ClipRateLayout"+$numClips);
1083                                                       
1084                                intField
1085                                        -parent ("ClipRateLayout"+$numClips)
1086                                        -width 50
1087                                        -value 1.000
1088                                ("ClipRateFrames"+$numClips);
1089                       
1090                                floatField
1091                                        -parent ("ClipRateLayout"+$numClips)
1092                                        -width 50
1093                                        -value 0.100
1094                                ("ClipRateSeconds"+$numClips);
1095        formatUI();
1096}
1097
1098global proc delClip()
1099{
1100        global int $numClips;
1101        if ($numClips > 1)
1102        {
1103                deleteUI("ClipFrame"+$numClips);
1104                $numClips--;
1105        }
1106        formatUI();
1107}
1108
1109global proc saveSettings()
1110{
1111        fileInfo "ogreExporter_savedSettings" "1";
1112        // Common parameters
1113        fileInfo "ogreExporter_outputDir" `textField -query -fileName OutputDirectory`;
1114        fileInfo "ogreExporter_exportType" `radioCollection -q -select ExportTypeCollection`;
1115        fileInfo "ogreExporter_coordsType" `radioCollection -q -select CoordsTypeCollection`;           
1116
1117        // Mesh
1118        fileInfo "ogreExporter_exportMesh" `checkBox -q -v ExportMesh`;
1119        fileInfo "ogreExporter_useSharedGeom" `checkBox -q -v UseSharedGeometry`;
1120        fileInfo "ogreExporter_exportVBA" `checkBox -q -v ExportVBA`;
1121        fileInfo "ogreExporter_exportNormals" `checkBox -q -v ExportMeshNormals`;
1122        fileInfo "ogreExporter_exportColours" `checkBox -q -v ExportMeshColours`;
1123        fileInfo "ogreExporter_exportColWhite" `checkBox -q -v ExportMeshColoursWhite`;
1124        fileInfo "ogreExporter_exportUVs" `checkBox -q -v ExportMeshUVs`;
1125        fileInfo "ogreExporter_meshFilename" `textField -q -text ExportMeshFilename`;
1126        fileInfo "ogreExporter_exportMeshBin" `checkBox -q -v ExportMeshBin`;
1127        fileInfo "ogreExporter_buildEdges" `checkBox -q -v BuildEdges`;
1128        fileInfo "ogreExporter_buildTangents" `checkBox -q -v BuildTangents`;
1129       
1130        // Materials
1131        fileInfo "ogreExporter_exportMat" `checkBox -q -v ExportMaterial`;
1132        fileInfo "ogreExporter_materialFile" `textField -q -text ExportMaterialFilename`;
1133        fileInfo "ogreExporter_matPrefix" `textField -q -text ExportMaterialPrefix`;
1134        fileInfo "ogreExporter_copyTextures" `checkBox -q -v CopyTextures`;
1135        fileInfo "ogreExporter_lightingOff" `checkBox -q -v MatLightingOff`;
1136       
1137        // Skeleton     
1138        fileInfo "ogreExporter_exportSkel" `checkBox -q -v ExportSkeleton`;
1139        fileInfo "ogreExporter_skelFilename" `textField -q -text ExportSkeletonFilename`;
1140        fileInfo "ogreExporter_exportSkelBin" `checkBox -q -v ExportSkeletonBin`;
1141       
1142        // Animations
1143        fileInfo "ogreExporter_exportAnims" `checkBox -q -v ExportAnims`;
1144        fileInfo "ogreExporter_neutralPoseType" `radioButtonGrp -q -select NeutralPoseRadio`;
1145        fileInfo "ogreExporter_neutralPoseFrame" `intField -q -v NeutralPoseFrame`;
1146        global int $numClips;
1147        fileInfo "ogreExporter_numClips" $numClips;
1148        int $i;
1149        for ($i=1; $i<=$numClips; $i++)
1150        {
1151                fileInfo ("ogreExporter_exportClip"+$i) `checkBox -q -v ("ExportClip"+$i)`;
1152                fileInfo ("ogreExporter_clipName"+$i) `textField -q -text ("ClipName"+$i)`;
1153                fileInfo ("ogreExporter_clipRangeType"+$i) `radioButtonGrp -q -select ("ClipRangeRadio"+$i)`;
1154                fileInfo ("ogreExporter_clipStart"+$i) `floatField -q -v ("ClipRangeStart"+$i)`;
1155                fileInfo ("ogreExporter_clipEnd"+$i) `floatField -q -v ("ClipRangeEnd"+$i)`;
1156                fileInfo ("ogreExporter_clipRangeUnits"+$i) `radioButtonGrp -q -select ("ClipRangeUnits"+$i)`;
1157                fileInfo ("ogreExporter_clipRateType"+$i) `radioButtonGrp -q -select ("ClipRateType"+$i)`;
1158                fileInfo ("ogreExporter_clipRateFrames"+$i) `intField -q -v ("ClipRateFrames"+$i)`;
1159                fileInfo ("ogreExporter_clipRangeSeconds"+$i) `floatField -q -v ("ClipRateSeconds"+$i)`;
1160        }
1161
1162        // Anim Curves
1163        fileInfo "ogreExporter_exportAnimCurves" `checkBox -q -v ExportAnimCurves`;
1164        fileInfo "ogreExporter_animCurvesFilename" `textField -q -text ExportAnimCurvesFilename`;
1165       
1166        // Cameras
1167        fileInfo "ogreExporter_exportCameras" `checkBox -q -v ExportCameras`;
1168        fileInfo "ogreExporter_exportCamerasAnim" `checkBox -q -v ExportCamerasAnim`;
1169        fileInfo "ogreExporter_camerasFilename" `textField -q -text ExportCamerasFilename`;
1170
1171        // Particles
1172        fileInfo "ogreExporter_exportParticles" `checkBox -q -v ExportParticles`;
1173        fileInfo "ogreExporter_particlesFilename" `textField -q -text ExportParticlesFilename`;
1174}
1175
1176global proc loadSettings()
1177{
1178        string $valStrings[];
1179        int $valInt;
1180        float $valFloat;
1181        $valStrings = `fileInfo -q "ogreExporter_savedSettings"`;
1182        if (`gmatch $valStrings[0] "1"`)
1183        {
1184                // Common parameters
1185                textField -edit -fileName `fileInfo -q "ogreExporter_outputDir"` OutputDirectory;
1186                radioCollection -edit -select `fileInfo -q "ogreExporter_exportType"` ExportTypeCollection;
1187                radioCollection -edit -select `fileInfo -q "ogreExporter_coordsType"` CoordsTypeCollection;
1188       
1189                // Mesh
1190                $valStrings = `fileInfo -q "ogreExporter_exportMesh"`;
1191                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMesh;
1192                $valStrings = `fileInfo -q "ogreExporter_useSharedGeom"`;
1193                checkBox -edit -v `gmatch $valStrings[0] "1"` UseSharedGeometry;
1194                $valStrings = `fileInfo -q "ogreExporter_exportVBA"`;
1195                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportVBA;
1196                $valStrings = `fileInfo -q "ogreExporter_exportNormals"`;
1197                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshNormals;
1198                $valStrings = `fileInfo -q "ogreExporter_exportColours"`;
1199                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshColours;
1200                $valStrings = `fileInfo -q "ogreExporter_exportColWhite"`;
1201                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshColoursWhite;
1202                $valStrings = `fileInfo -q "ogreExporter_exportUVs"`;
1203                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshUVs;
1204                textField -edit -text `fileInfo -q "ogreExporter_meshFilename"` ExportMeshFilename;
1205                $valStrings = `fileInfo -q "ogreExporter_exportMeshBin"`;
1206                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshBin;
1207                $valStrings = `fileInfo -q "ogreExporter_buildEdges"`;
1208                checkBox -edit -v `gmatch $valStrings[0] "1"` BuildEdges;
1209                $valStrings = `fileInfo -q "ogreExporter_buildTangents"`;
1210                checkBox -edit -v `gmatch $valStrings[0] "1"` BuildTangents;
1211       
1212                // Materials
1213                $valStrings = `fileInfo -q "ogreExporter_exportMat"`;
1214                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMaterial;
1215                textField -edit -text `fileInfo -q "ogreExporter_materialFile"` ExportMaterialFilename;
1216                textField -edit -text `fileInfo -q "ogreExporter_matPrefix"` ExportMaterialPrefix;
1217                $valStrings = `fileInfo -q "ogreExporter_copyTextures"`;
1218                checkBox -edit -v `gmatch $valStrings[0] "1"` CopyTextures;
1219                $valStrings = `fileInfo -q "ogreExporter_lightingOff"`;
1220                checkBox -edit -v `gmatch $valStrings[0] "1"` MatLightingOff;
1221       
1222                // Skeleton             
1223                $valStrings = `fileInfo -q "ogreExporter_exportSkel"` ;
1224                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportSkeleton;
1225                textField -edit -text `fileInfo -q "ogreExporter_skelFilename"` ExportSkeletonFilename;
1226                $valStrings = `fileInfo -q "ogreExporter_exportSkelBin"`;
1227                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportSkeletonBin;
1228       
1229                // Animations
1230                $valStrings = `fileInfo -q "ogreExporter_exportAnims"`;
1231                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportAnims;
1232                $valStrings = `fileInfo -q "ogreExporter_neutralPoseType"`;
1233                $valInt = $valStrings[0];
1234                radioButtonGrp -edit -select $valInt NeutralPoseRadio;
1235                $valStrings = `fileInfo -q "ogreExporter_neutralPoseFrame"`;
1236                $valInt = $valStrings[0];
1237                intField -edit -v $valInt NeutralPoseFrame;
1238                $valString = `fileInfo -q "ogreExporter_numClips"`;
1239                int $n = $valString[0];
1240                $valInt = $valString[0];
1241                global int $numClips;
1242                for (;$numClips>1;delClip());
1243                int $i;
1244                for ($i=1; $i<=$n; $i++)
1245                {
1246                        if ($i > 1)
1247                                addClip();
1248                        $valStrings = `fileInfo -q ("ogreExporter_exportClip"+$i)`;
1249                        checkBox -edit -v `gmatch $valStrings[0] "1"` ("ExportClip"+$i);
1250                        textField -edit -text `fileInfo -q ("ogreExporter_clipName"+$i)` ("ClipName"+$i);
1251                        $valStrings = `fileInfo -q ("ogreExporter_clipRangeType"+$i)`;
1252                        $valInt = $valStrings[0];
1253                        radioButtonGrp -edit -select $valInt ("ClipRangeRadio"+$i);
1254                        $valStrings = `fileInfo -q ("ogreExporter_clipStart"+$i)`;
1255                        $valFloat = $valStrings[0];
1256                        floatField -edit -v $valFloat ("ClipRangeStart"+$i);
1257                        $valStrings = `fileInfo -q ("ogreExporter_clipEnd"+$i)`;
1258                        $valFloat = $valStrings[0];
1259                        floatField -edit -v $valFloat ("ClipRangeEnd"+$i);
1260                        $valStrings = `fileInfo -q ("ogreExporter_clipRangeUnits"+$i)`;
1261                        $valInt = $valStrings[0];
1262                        radioButtonGrp -edit -select $valInt ("ClipRangeUnits"+$i);
1263                        $valStrings = `fileInfo -q ("ogreExporter_clipRateType"+$i)`;
1264                        $valInt = $valStrings[0];
1265                        radioButtonGrp -edit -select $valInt ("ClipRateType"+$i);
1266                        $valStrings = `fileInfo -q ("ogreExporter_clipRateFrames"+$i)`;
1267                        $valInt = $valStrings[0];
1268                        intField -edit -v $valInt ("ClipRateFrames"+$i);
1269                        $valStrings = `fileInfo -q ("ogreExporter_clipRateSeconds"+$i)`;
1270                        $valFloat = $valStrings[0];
1271                        floatField -edit -v $valFloat ("ClipRateSeconds"+$i);
1272                }
1273       
1274                // Anim Curves
1275                $valStrings = `fileInfo -q "ogreExporter_exportAnimCurves"`;
1276                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportAnimCurves;
1277                textField -edit -text `fileInfo -q "ogreExporter_animCurvesFilename"` ExportAnimCurvesFilename;
1278       
1279                // Cameras
1280                $valStrings = `fileInfo -q "ogreExporter_exportCameras"`;
1281                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportCameras;
1282                $valStrings = `fileInfo -q "ogreExporter_exportCamerasAnim"`;
1283                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportCamerasAnim;
1284                textField -edit -text `fileInfo -q "ogreExporter_camerasFilename"` ExportCamerasFilename;
1285       
1286                // Particles
1287                $valStrings = `fileInfo -q "ogreExporter_exportParticles"`;
1288                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportParticles;
1289                textField -edit -text `fileInfo -q "ogreExporter_particlesFilename"` ExportParticlesFilename;
1290
1291                formatUI();
1292        }
1293}
1294
1295global proc defaultSettings()
1296{
1297        // Common parameters
1298        textField -edit -fileName "" OutputDirectory;
1299        radioCollection -edit -select "RadioButtonAll" ExportTypeCollection;
1300        radioCollection -edit -select "RadioButtonWorld" CoordsTypeCollection;
1301
1302        // Mesh
1303        checkBox -edit -v 0 ExportMesh;
1304        checkBox -edit -v 1 UseSharedGeometry;
1305        checkBox -edit -v 1 ExportVBA;
1306        checkBox -edit -v 1 ExportMeshNormals;
1307        checkBox -edit -v 0 ExportMeshColours;
1308        checkBox -edit -v 0 ExportMeshColoursWhite;
1309        checkBox -edit -v 1 ExportMeshUVs;
1310        textField -edit -text "" ExportMeshFilename;
1311        checkBox -edit -v 0 ExportMeshBin;
1312        checkBox -edit -v 0 BuildEdges;
1313        checkBox -edit -v 0 BuildTangents;
1314
1315        // Materials
1316        checkBox -edit -v 0 ExportMaterial;
1317        textField -edit -text "" ExportMaterialFilename;
1318        textField -edit -text "" ExportMaterialPrefix;
1319        checkBox -edit -v 0 CopyTextures;
1320        checkBox -edit -v 0 MatLightingOff;
1321
1322        // Skeleton     
1323        checkBox -edit -v 0 ExportSkeleton;
1324        textField -edit -text "" ExportSkeletonFilename;
1325        checkBox -edit -v 0 ExportSkeletonBin;
1326
1327        // Animations
1328        checkBox -edit -v 0 ExportAnims;
1329        radioButtonGrp -edit -select 1 NeutralPoseRadio;
1330        intField -edit -v 0 NeutralPoseFrame;
1331        global int $numClips;
1332        for (;$numClips>1;delClip());
1333        checkBox -edit -v 0 ExportClip1;
1334        textField -edit -text "clip1" ClipName1;
1335        radioButtonGrp -edit -select 1 ClipRangeRadio1;
1336        floatField -edit -v 0 ClipRangeStart1;
1337        floatField -edit -v 0 ClipRangeEnd1;
1338        radioButtonGrp -edit -select 1 ClipRangeUnits1;
1339        radioButtonGrp -edit -select 1 ClipRateType1;
1340        intField -edit -v 1 ClipRateFrames1;
1341        floatField -edit -v 0.1 ClipRateSeconds1;
1342
1343        // Anim Curves
1344        checkBox -edit -v 0 ExportAnimCurves;
1345        textField -edit -text "" ExportAnimCurvesFilename;
1346
1347        // Cameras
1348        checkBox -edit -v 0 ExportCameras;
1349        checkBox -edit -v 0 ExportCamerasAnim;
1350        textField -edit -text `fileInfo -q "ogreExporter_camerasFilename"` ExportCamerasFilename;
1351
1352        // Particles
1353        checkBox -edit -v 0 ExportParticles;
1354        textField -edit -text "" ExportParticlesFilename;
1355
1356        // Initialize filenames
1357        string $sceneFile = `file -query -sceneName`;
1358        string $sceneDir = dirname($sceneFile);
1359        string $baseFile = basename($sceneFile, ".mb");
1360        textField -edit -fileName $sceneDir SceneDirectory;
1361       
1362        // --- Mesh Export
1363        string $meshFile = $baseFile + ".mesh.xml";
1364        textField -edit -fileName $meshFile ExportMeshFilename;
1365       
1366        // --- Material Export
1367        string $matFile = $baseFile + ".material";
1368        textField -edit -fileName $matFile ExportMaterialFilename;
1369
1370        // --- Skeleton Export
1371        string $skelFile = $baseFile + ".skeleton.xml";
1372        textField -edit -fileName $skelFile ExportSkeletonFilename;
1373
1374        // --- Camera Export
1375        string $camFile = $baseFile + ".camera";
1376        textField -edit -fileName $camFile ExportCamerasFilename;
1377
1378        // --- Anim Curves Export
1379        string $animFile = $baseFile + ".anim";
1380        textField -edit -fileName $animFile ExportAnimCurvesFilename;
1381
1382        // --- Particles Export
1383        string $particlesFile = $baseFile + ".particles.xml";
1384        textField -edit -fileName $particlesFile ExportParticlesFilename;
1385
1386        formatUI();
1387}
1388
1389namespace -set ":";
Note: See TracBrowser for help on using the repository browser.