Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/MayaExport/mel/ogreExporter.mel @ 6

Last change on this file since 6 was 6, checked in by anonymous, 17 years ago

=…

File size: 67.3 KB
Line 
1// ===== Load Plug-in
2loadPlugin "ogreExporter";
3
4// ===== Create Ogre menu
5setParent "MayaWindow";
6menu -label "Ogre" -tearOff false;
7        menuItem -label "Export" -command "ogreExporter";
8
9// ===== Launch exporter UI
10global proc ogreExporter()
11{
12        defineOgreExporterUIView();
13        loadOgreExporterSettings();
14}
15
16// ===== Export
17global proc runOgreExport()
18{
19        global int $numSkelClips;
20        global int $numBSClips;
21        global int $numVertClips;
22        // ===== Files and directories
23        string $sceneFile    = `file -query -sceneName`;
24        string $mayaFile     = basename($sceneFile, "");
25        string $sceneDir     = dirname($sceneFile);
26        string $baseFile     = basename($sceneFile, ".mb");
27        string $outputDir    = (`textField -query -text OutputDirectory`);
28        if (!endsWith($outputDir,"\\") && !endsWith($outputDir,"/") && (size($outputDir)>0))
29                $outputDir += "/";
30        string $meshFile     = (`textField -query -text ExportMeshFilename`);
31        string $materialFile = (`textField -query -text ExportMaterialFilename`);
32        string $skeletonFile = (`textField -query -text ExportSkeletonFilename`);
33        string $animFile     = (`textField -query -text ExportAnimCurvesFilename`);
34        string $camerasFile  = (`textField -query -text ExportCamerasFilename`);
35        string $particlesFile= (`textField -query -text ExportParticlesFilename`);
36
37        // ===== Options
38        string $options = "";
39        string $selectedExportTypeButton = `radioCollection -query -select ExportTypeCollection`;
40        if ($selectedExportTypeButton == "RadioButtonSelected")
41        {
42                $options += " -sel";
43        }
44        else
45        {
46                $options += " -all";
47        }
48        string $selectedCoordsTypeButton = `radioCollection -query -select CoordsTypeCollection`;
49        if ($selectedCoordsTypeButton == "RadioButtonWorld")
50        {
51                $options += " -world";
52        }
53        else
54        {
55                $options += " -obj";
56        }
57        $options += " -lu";
58        int $lenghtUnit = `optionMenu -query -select UnitsMenu`;
59        switch ($lenghtUnit)
60        {
61                case 1:
62                        $options += " pref";
63                        break;
64                case 2:
65                        $options += " mm";
66                        break;
67                case 3:
68                        $options += " cm";
69                        break;
70                case 4:
71                        $options += " m";
72                        break;
73                case 5:
74                        $options += " in";
75                        break;
76                case 6:
77                        $options += " ft";
78                        break;
79                case 7:
80                        $options += " yd";
81                        break; 
82        }
83        $options += " -scale ";
84        float $globScale = `floatField -query -value GlobalScale`;
85        $options += $globScale;
86
87        // --- Mesh export
88        int $exportMesh = `checkBox -query -value ExportMesh`;
89        if ($exportMesh)
90        {
91                $options += " -mesh";
92                $options += " \"" + encodeString(toNativePath($outputDir+$meshFile)) + "\"";
93
94                if (`checkBox -query -value UseSharedGeometry`)
95                {
96                        $options += " -shared";
97                }
98
99            if (`checkBox -query -value ExportVBA`)
100                {
101                        $options += " -v";
102                }
103
104                if (`checkBox -query -value ExportMeshNormals`)
105                {
106                        $options += " -n";
107                }
108
109                if (`checkBox -query -value ExportMeshColours`)
110                {
111                        $options += " -c";
112                }
113
114                if (`checkBox -query -value ExportMeshUVs`)
115                {
116                        $options += " -t";
117                }
118                if (`checkBox -query -value BuildEdges`)
119                {
120                        $options += " -edges";
121                }
122                if (`checkBox -query -value BuildTangents`)
123                {
124                        $options += " -tangents";
125                        if (`radioButton -query -select TangentSemanticTexCoord`)
126                                $options += " -TEXCOORD";
127                        else
128                                $options += " -TANGENT";
129                }
130        }
131       
132        // --- Material export
133        int $exportMaterial = `checkBox -query -value ExportMaterial`;
134        if ($exportMaterial)
135        {
136                $options += " -mat \"" + encodeString(toNativePath($outputDir+$materialFile)) + "\"";
137                string $matPrefix = `textField -query -text ExportMaterialPrefix`;
138                if ($matPrefix != "")
139                {
140                        $options += " -matPrefix \"" + $matPrefix + "\"";
141                }
142                if (`checkBox -query -value CopyTextures`)
143                {
144                        $options += " -copyTex \"" + encodeString(toNativePath($outputDir)) + "\"";
145                }
146                if (`checkBox -query -value MatLightingOff`)
147                {
148                        $options += " -lightOff";
149                }
150        }
151
152        // --- Skeleton export
153        int $exportSkeleton = `checkBox -query -value ExportSkeleton`;
154        if ($exportSkeleton)
155        {
156                $options += " -skel \"" + encodeString(toNativePath($outputDir+$skeletonFile)) + "\"";
157        }       
158
159        // --- Skeleton Animations export
160        int $exportSkelAnims = `checkBox -query -value ExportSkelAnims`;
161        if ($exportSkelAnims)
162        {
163                $options += " -skeletonAnims";
164               
165                // check if we need to include skeleton animations in bounding box calculation
166                int $skelBB = `checkBox -query -value SkelBB`;
167                if ($skelBB)
168                {
169                        $options += " -skelBB";
170                }       
171
172                // neutral pose
173                int $neutralPose = `radioButtonGrp -q -select NeutralPoseRadio`;
174                if ($neutralPose == 1)
175                {
176                        $options += " -np curFrame";
177                }
178                else if ($neutralPose == 2)
179                {
180                        $options += " -np bindPose";
181                }
182
183                // clips
184                int $i;
185                for ($i=1; $i<=$numSkelClips; $i++)
186                {
187                        string $command = "checkBox -q -v ExportSkelClip" + $i;
188                        if(eval($command))
189                        {       
190                                $options += " -skeletonClip ";
191                                // clip name
192                                $options += "\"" + eval("textField -q -tx SkelClipName"+$i) + "\"";
193                                // clip range
194                                int $skelClipRangeType = eval("radioButtonGrp -q -sl SkelClipRangeRadio"+$i);
195                                if ($skelClipRangeType == 1)
196                                {
197                                        $options += " startEnd ";
198                                        $options += eval("floatField -q -v SkelClipRangeStart"+$i);
199                                        $options += " " + eval("floatField -q -v SkelClipRangeEnd"+$i);
200                                        int $skelRangeUnits = eval("radioButtonGrp -q -sl SkelClipRangeUnits"+$i);
201                                        if ($skelRangeUnits == 1)
202                                                $options += " frames";
203                                        else
204                                                $options += " seconds";
205                                }
206                                else
207                                        $options += " timeSlider";
208                                // sample rate
209                                int $skelClipRateType = eval("radioButtonGrp -q -sl SkelClipRateType"+$i);
210                                if ($skelClipRateType == 1)
211                                {
212                                        $options += " sampleByFrames ";
213                                        $options += eval("intField -q -v SkelClipRateFrames"+$i);
214                                }
215                                else
216                                {
217                                        $options += " sampleBySec ";
218                                        $options += eval("floatField -q -v SkelClipRateSeconds"+$i);
219                                }
220                        }
221                }
222        }
223       
224        // --- Blend Shape export
225        int $exportBlendShapes = `checkBox -query -value ExportBlendShapes`;
226        if ($exportBlendShapes)
227        {
228                $options += " -blendShapes";
229               
230                // check if we need to include blendshape animations in bounding box calculation
231                int $bsBB = `checkBox -query -value BsBB`;
232                if ($bsBB)
233                {
234                        $options += " -bsBB";
235                }
236        }
237       
238        // --- Blend Shape Animations export
239        int $exportBSAnims = `checkBox -query -value ExportBSAnims`;
240        if ($exportBSAnims)
241        {
242                $options += " -BSAnims";       
243
244                // clips
245                int $i;
246                for ($i=1; $i<=$numBSClips; $i++)
247                {
248                        string $command = "checkBox -q -v ExportBSClip" + $i;
249                        if(eval($command))
250                        {       
251                                $options += " -BSClip ";
252                                // clip name
253                                $options += "\"" + eval("textField -q -tx BSClipName"+$i) + "\"";
254                                // clip range
255                                int $clipRangeType = eval("radioButtonGrp -q -sl BSClipRangeRadio"+$i);
256                                if ($clipRangeType == 1)
257                                {
258                                        $options += " startEnd ";
259                                        $options += eval("floatField -q -v BSClipRangeStart"+$i);
260                                        $options += " " + eval("floatField -q -v BSClipRangeEnd"+$i);
261                                        int $rangeUnits = eval("radioButtonGrp -q -sl BSClipRangeUnits"+$i);
262                                        if ($rangeUnits == 1)
263                                                $options += " frames";
264                                        else
265                                                $options += " seconds";
266                                }
267                                else
268                                        $options += " timeSlider";
269                                // sample rate
270                                int $clipRateType = eval("radioButtonGrp -q -sl BSClipRateType"+$i);
271                                if ($clipRateType == 1)
272                                {
273                                        $options += " sampleByFrames ";
274                                        $options += eval("intField -q -v BSClipRateFrames"+$i);
275                                }
276                                else
277                                {
278                                        $options += " sampleBySec ";
279                                        $options += eval("floatField -q -v BSClipRateSeconds"+$i);
280                                }
281                        }
282                }
283        }       
284
285        // --- Vertex Animations export
286        int $exportVertexAnims = `checkBox -query -value ExportVertexAnims`;
287        if ($exportVertexAnims)
288        {
289                $options += " -vertexAnims";
290               
291                // check if we need to include vertex animations in bounding box calculation
292                int $vertBB = `checkBox -query -value VertBB`;
293                if ($vertBB)
294                {
295                        $options += " -vertBB";
296                }       
297
298                // clips
299                int $i;
300                for ($i=1; $i<=$numVertClips; $i++)
301                {
302                        string $command = "checkBox -q -v ExportVertexClip" + $i;
303                        if(eval($command))
304                        {       
305                                $options += " -vertexClip ";
306                                // clip name
307                                $options += "\"" + eval("textField -q -tx VertexClipName"+$i) + "\"";
308                                // clip range
309                                int $clipRangeType = eval("radioButtonGrp -q -sl VertexClipRangeRadio"+$i);
310                                if ($clipRangeType == 1)
311                                {
312                                        $options += " startEnd ";
313                                        $options += eval("floatField -q -v VertexClipRangeStart"+$i);
314                                        $options += " " + eval("floatField -q -v VertexClipRangeEnd"+$i);
315                                        int $rangeUnits = eval("radioButtonGrp -q -sl VertexClipRangeUnits"+$i);
316                                        if ($rangeUnits == 1)
317                                                $options += " frames";
318                                        else
319                                                $options += " seconds";
320                                }
321                                else
322                                        $options += " timeSlider";
323                                // sample rate
324                                int $clipRateType = eval("radioButtonGrp -q -sl VertexClipRateType"+$i);
325                                if ($clipRateType == 1)
326                                {
327                                        $options += " sampleByFrames ";
328                                        $options += eval("intField -q -v VertexClipRateFrames"+$i);
329                                }
330                                else
331                                {
332                                        $options += " sampleBySec ";
333                                        $options += eval("floatField -q -v VertexClipRateSeconds"+$i);
334                                }
335                        }
336                }
337        }
338
339        // --- Anim Curves export
340        int $exportAnimCurves = `checkBox -query -value ExportAnimCurves`;
341        if ($exportAnimCurves)
342        {
343                $options += " -animCur \"" + encodeString(toNativePath($outputDir+$animFile)) + "\"";
344        }
345
346        // --- Cameras export
347        int $exportCameras = `checkBox -query -value ExportCameras`;
348        if ($exportCameras)
349        {
350                $options += " -cam \"" + encodeString(toNativePath($outputDir+$camerasFile)) + "\"";
351                if (`checkBox -query -value ExportCamerasAnim`)
352                {
353                        $options += " -camAnim";
354                }
355        }
356
357        // --- Particles export
358        int $exportParticles = `checkBox -query -value ExportParticles`;
359        if ($exportParticles)
360        {
361                $options += " -particles \"" + encodeString(toNativePath($outputDir+$particlesFile)) + "\"";
362        }
363               
364        // ===== Export
365        print ("ogreExport" + $options + ";\n");
366        eval ("ogreExport" + $options);
367}
368
369// ===== Format UI
370// (Primarily enabling/disabling controls)
371global proc formatOgreExporterUI()
372{
373        global int $numSkelClips;
374        global int $numBSClips;
375        global int $numVertClips;
376        // --- Common parameters
377        int $animType = `optionMenu -q -select AnimationTypeMenu`;
378
379        // --- Mesh Export
380        int $exportMesh = `checkBox -q -v ExportMesh`;
381        checkBox -edit -enable $exportMesh UseSharedGeometry;
382      checkBox -edit -enable $exportMesh ExportVBA;
383        checkBox -edit -enable $exportMesh ExportMeshNormals;
384        checkBox -edit -enable $exportMesh ExportMeshColours;
385        int $exportColours = `checkBox -query -value ExportMeshColours`;
386        checkBox -edit -enable $exportMesh ExportMeshUVs;
387        text -edit -enable $exportMesh ExportMeshFilenameLabel;
388        textField -edit -enable $exportMesh ExportMeshFilename;
389        checkBox -edit -enable $exportMesh BuildEdges;
390        checkBox -edit -enable $exportMesh BuildTangents;
391        int $buildTangents = `checkBox -query -value BuildTangents`;
392        if ($exportMesh)
393        {
394                text -edit -enable $buildTangents TangentSemanticLabel;
395                radioButton -edit -enable $buildTangents TangentSemanticTexCoord;
396        //      radioButton -edit -enable $buildTangents TangentSemanticTangent;
397        }
398        else
399        {
400                text -edit -enable false TangentSemanticLabel;
401                radioButton -edit -enable false TangentSemanticTexCoord;
402        //      radioButton -edit -enable false TangentSemanticTangent;
403        }
404       
405        // --- Material Export
406        int $exportMaterial = `checkBox -query -value ExportMaterial`;
407        text -edit -enable $exportMaterial ExportMaterialFilenameLabel;
408        textField -edit -enable $exportMaterial ExportMaterialFilename;
409        text -edit -enable $exportMaterial ExportMaterialPrefixLabel;
410        textField -edit -enable $exportMaterial ExportMaterialPrefix;
411        if (!$exportMaterial)
412                checkBox -edit -value false CopyTextures;
413        checkBox -edit -enable $exportMaterial CopyTextures;
414        if (!$exportMaterial)
415                checkBox -edit -value false MatLightingOff;
416        checkBox -edit -enable $exportMaterial MatLightingOff;
417
418        // --- Skeleton Export
419        if ($animType == 1)
420        {
421                checkBox -edit -enable true ExportSkeleton;
422        }
423        else
424        {
425                checkBox -edit -value false ExportSkeleton;
426                checkBox -edit -enable false ExportSkeleton;
427        }
428        int $exportSkeleton = `checkBox -query -value ExportSkeleton`;
429        text -edit -enable $exportSkeleton ExportSkeletonFilenameLabel;
430        textField -edit -enable $exportSkeleton ExportSkeletonFilename;
431
432        // --- Skeleton Animations Export
433        if (!$exportSkeleton)
434                checkBox -edit -value false ExportSkelAnims;
435        checkBox -edit -enable $exportSkeleton ExportSkelAnims;
436        int $exportSkelAnims = `checkBox -query -value ExportSkelAnims`;
437        if (!$exportSkelAnims)
438                checkBox -edit -value false SkelBB;
439        checkBox -edit -enable $exportSkelAnims SkelBB;
440        text -edit -enable $exportSkelAnims NeutralPoseLabel;
441        radioButtonGrp -edit -enable $exportSkelAnims NeutralPoseRadio;
442        int $neutralPoseType = `radioButtonGrp -query -select NeutralPoseRadio`;
443        int $i;
444        for ($i=1; $i<=$numSkelClips; $i++)
445        {
446                if (!$exportSkelAnims)
447                        checkBox -edit -value false ("ExportSkelClip"+$i);
448                checkBox -edit -enable $exportSkelAnims ("ExportSkelClip"+$i);
449               
450                int $exportSkelClip = `checkBox -query -value ("ExportSkelClip"+$i)`;
451                textField -edit -enable $exportSkelClip ("SkelClipName"+$i);
452                text -edit -enable $exportSkelClip ("SkelClipRangeLabel"+$i);
453                radioButtonGrp -edit -enable $exportSkelClip ("SkelClipRangeRadio"+$i);
454                text -edit -enable $exportSkelClip ("SkelClipRateTypeLabel"+$i);
455                radioButtonGrp -edit -enable $exportSkelClip ("SkelClipRateType"+$i);
456
457                int $skelRangeType = `radioButtonGrp -query -select ("SkelClipRangeRadio"+$i)`;
458                text -edit -enable (($skelRangeType == 1)&&($exportSkelClip)) ("SkelClipRangeStartLabel"+$i);
459                floatField -edit -enable (($skelRangeType == 1)&&($exportSkelClip)) ("SkelClipRangeStart"+$i);
460                text -edit -enable (($skelRangeType == 1)&&($exportSkelClip)) ("SkelClipRangeEndLabel"+$i);
461                floatField -edit -enable (($skelRangeType == 1)&&($exportSkelClip)) ("SkelClipRangeEnd"+$i);
462                radioButtonGrp -edit -enable (($skelRangeType == 1)&&($exportSkelClip)) ("SkelClipRangeUnits"+$i);
463
464                int $skelRateType = `radioButtonGrp -query -select ("SkelClipRateType"+$i)`;
465                intField -edit -enable (($skelRateType == 1)&&($exportSkelClip)) ("SkelClipRateFrames"+$i);
466                floatField -edit -enable (($skelRateType == 2)&&($exportSkelClip)) ("SkelClipRateSeconds"+$i);
467        }
468       
469        // --- Blend Shape Export
470        if (!$exportMesh)
471                checkBox -edit -value false ExportBlendShapes;
472        if ($animType == 1)
473        {
474                checkBox -edit -enable $exportMesh ExportBlendShapes;
475        }
476        else
477        {
478                checkBox -edit -value false ExportBlendShapes;
479                checkBox -edit -enable false ExportBlendShapes;
480        }
481        int $exportBS = `checkBox -query -value ExportBlendShapes`;
482        if (!$exportBS)
483                checkBox -edit -value false BsBB;
484        checkBox -edit -enable $exportBS BsBB;
485       
486        // --- Blend Shape Animations Export
487        if (!$exportBS)
488                checkBox -edit -value false ExportBSAnims;
489        checkBox -edit -enable $exportBS ExportBSAnims;
490        int $exportBSAnims = `checkBox -query -value ExportBSAnims`;
491        int $i;
492        for ($i=1; $i<=$numBSClips; $i++)
493        {
494                if (!$exportBSAnims)
495                        checkBox -edit -value false ("ExportBSClip"+$i);
496                checkBox -edit -enable $exportBSAnims ("ExportBSClip"+$i);
497               
498                int $exportBSClip = `checkBox -query -value ("ExportBSClip"+$i)`;
499                textField -edit -enable $exportBSClip ("BSClipName"+$i);
500                text -edit -enable $exportBSClip ("BSClipRangeLabel"+$i);
501                radioButtonGrp -edit -enable $exportBSClip ("BSClipRangeRadio"+$i);
502                text -edit -enable $exportBSClip ("BSClipRateTypeLabel"+$i);
503                radioButtonGrp -edit -enable $exportBSClip ("BSClipRateType"+$i);
504
505                int $skelRangeType = `radioButtonGrp -query -select ("BSClipRangeRadio"+$i)`;
506                text -edit -enable (($skelRangeType == 1)&&($exportBSClip)) ("BSClipRangeStartLabel"+$i);
507                floatField -edit -enable (($skelRangeType == 1)&&($exportBSClip)) ("BSClipRangeStart"+$i);
508                text -edit -enable (($skelRangeType == 1)&&($exportBSClip)) ("BSClipRangeEndLabel"+$i);
509                floatField -edit -enable (($skelRangeType == 1)&&($exportBSClip)) ("BSClipRangeEnd"+$i);
510                radioButtonGrp -edit -enable (($skelRangeType == 1)&&($exportBSClip)) ("BSClipRangeUnits"+$i);
511
512                int $skelRateType = `radioButtonGrp -query -select ("BSClipRateType"+$i)`;
513                intField -edit -enable (($skelRateType == 1)&&($exportBSClip)) ("BSClipRateFrames"+$i);
514                floatField -edit -enable (($skelRateType == 2)&&($exportBSClip)) ("BSClipRateSeconds"+$i);
515        }
516       
517        // --- Vertex Animations Export
518        if (!$exportMesh)
519                checkBox -edit -value false ExportVertexAnims;
520        if ($animType == 2)
521        {
522                checkBox -edit -enable $exportMesh ExportVertexAnims;
523        }
524        else
525        {
526                checkBox -edit -value false ExportVertexAnims;
527                checkBox -edit -enable false ExportVertexAnims;
528        }
529        int $exportVertexAnims = `checkBox -query -value ExportVertexAnims`;
530        if (!$exportVertexAnims)
531                checkBox -edit -value false VertBB;
532        checkBox -edit -enable $exportVertexAnims VertBB;
533        int $i;
534        for ($i=1; $i<=$numVertClips; $i++)
535        {
536                if (!$exportVertexAnims)
537                        checkBox -edit -value false ("ExportVertexClip"+$i);
538                checkBox -edit -enable $exportVertexAnims ("ExportVertexClip"+$i);
539               
540                int $exportVertexClip = `checkBox -query -value ("ExportVertexClip"+$i)`;
541                textField -edit -enable $exportVertexClip ("VertexClipName"+$i);
542                text -edit -enable $exportVertexClip ("VertexClipRangeLabel"+$i);
543                radioButtonGrp -edit -enable $exportVertexClip ("VertexClipRangeRadio"+$i);
544                text -edit -enable $exportVertexClip ("VertexClipRateTypeLabel"+$i);
545                radioButtonGrp -edit -enable $exportVertexClip ("VertexClipRateType"+$i);
546
547                int $rangeType = `radioButtonGrp -query -select ("VertexClipRangeRadio"+$i)`;
548                text -edit -enable (($rangeType == 1)&&($exportVertexClip)) ("VertexClipRangeStartLabel"+$i);
549                floatField -edit -enable (($rangeType == 1)&&($exportVertexClip)) ("VertexClipRangeStart"+$i);
550                text -edit -enable (($rangeType == 1)&&($exportVertexClip)) ("VertexClipRangeEndLabel"+$i);
551                floatField -edit -enable (($rangeType == 1)&&($exportVertexClip)) ("VertexClipRangeEnd"+$i);
552                radioButtonGrp -edit -enable (($rangeType == 1)&&($exportVertexClip)) ("VertexClipRangeUnits"+$i);
553
554                int $rateType = `radioButtonGrp -query -select ("VertexClipRateType"+$i)`;
555                intField -edit -enable (($rateType == 1)&&($exportVertexClip)) ("VertexClipRateFrames"+$i);
556                floatField -edit -enable (($rateType == 2)&&($exportVertexClip)) ("VertexClipRateSeconds"+$i);
557        }
558               
559        // --- Anim Curves Export
560        int $exportAnimCurves = `checkBox -query -value ExportAnimCurves`;
561        text -edit -enable $exportAnimCurves ExportAnimCurvesFilenameLabel;
562        textField -edit -enable $exportAnimCurves ExportAnimCurvesFilename;
563
564        // --- Camera Export
565        int $exportCameras = `checkBox -query -value ExportCameras`;
566        checkBox -edit -enable ($exportCameras && $exportAnimCurves) ExportCamerasAnim;
567        if (!$exportAnimCurves)
568        {
569                checkBox -edit -value false ExportCamerasAnim;
570        }
571        text -edit -enable $exportCameras ExportCamerasFilenameLabel;
572        textField -edit -enable $exportCameras ExportCamerasFilename;
573
574        // --- particles Export
575        int $exportParticles = `checkBox -query -value ExportParticles`;
576        text -edit -enable $exportParticles ExportParticlesFilenameLabel;
577        textField -edit -enable $exportParticles ExportParticlesFilename;
578}
579
580// ===== Define UI
581global proc defineOgreExporterUIView()
582{
583        global int $numSkelClips;
584        $numSkelClips = 0;
585        global int $numBSClips;
586        $numBSClips = 0;
587        global int $numVertClips;
588        $numVertClips = 0;
589
590        // --- Main window for Ogre exporter
591        if (`window -exists "OgreExportWindow"`)
592        {
593                deleteUI OgreExportWindow;
594        }
595        window
596        -title "Ogre Exporter"
597                OgreExportWindow;
598        scrollLayout
599        OgreExportScrollLayout;
600        columnLayout
601        OgreExportLayout;
602
603                // --- Common Parameters Frame
604                frameLayout
605                        -parent OgreExportLayout
606                        -label "Common Parameters"
607                        -collapsable true
608                CommonFrame;
609
610                        columnLayout
611                                -parent CommonFrame
612                                -columnAttach "left" 20
613                        CommonLayout;
614
615                                text 
616                                        -parent CommonLayout   
617                                        -label "Current Directory"
618                                SceneDirectoryLabel;
619                               
620                                textField
621                                        -parent CommonLayout
622                                        -width 305
623                                        -editable false
624                                SceneDirectory;
625
626                                text 
627                                        -parent CommonLayout   
628                                        -label "Output Directory"
629                                OutputDirectoryLabel;
630                               
631                                textField
632                                        -parent CommonLayout
633                                        -width 305
634                                OutputDirectory;
635
636                                rowColumnLayout
637                                        -parent CommonLayout
638                                        -numberOfColumns 3
639                                ExportTypeLayout;
640
641                                        text -label "Export:";
642                                        radioCollection ExportTypeCollection;
643                                        radioButton -label "all" -select RadioButtonAll;
644                                        radioButton -label "selected" RadioButtonSelected;
645
646                                rowColumnLayout
647                                        -parent CommonLayout
648                                        -numberOfColumns 3
649                                CoordsType;
650
651                                        text -label "Coordinate space:";
652                                        radioCollection CoordsTypeCollection;
653                                        radioButton -label "world" -select RadioButtonWorld;
654                                        radioButton -label "object" RadioButtonObject;
655
656                                rowColumnLayout
657                                        -parent CommonLayout
658                                        -numberOfColumns 2
659                                        -columnWidth 1 100
660                                        -columnWidth 2 150
661                                GeneralOptionsLayout;
662
663                                        // Length measurement units
664 
665                                        text -label "Length Units:"
666                                             -parent GeneralOptionsLayout;
667
668                                        optionMenu -parent GeneralOptionsLayout
669                                                -w 200
670                                        UnitsMenu;
671                       
672                                                menuItem -label "from prefs";
673                                                menuItem -label "millimeter";
674                                                menuItem -label "centimeter";
675                                                menuItem -label "meter";
676                                                menuItem -label "inch";
677                                                menuItem -label "foot";
678                                                menuItem -label "yard";
679
680                                        optionMenu -edit -select 1 UnitsMenu;
681
682                                        // Animation type
683
684                                        text -label "Animation Type:"
685                                             -parent GeneralOptionsLayout;
686
687                                        optionMenu -parent GeneralOptionsLayout
688                                                   -changeCommand "formatOgreExporterUI"
689                                                   -w 200
690                                        AnimationTypeMenu;
691
692                                                menuItem -label "Skeleton / Blend Shapes";
693                                                menuItem -label "Vertex";
694
695                                        optionMenu -edit -select 1 AnimationTypeMenu;
696
697                                        // Global scale
698
699                                        text -label "Scale all by:"
700                                             -parent GeneralOptionsLayout;
701
702                                        floatField
703                                                -parent GeneralOptionsLayout
704                                                -width 50
705                                                -value 1
706                                        GlobalScale;
707
708                // --- Mesh
709                frameLayout
710                        -parent OgreExportLayout
711                        -collapsable true
712                        -label "Mesh"
713                MeshFrame;
714
715                        columnLayout
716                                -parent MeshFrame
717                                -columnAttach "left" 20
718                        MeshLayout;
719                               
720                                checkBox
721                                        -parent MeshLayout
722                                        -value false
723                                        -changeCommand "formatOgreExporterUI"
724                                        -label "Export mesh"
725                                ExportMesh;
726
727                                checkBox
728                                        -parent MeshLayout
729                                        -value false
730                                        -changeCommand "formatOgreExporterUI"
731                                        -label "Use shared geometry"
732                                UseSharedGeometry;
733
734                        checkBox
735                                        -parent MeshLayout
736                                        -value true 
737                                        -enable false
738                                        -label "Include vertex bone assignements"
739                                ExportVBA;
740
741                                checkBox
742                                        -parent MeshLayout
743                                        -value true 
744                                        -enable false
745                                        -label "Include vertex normals"
746                                ExportMeshNormals;
747                               
748                                checkBox
749                                        -parent MeshLayout
750                                        -value false 
751                                        -changeCommand "formatOgreExporterUI"
752                                        -enable false
753                                        -label "Include diffuse vertex colours"
754                                ExportMeshColours;
755                               
756                                checkBox
757                                        -parent MeshLayout
758                                        -value true 
759                                        -enable false
760                                        -label "Include texture coordinates"
761                                ExportMeshUVs;
762                               
763                                text     
764                                        -parent MeshLayout
765                                        -label "Mesh Filename"
766                                        -enable false
767                                ExportMeshFilenameLabel;
768                               
769                                textField
770                                        -parent MeshLayout
771                                        -width 305
772                                        -enable false
773                                ExportMeshFilename;
774
775                                checkBox
776                                        -parent MeshLayout
777                                        -value false
778                                        -enable false
779                                        -label "Build edges list (for shadows)"
780                                BuildEdges;
781
782                                checkBox
783                                        -parent MeshLayout
784                                        -value false
785                                        -enable false
786                                        -label "Build tangent vectors (for normal maps)"
787                                        -changeCommand "formatOgreExporterUI"
788                                BuildTangents;
789                               
790                                rowColumnLayout
791                                        -parent MeshLayout
792                                        -numberOfColumns 3
793                                TangentSemanticLayout;
794                               
795                                        text
796                                                -parent TangentSemanticLayout
797                                                -label "Tangent semantic:"
798                                                -enable false
799                                        TangentSemanticLabel;
800                                       
801                                        radioCollection TangentSemanticCollection;
802                                        radioButton -label "TEXCOORD" -enable true -select TangentSemanticTexCoord;
803                                        radioButton -label "TANGENT" -enable false TangentSemanticTangent;
804                                       
805                                       
806
807                // --- Materials
808                frameLayout
809                        -parent OgreExportLayout
810                        -collapsable true
811                        -label "Materials"
812                MaterialFrame;
813
814                        columnLayout
815                                -parent MaterialFrame
816                                -columnAttach "left" 20
817                        MaterialLayout;
818
819                                checkBox
820                                        -parent MaterialLayout
821                                        -value false
822                                        -changeCommand "formatOgreExporterUI"
823                                        -label "Export materials to Ogre .material file"
824                                ExportMaterial;
825                               
826                                text
827                                        -parent MaterialLayout     
828                                        -label "Material Filename"
829                                        -enable false
830                                ExportMaterialFilenameLabel;
831                               
832                                textField
833                                        -parent MaterialLayout
834                                        -width 305
835                                        -enable false
836                                ExportMaterialFilename;
837
838                                text
839                                        -parent MaterialLayout
840                                        -label "Material name prefix"
841                                        -enable false
842                                ExportMaterialPrefixLabel;
843
844                                textField
845                                        -parent MaterialLayout
846                                        -width 305
847                                        -enable false
848                                        -text ""
849                                ExportMaterialPrefix;
850
851                                checkBox
852                                        -parent MaterialLayout
853                                        -value false
854                                        -label "Copy texture files to output dir"
855                                CopyTextures;
856
857                                checkBox
858                                        -parent MaterialLayout
859                                        -value false
860                                        -label "Export with \"ligthing off\" option"
861                                MatLightingOff;
862
863                // --- Skeleton
864                frameLayout
865                        -parent OgreExportLayout
866                        -collapsable true
867                        -label "Skeleton"
868                SkeletonFrame;
869
870                        columnLayout
871                                -parent SkeletonFrame
872                                -columnAttach "left" 20
873                        SkeletonLayout;
874                       
875                                checkBox
876                                        -parent SkeletonLayout
877                                        -value false
878                                        -changeCommand "formatOgreExporterUI"
879                                        -label "Export skeleton"
880                                ExportSkeleton;
881                               
882                                text
883                                        -parent SkeletonLayout
884                                        -label "Skeleton Filename"
885                                        -enable false
886                                ExportSkeletonFilenameLabel;
887                               
888                                textField
889                                        -parent SkeletonLayout
890                                        -width 305
891                                        -enable false
892                                ExportSkeletonFilename;
893
894
895                // --- Skeleton Animations
896                frameLayout
897                        -parent OgreExportLayout
898                        -collapsable true
899                        -label "Skeleton Animations"
900                        -width 329
901                SkelAnimsFrame;
902
903                        columnLayout
904                                -parent SkelAnimsFrame
905                                -columnAttach "left" 20
906                        SkelAnimsLayout;
907
908                                checkBox
909                                        -parent SkelAnimsLayout
910                                        -value false
911                                        -changeCommand "formatOgreExporterUI"
912                                        -label "Export animations (requires export of skeleton)"
913                                ExportSkelAnims;
914                               
915                                checkBox
916                                        -parent SkelAnimsLayout
917                                        -value false
918                                        -changeCommand "formatOgreExporterUI"
919                                        -label "Include animations in bounding box"
920                                SkelBB;
921
922                                text
923                                        -parent SkelAnimsLayout
924                                        -label "Neutral pose:"
925                                NeutralPoseLabel;
926
927                                radioButtonGrp
928                                        -parent SkelAnimsLayout
929                                        -numberOfRadioButtons 2
930                                        -labelArray2 "Current frame" "Skin bind pose"
931                                        -cw 1 100
932                                        -cw 2 100
933                                        -select 1
934                                        -changeCommand "formatOgreExporterUI()"
935                                NeutralPoseRadio;
936
937                                columnLayout
938                                        -parent SkelAnimsLayout
939                                        -columnAttach "left" 0
940                                SkelClipsLayout;
941
942                                rowLayout
943                                        -parent SkelAnimsLayout
944                                        -numberOfColumns 2
945                                        -columnWidth 1 160
946                                        -columnWidth 2 60
947                                        -columnAttach 1 "left" 100
948                                SkelClipsButtonsLayout;
949                       
950                                        button
951                                                -parent SkelClipsButtonsLayout
952                                                -label "Add Clip"
953                                                -width 60
954                                                -command "addOgreExporterSkeletonClip()"
955                                        ButtonAddSkelClip;
956
957                                        button
958                                                -parent SkelClipsButtonsLayout
959                                                -label "Delete Clip"
960                                                -width 60
961                                                -command "delOgreExporterSkeletonClip()"
962                                        ButtonDelSkelClip;
963                                       
964                // --- Blend Shapes
965                frameLayout
966                        -parent OgreExportLayout
967                        -collapsable true
968                        -label "Blend Shapes"
969                        -width 329
970                BlendShapesFrame;
971
972                        columnLayout
973                                -parent BlendShapesFrame
974                                -columnAttach "left" 20
975                        BlendShapesLayout;
976                       
977                                checkBox
978                                        -parent BlendShapesLayout
979                                        -value false
980                                        -changeCommand "formatOgreExporterUI"
981                                        -label "Export blend shapes (to mesh file)"
982                                ExportBlendShapes;
983                               
984                                checkBox
985                                        -parent BlendShapesLayout
986                                        -value false
987                                        -changeCommand "formatOgreExporterUI"
988                                        -label "Include blend shapes in bounding box"
989                                BsBB;
990                               
991                // --- Blend Shapes Animations
992                frameLayout
993                        -parent OgreExportLayout
994                        -collapsable true
995                        -label "Blend Shape Animations"
996                        -width 329
997                BSAnimsFrame;
998
999                        columnLayout
1000                                -parent BSAnimsFrame
1001                                -columnAttach "left" 20
1002                        BSAnimsLayout;
1003
1004                                checkBox
1005                                        -parent BSAnimsLayout
1006                                        -value false
1007                                        -changeCommand "formatOgreExporterUI"
1008                                        -label "Export animations (to mesh file)"
1009                                ExportBSAnims;
1010
1011                                columnLayout
1012                                        -parent BSAnimsLayout
1013                                        -columnAttach "left" 0
1014                                BSClipsLayout;
1015
1016                                rowLayout
1017                                        -parent BSAnimsLayout
1018                                        -numberOfColumns 2
1019                                        -columnWidth 1 160
1020                                        -columnWidth 2 60
1021                                        -columnAttach 1 "left" 100
1022                                BSClipsButtonsLayout;
1023                       
1024                                        button
1025                                                -parent BSClipsButtonsLayout
1026                                                -label "Add Clip"
1027                                                -width 60
1028                                                -command "addOgreExporterBSClip()"
1029                                        ButtonAddBSClip;
1030
1031                                        button
1032                                                -parent BSClipsButtonsLayout
1033                                                -label "Delete Clip"
1034                                                -width 60
1035                                                -command "delOgreExporterBSClip()"
1036                                        ButtonDelBSClip;
1037
1038                // --- Vertex Animations
1039                frameLayout
1040                        -parent OgreExportLayout
1041                        -collapsable true
1042                        -label "Vertex Animations"
1043                        -width 329
1044                VertexAnimsFrame;
1045
1046                        columnLayout
1047                                -parent VertexAnimsFrame
1048                                -columnAttach "left" 20
1049                        VertexAnimsLayout;
1050
1051                                checkBox
1052                                        -parent VertexAnimsLayout
1053                                        -value false
1054                                        -changeCommand "formatOgreExporterUI"
1055                                        -label "Export animations (to mesh file)"
1056                                ExportVertexAnims;
1057                               
1058                                checkBox
1059                                        -parent VertexAnimsLayout
1060                                        -value false
1061                                        -changeCommand "formatOgreExporterUI"
1062                                        -label "Include animations in bounding box"
1063                                VertBB;
1064
1065                                columnLayout
1066                                        -parent VertexAnimsLayout
1067                                        -columnAttach "left" 0
1068                                VertexClipsLayout;
1069
1070                                rowLayout
1071                                        -parent VertexAnimsLayout
1072                                        -numberOfColumns 2
1073                                        -columnWidth 1 160
1074                                        -columnWidth 2 60
1075                                        -columnAttach 1 "left" 100
1076                                VertexClipsButtonsLayout;
1077                       
1078                                        button
1079                                                -parent VertexClipsButtonsLayout
1080                                                -label "Add Clip"
1081                                                -width 60
1082                                                -command "addOgreExporterVertexClip()"
1083                                        ButtonAddVertexClip;
1084
1085                                        button
1086                                                -parent VertexClipsButtonsLayout
1087                                                -label "Delete Clip"
1088                                                -width 60
1089                                                -command "delOgreExporterVertexClip()"
1090                                        ButtonDelVertexClip;
1091
1092                                                               
1093                // --- Anim Curves
1094                frameLayout
1095                        -parent OgreExportLayout
1096                        -collapsable true
1097                        -label "Animation Curves"
1098                AnimCurvesFrame;
1099
1100                        columnLayout
1101                                -parent AnimCurvesFrame
1102                                -columnAttach "left" 20
1103                        AnimCurvesLayout;
1104                       
1105                                checkBox
1106                                        -parent AnimCurvesLayout
1107                                        -value false
1108                                        -changeCommand "formatOgreExporterUI"
1109                                        -label "Export animation curves to Ogre .anim file"
1110                                ExportAnimCurves;
1111                               
1112                                text
1113                                        -parent AnimCurvesLayout     
1114                                        -label "Anim Curves Filename"
1115                                        -enable false
1116                                ExportAnimCurvesFilenameLabel;
1117                               
1118                                textField
1119                                        -parent AnimCurvesLayout
1120                                        -width 305
1121                                        -enable false
1122                                ExportAnimCurvesFilename;
1123
1124                // --- Cameras
1125                frameLayout
1126                        -parent OgreExportLayout
1127                        -collapsable true
1128                        -label "Cameras"
1129                CameraFrame;
1130
1131                        columnLayout
1132                                -parent CameraFrame
1133                                -columnAttach "left" 20
1134                        CameraLayout;
1135
1136                                checkBox
1137                                        -parent CameraLayout
1138                                        -value false
1139                                        -changeCommand "formatOgreExporterUI"
1140                                        -label "Export cameras to Ogre .camera file"
1141                                ExportCameras;
1142
1143                                checkBox
1144                                        -parent CameraLayout
1145                                        -value false
1146                                        -changeCommand "formatOgreExporterUI"
1147                                        -label "Export Camera Animations(requires export of anim curves)"
1148                                ExportCamerasAnim;
1149
1150                                text
1151                                        -parent CameraLayout   
1152                                        -label "Cameras Filename"
1153                                        -enable false
1154                                ExportCamerasFilenameLabel;
1155                               
1156                                textField
1157                                        -parent CameraLayout
1158                                        -width 305
1159                                        -enable false
1160                                ExportCamerasFilename;
1161
1162                // --- Particles
1163                frameLayout
1164                        -parent OgreExportLayout
1165                        -collapsable true
1166                        -label "Particles"
1167                ParticlesFrame;
1168
1169                        columnLayout
1170                                -parent ParticlesFrame
1171                                -columnAttach "left" 20
1172                        ParticlesLayout;
1173                       
1174                                checkBox
1175                                        -parent ParticlesLayout
1176                                        -value false
1177                                        -changeCommand "formatOgreExporterUI"
1178                                        -label "Export particles to Ogre .particles file"
1179                                ExportParticles;
1180                               
1181                                text
1182                                        -parent ParticlesLayout     
1183                                        -label "Particles Filename"
1184                                        -enable false
1185                                ExportParticlesFilenameLabel;
1186                               
1187                                textField
1188                                        -parent ParticlesLayout
1189                                        -width 305
1190                                        -enable false
1191                                ExportParticlesFilename;
1192
1193                // --- Export!
1194                separator
1195                        -parent OgreExportLayout
1196                        -style "none"
1197                        -height 10;
1198
1199                button
1200                        -parent OgreExportLayout
1201                        -label "EXPORT"
1202                        -command "runOgreExport"
1203                        -width 325
1204                ButtonExport;
1205
1206                // --- Manage settings
1207                separator
1208                        -parent OgreExportLayout
1209                        -style "in"
1210                        -width 325
1211                        -height 5;
1212
1213                rowLayout
1214                        -parent OgreExportLayout
1215                        -numberOfColumns 3
1216                        -columnWidth3 110 110 100
1217                        -columnAlign 1 "center"
1218                        -columnAlign 2 "center"
1219                        -columnAlign 3 "center"
1220                SettingsButtonsLayout;
1221
1222                        button
1223                                -parent SettingsButtonsLayout
1224                                -label "Load settings"
1225                                -command "loadOgreExporterSettings"
1226                                -width 100
1227                        LoadSettingsButton;
1228
1229                        button
1230                                -parent SettingsButtonsLayout
1231                                -label "Save settings"
1232                                -command "saveOgreExporterSettings"
1233                                -width 100
1234                        SaveSettingsButton;
1235
1236                        button
1237                                -parent SettingsButtonsLayout
1238                                -label "Default settings"
1239                                -command "defaultOgreExporterSettings"
1240                                -width 100
1241                        DefaultSettingsButton;
1242
1243
1244        // --- Add an empty skeleton clip
1245        addOgreExporterSkeletonClip();
1246        // --- Add an empty blend shape clip
1247        addOgreExporterBSClip();
1248        // --- Add an empty vertex clip
1249        addOgreExporterVertexClip();
1250        // --- Show the Window
1251        showWindow OgreExportWindow;
1252}
1253
1254global proc addOgreExporterSkeletonClip()
1255{
1256        global int $numSkelClips;
1257        $numSkelClips++;
1258
1259        frameLayout
1260                -parent SkelClipsLayout
1261                -width 309
1262                -label ("Clip"+$numSkelClips)
1263        ("SkelClipFrame"+$numSkelClips);
1264
1265                columnLayout
1266                        -parent ("SkelClipFrame"+$numSkelClips)
1267                        -columnAttach "left" 0
1268                ("SkelClipLayout"+$numSkelClips);
1269
1270                rowLayout
1271                        -parent ("SkelClipLayout"+$numSkelClips)
1272                        -numberOfColumns 2
1273                        -columnWidth2 100 200
1274                        -columnOffset2 5 5
1275                        -columnAlign 1 "left"
1276                        -columnAlign 2 "left"
1277                ("SkelClipNameLayout"+$numSkelClips);
1278                                                       
1279                        checkBox
1280                                -parent ("SkelClipNameLayout"+$numSkelClips)
1281                                -value false
1282                                -changeCommand "formatOgreExporterUI"
1283                                -label "Clip Name"
1284                        ("ExportSkelClip"+$numSkelClips);
1285                                       
1286                        textField
1287                                -parent ("SkelClipNameLayout"+$numSkelClips)
1288                                -width 200
1289                                -text ("clip"+$numSkelClips)
1290                        ("SkelClipName"+$numSkelClips);
1291
1292                        separator
1293                                -parent ("SkelClipLayout"+$numSkelClips)
1294                                -style "in"
1295                                -width 309
1296                                -height 5;
1297
1298                        rowLayout
1299                                -parent ("SkelClipLayout"+$numSkelClips)
1300                                -numberOfColumns 2
1301                                -columnWidth2 100 200
1302                                -columnAlign 1 "left"
1303                                -columnAlign 2 "left"
1304                        ("SkelClipRangeTypeLayout"+$numSkelClips);
1305                               
1306                                text
1307                                        -parent ("SkelClipRangeTypeLayout"+$numSkelClips)
1308                                        -label "Time Range:"
1309                                ("SkelClipRangeLabel"+$numSkelClips);
1310                       
1311                                radioButtonGrp
1312                                        -parent ("SkelClipRangeTypeLayout"+$numSkelClips)
1313                                        -numberOfRadioButtons 2
1314                                        -labelArray2 "Start/End" "Time Slider"
1315                                        -cw 1 100
1316                                        -cw 2 100
1317                                        -select 2
1318                                        -changeCommand "formatOgreExporterUI"
1319                                ("SkelClipRangeRadio"+$numSkelClips);
1320
1321                        columnLayout
1322                                -parent ("SkelClipLayout"+$numSkelClips)
1323                                -columnAttach "left" 70
1324                        ("SkelClipRangeLayout"+$numSkelClips);
1325
1326                                rowLayout
1327                                        -parent ("SkelClipRangeLayout"+$numSkelClips)
1328                                        -numberOfColumns 2
1329                                        -columnAlign 1 "left"
1330                                        -columnAlign 2 "left"
1331                                        -columnAttach 1 "both" 0
1332                                        -columnAttach 2 "both" 0
1333                                        -columnOffset2 5 5
1334                                        -columnWidth 1 70
1335                                        -columnWidth 2 50
1336                                ("SkelClipRangeStartLayout"+$numSkelClips);
1337
1338                                        text
1339                                                -parent ("SkelClipRangeStartLayout"+$numSkelClips)
1340                                                -label "Start Time:"
1341                                                -width 50
1342                                        ("SkelClipRangeStartLabel"+$numSkelClips);
1343
1344                                        floatField
1345                                                -parent ("SkelClipRangeStartLayout"+$numSkelClips)
1346                                                -width 50
1347                                                -value 0.000
1348                                        ("SkelClipRangeStart"+$numSkelClips);
1349                               
1350                                rowLayout
1351                                        -parent ("SkelClipRangeLayout"+$numSkelClips)
1352                                        -numberOfColumns 2
1353                                        -columnAlign 1 "left"
1354                                        -columnAlign 2 "left"
1355                                        -columnAttach 1 "both" 0
1356                                        -columnAttach 2 "both" 0
1357                                        -columnOffset2 5 5
1358                                        -columnWidth 1 70
1359                                        -columnWidth 2 50
1360                                ("SkelClipRangeEndLayout"+$numSkelClips);
1361
1362                                        text
1363                                                -parent ("SkelClipRangeEndLayout"+$numSkelClips)
1364                                                -label "End Time:"
1365                                        ("SkelClipRangeEndLabel"+$numSkelClips);
1366
1367                                        floatField
1368                                                -parent ("SkelClipRangeEndLayout"+$numSkelClips)
1369                                                -value 0.000
1370                                                -width 50
1371                                        ("SkelClipRangeEnd"+$numSkelClips);
1372
1373                                columnLayout
1374                                        -parent ("SkelClipRangeLayout"+$numSkelClips)
1375                                        -columnAttach "left" 0
1376                                ("SkelClipRangeUnitsLayout"+$numSkelClips);
1377
1378                                        radioButtonGrp
1379                                                -parent ("SkelClipRangeUnitsLayout"+$numSkelClips)
1380                                                -numberOfRadioButtons 2
1381                                                -labelArray2 "Frames" "Seconds"
1382                                                -cw 1 65
1383                                                -cw 2 65
1384                                                -select 1
1385                                        ("SkelClipRangeUnits"+$numSkelClips);
1386                                       
1387                        separator
1388                                -parent ("SkelClipLayout"+$numSkelClips)
1389                                -style "in"
1390                                -width 309
1391                                -height 5;
1392
1393                        rowLayout
1394                                -parent ("SkelClipLayout"+$numSkelClips)
1395                                -numberOfColumns 2
1396                                -columnWidth 1 70
1397                                -columnWidth 2 230
1398                                -columnAlign 1 "left"
1399                                -columnAlign 2 "left"
1400                                -columnAttach 1 "both" 0
1401                                -columnAttach 2 "both" 0
1402                                -columnOffset2 5 5
1403                        ("SkelClipRateTypeLayout"+$numSkelClips);
1404
1405                                text
1406                                        -parent ("SkelClipRateTypeLayout"+$numSkelClips)
1407                                        -label "Sample by:"
1408                                ("SkelClipRateTypeLabel"+$numSkelClips);
1409       
1410                                radioButtonGrp
1411                                        -parent ("SkelClipRateTypeLayout"+$numSkelClips)
1412                                        -numberOfRadioButtons 2
1413                                        -labelArray2 "Frames" "Seconds"
1414                                        -cw 1 65
1415                                        -cw 2 65
1416                                        -select 1
1417                                        -changeCommand "formatOgreExporterUI"
1418                                ("SkelClipRateType"+$numSkelClips);
1419
1420                        rowLayout
1421                                -parent ("SkelClipLayout"+$numSkelClips)
1422                                -numberOfColumns 2
1423                                -columnWidth 1 125
1424                                -columnWidth 2 80
1425                                -columnAlign 1 "left"
1426                                -columnAlign 2 "left"
1427                                -columnAttach 1 "left" 75
1428                                -columnAttach 2 "both" 15
1429                        ("SkelClipRateLayout"+$numSkelClips);
1430                                                       
1431                                intField
1432                                        -parent ("SkelClipRateLayout"+$numSkelClips)
1433                                        -width 50
1434                                        -value 1.000
1435                                ("SkelClipRateFrames"+$numSkelClips);
1436                       
1437                                floatField
1438                                        -parent ("SkelClipRateLayout"+$numSkelClips)
1439                                        -width 50
1440                                        -value 0.100
1441                                ("SkelClipRateSeconds"+$numSkelClips);
1442        formatOgreExporterUI();
1443}
1444
1445global proc delOgreExporterSkeletonClip()
1446{
1447        global int $numSkelClips;
1448        if ($numSkelClips > 1)
1449        {
1450                deleteUI("SkelClipFrame"+$numSkelClips);
1451                $numSkelClips--;
1452        }
1453        formatOgreExporterUI();
1454}
1455
1456global proc addOgreExporterBSClip()
1457{
1458        global int $numBSClips;
1459        $numBSClips++;
1460
1461        frameLayout
1462                -parent BSClipsLayout
1463                -width 309
1464                -label ("Clip"+$numBSClips)
1465        ("BSClipFrame"+$numBSClips);
1466
1467                columnLayout
1468                        -parent ("BSClipFrame"+$numBSClips)
1469                        -columnAttach "left" 0
1470                ("BSClipLayout"+$numBSClips);
1471
1472                rowLayout
1473                        -parent ("BSClipLayout"+$numBSClips)
1474                        -numberOfColumns 2
1475                        -columnWidth2 100 200
1476                        -columnOffset2 5 5
1477                        -columnAlign 1 "left"
1478                        -columnAlign 2 "left"
1479                ("BSClipNameLayout"+$numBSClips);
1480                                                       
1481                        checkBox
1482                                -parent ("BSClipNameLayout"+$numBSClips)
1483                                -value false
1484                                -changeCommand "formatOgreExporterUI"
1485                                -label "Clip Name"
1486                        ("ExportBSClip"+$numBSClips);
1487                                       
1488                        textField
1489                                -parent ("BSClipNameLayout"+$numBSClips)
1490                                -width 200
1491                                -text ("clip"+$numBSClips)
1492                        ("BSClipName"+$numBSClips);
1493
1494                        separator
1495                                -parent ("BSClipLayout"+$numBSClips)
1496                                -style "in"
1497                                -width 309
1498                                -height 5;
1499
1500                        rowLayout
1501                                -parent ("BSClipLayout"+$numBSClips)
1502                                -numberOfColumns 2
1503                                -columnWidth2 100 200
1504                                -columnAlign 1 "left"
1505                                -columnAlign 2 "left"
1506                        ("BSClipRangeTypeLayout"+$numBSClips);
1507                               
1508                                text
1509                                        -parent ("BSClipRangeTypeLayout"+$numBSClips)
1510                                        -label "Time Range:"
1511                                ("BSClipRangeLabel"+$numBSClips);
1512                       
1513                                radioButtonGrp
1514                                        -parent ("BSClipRangeTypeLayout"+$numBSClips)
1515                                        -numberOfRadioButtons 2
1516                                        -labelArray2 "Start/End" "Time Slider"
1517                                        -cw 1 100
1518                                        -cw 2 100
1519                                        -select 2
1520                                        -changeCommand "formatOgreExporterUI"
1521                                ("BSClipRangeRadio"+$numBSClips);
1522
1523                        columnLayout
1524                                -parent ("BSClipLayout"+$numBSClips)
1525                                -columnAttach "left" 70
1526                        ("BSClipRangeLayout"+$numBSClips);
1527
1528                                rowLayout
1529                                        -parent ("BSClipRangeLayout"+$numBSClips)
1530                                        -numberOfColumns 2
1531                                        -columnAlign 1 "left"
1532                                        -columnAlign 2 "left"
1533                                        -columnAttach 1 "both" 0
1534                                        -columnAttach 2 "both" 0
1535                                        -columnOffset2 5 5
1536                                        -columnWidth 1 70
1537                                        -columnWidth 2 50
1538                                ("BSClipRangeStartLayout"+$numBSClips);
1539
1540                                        text
1541                                                -parent ("BSClipRangeStartLayout"+$numBSClips)
1542                                                -label "Start Time:"
1543                                                -width 50
1544                                        ("BSClipRangeStartLabel"+$numBSClips);
1545
1546                                        floatField
1547                                                -parent ("BSClipRangeStartLayout"+$numBSClips)
1548                                                -width 50
1549                                                -value 0.000
1550                                        ("BSClipRangeStart"+$numBSClips);
1551                               
1552                                rowLayout
1553                                        -parent ("BSClipRangeLayout"+$numBSClips)
1554                                        -numberOfColumns 2
1555                                        -columnAlign 1 "left"
1556                                        -columnAlign 2 "left"
1557                                        -columnAttach 1 "both" 0
1558                                        -columnAttach 2 "both" 0
1559                                        -columnOffset2 5 5
1560                                        -columnWidth 1 70
1561                                        -columnWidth 2 50
1562                                ("BSClipRangeEndLayout"+$numBSClips);
1563
1564                                        text
1565                                                -parent ("BSClipRangeEndLayout"+$numBSClips)
1566                                                -label "End Time:"
1567                                        ("BSClipRangeEndLabel"+$numBSClips);
1568
1569                                        floatField
1570                                                -parent ("BSClipRangeEndLayout"+$numBSClips)
1571                                                -value 0.000
1572                                                -width 50
1573                                        ("BSClipRangeEnd"+$numBSClips);
1574
1575                                columnLayout
1576                                        -parent ("BSClipRangeLayout"+$numBSClips)
1577                                        -columnAttach "left" 0
1578                                ("BSClipRangeUnitsLayout"+$numBSClips);
1579
1580                                        radioButtonGrp
1581                                                -parent ("BSClipRangeUnitsLayout"+$numBSClips)
1582                                                -numberOfRadioButtons 2
1583                                                -labelArray2 "Frames" "Seconds"
1584                                                -cw 1 65
1585                                                -cw 2 65
1586                                                -select 1
1587                                        ("BSClipRangeUnits"+$numBSClips);
1588                                       
1589                        separator
1590                                -parent ("BSClipLayout"+$numBSClips)
1591                                -style "in"
1592                                -width 309
1593                                -height 5;
1594
1595                        rowLayout
1596                                -parent ("BSClipLayout"+$numBSClips)
1597                                -numberOfColumns 2
1598                                -columnWidth 1 70
1599                                -columnWidth 2 230
1600                                -columnAlign 1 "left"
1601                                -columnAlign 2 "left"
1602                                -columnAttach 1 "both" 0
1603                                -columnAttach 2 "both" 0
1604                                -columnOffset2 5 5
1605                        ("BSClipRateTypeLayout"+$numBSClips);
1606
1607                                text
1608                                        -parent ("BSClipRateTypeLayout"+$numBSClips)
1609                                        -label "Sample by:"
1610                                ("BSClipRateTypeLabel"+$numBSClips);
1611       
1612                                radioButtonGrp
1613                                        -parent ("BSClipRateTypeLayout"+$numBSClips)
1614                                        -numberOfRadioButtons 2
1615                                        -labelArray2 "Frames" "Seconds"
1616                                        -cw 1 65
1617                                        -cw 2 65
1618                                        -select 1
1619                                        -changeCommand "formatOgreExporterUI"
1620                                ("BSClipRateType"+$numBSClips);
1621
1622                        rowLayout
1623                                -parent ("BSClipLayout"+$numBSClips)
1624                                -numberOfColumns 2
1625                                -columnWidth 1 125
1626                                -columnWidth 2 80
1627                                -columnAlign 1 "left"
1628                                -columnAlign 2 "left"
1629                                -columnAttach 1 "left" 75
1630                                -columnAttach 2 "both" 15
1631                        ("BSClipRateLayout"+$numBSClips);
1632                                                       
1633                                intField
1634                                        -parent ("BSClipRateLayout"+$numBSClips)
1635                                        -width 50
1636                                        -value 1.000
1637                                ("BSClipRateFrames"+$numBSClips);
1638                       
1639                                floatField
1640                                        -parent ("BSClipRateLayout"+$numBSClips)
1641                                        -width 50
1642                                        -value 0.100
1643                                ("BSClipRateSeconds"+$numBSClips);
1644        formatOgreExporterUI();
1645}
1646
1647global proc delOgreExporterBSClip()
1648{
1649        global int $numBSClips;
1650        if ($numBSClips > 1)
1651        {
1652                deleteUI("BSClipFrame"+$numBSClips);
1653                $numBSClips--;
1654        }
1655        formatOgreExporterUI();
1656}
1657
1658global proc addOgreExporterVertexClip()
1659{
1660        global int $numVertClips;
1661        $numVertClips++;
1662
1663        frameLayout
1664                -parent VertexClipsLayout
1665                -width 309
1666                -label ("Clip"+$numVertClips)
1667        ("VertexClipFrame"+$numVertClips);
1668
1669                columnLayout
1670                        -parent ("VertexClipFrame"+$numVertClips)
1671                        -columnAttach "left" 0
1672                ("VertexClipLayout"+$numVertClips);
1673
1674                rowLayout
1675                        -parent ("VertexClipLayout"+$numVertClips)
1676                        -numberOfColumns 2
1677                        -columnWidth2 100 200
1678                        -columnOffset2 5 5
1679                        -columnAlign 1 "left"
1680                        -columnAlign 2 "left"
1681                ("VertexClipNameLayout"+$numVertClips);
1682                                                       
1683                        checkBox
1684                                -parent ("VertexClipNameLayout"+$numVertClips)
1685                                -value false
1686                                -changeCommand "formatOgreExporterUI"
1687                                -label "Clip Name"
1688                        ("ExportVertexClip"+$numVertClips);
1689                                       
1690                        textField
1691                                -parent ("VertexClipNameLayout"+$numVertClips)
1692                                -width 200
1693                                -text ("clip"+$numVertClips)
1694                        ("VertexClipName"+$numVertClips);
1695
1696                        separator
1697                                -parent ("VertexClipLayout"+$numVertClips)
1698                                -style "in"
1699                                -width 309
1700                                -height 5;
1701
1702                        rowLayout
1703                                -parent ("VertexClipLayout"+$numVertClips)
1704                                -numberOfColumns 2
1705                                -columnWidth2 100 200
1706                                -columnAlign 1 "left"
1707                                -columnAlign 2 "left"
1708                        ("VertexClipRangeTypeLayout"+$numVertClips);
1709                               
1710                                text
1711                                        -parent ("VertexClipRangeTypeLayout"+$numVertClips)
1712                                        -label "Time Range:"
1713                                ("VertexClipRangeLabel"+$numVertClips);
1714                       
1715                                radioButtonGrp
1716                                        -parent ("VertexClipRangeTypeLayout"+$numVertClips)
1717                                        -numberOfRadioButtons 2
1718                                        -labelArray2 "Start/End" "Time Slider"
1719                                        -cw 1 100
1720                                        -cw 2 100
1721                                        -select 2
1722                                        -changeCommand "formatOgreExporterUI"
1723                                ("VertexClipRangeRadio"+$numVertClips);
1724
1725                        columnLayout
1726                                -parent ("VertexClipLayout"+$numVertClips)
1727                                -columnAttach "left" 70
1728                        ("VertexClipRangeLayout"+$numVertClips);
1729
1730                                rowLayout
1731                                        -parent ("VertexClipRangeLayout"+$numVertClips)
1732                                        -numberOfColumns 2
1733                                        -columnAlign 1 "left"
1734                                        -columnAlign 2 "left"
1735                                        -columnAttach 1 "both" 0
1736                                        -columnAttach 2 "both" 0
1737                                        -columnOffset2 5 5
1738                                        -columnWidth 1 70
1739                                        -columnWidth 2 50
1740                                ("VertexClipRangeStartLayout"+$numVertClips);
1741
1742                                        text
1743                                                -parent ("VertexClipRangeStartLayout"+$numVertClips)
1744                                                -label "Start Time:"
1745                                                -width 50
1746                                        ("VertexClipRangeStartLabel"+$numVertClips);
1747
1748                                        floatField
1749                                                -parent ("VertexClipRangeStartLayout"+$numVertClips)
1750                                                -width 50
1751                                                -value 0.000
1752                                        ("VertexClipRangeStart"+$numVertClips);
1753                               
1754                                rowLayout
1755                                        -parent ("VertexClipRangeLayout"+$numVertClips)
1756                                        -numberOfColumns 2
1757                                        -columnAlign 1 "left"
1758                                        -columnAlign 2 "left"
1759                                        -columnAttach 1 "both" 0
1760                                        -columnAttach 2 "both" 0
1761                                        -columnOffset2 5 5
1762                                        -columnWidth 1 70
1763                                        -columnWidth 2 50
1764                                ("VertexClipRangeEndLayout"+$numVertClips);
1765
1766                                        text
1767                                                -parent ("VertexClipRangeEndLayout"+$numVertClips)
1768                                                -label "End Time:"
1769                                        ("VertexClipRangeEndLabel"+$numVertClips);
1770
1771                                        floatField
1772                                                -parent ("VertexClipRangeEndLayout"+$numVertClips)
1773                                                -value 0.000
1774                                                -width 50
1775                                        ("VertexClipRangeEnd"+$numVertClips);
1776
1777                                columnLayout
1778                                        -parent ("VertexClipRangeLayout"+$numVertClips)
1779                                        -columnAttach "left" 0
1780                                ("VertexClipRangeUnitsLayout"+$numVertClips);
1781
1782                                        radioButtonGrp
1783                                                -parent ("VertexClipRangeUnitsLayout"+$numVertClips)
1784                                                -numberOfRadioButtons 2
1785                                                -labelArray2 "Frames" "Seconds"
1786                                                -cw 1 65
1787                                                -cw 2 65
1788                                                -select 1
1789                                        ("VertexClipRangeUnits"+$numVertClips);
1790                                       
1791                        separator
1792                                -parent ("VertexClipLayout"+$numVertClips)
1793                                -style "in"
1794                                -width 309
1795                                -height 5;
1796
1797                        rowLayout
1798                                -parent ("VertexClipLayout"+$numVertClips)
1799                                -numberOfColumns 2
1800                                -columnWidth 1 70
1801                                -columnWidth 2 230
1802                                -columnAlign 1 "left"
1803                                -columnAlign 2 "left"
1804                                -columnAttach 1 "both" 0
1805                                -columnAttach 2 "both" 0
1806                                -columnOffset2 5 5
1807                        ("VertexClipRateTypeLayout"+$numVertClips);
1808
1809                                text
1810                                        -parent ("VertexClipRateTypeLayout"+$numVertClips)
1811                                        -label "Sample by:"
1812                                ("VertexClipRateTypeLabel"+$numVertClips);
1813       
1814                                radioButtonGrp
1815                                        -parent ("VertexClipRateTypeLayout"+$numVertClips)
1816                                        -numberOfRadioButtons 2
1817                                        -labelArray2 "Frames" "Seconds"
1818                                        -cw 1 65
1819                                        -cw 2 65
1820                                        -select 1
1821                                        -changeCommand "formatOgreExporterUI"
1822                                ("VertexClipRateType"+$numVertClips);
1823
1824                        rowLayout
1825                                -parent ("VertexClipLayout"+$numVertClips)
1826                                -numberOfColumns 2
1827                                -columnWidth 1 125
1828                                -columnWidth 2 80
1829                                -columnAlign 1 "left"
1830                                -columnAlign 2 "left"
1831                                -columnAttach 1 "left" 75
1832                                -columnAttach 2 "both" 15
1833                        ("VertexClipRateLayout"+$numVertClips);
1834                                                       
1835                                intField
1836                                        -parent ("VertexClipRateLayout"+$numVertClips)
1837                                        -width 50
1838                                        -value 1.000
1839                                ("VertexClipRateFrames"+$numVertClips);
1840                       
1841                                floatField
1842                                        -parent ("VertexClipRateLayout"+$numVertClips)
1843                                        -width 50
1844                                        -value 0.100
1845                                ("VertexClipRateSeconds"+$numVertClips);
1846        formatOgreExporterUI();
1847}
1848
1849global proc delOgreExporterVertexClip()
1850{
1851        global int $numVertClips;
1852        if ($numVertClips > 1)
1853        {
1854                deleteUI("VertexClipFrame"+$numVertClips);
1855                $numVertClips--;
1856        }
1857        formatOgreExporterUI();
1858}
1859
1860
1861global proc saveOgreExporterSettings()
1862{
1863        fileInfo "ogreExporter_savedSettings" "1";
1864
1865        // Common parameters
1866        fileInfo "ogreExporter_outputDir" `textField -query -fileName OutputDirectory`;
1867        fileInfo "ogreExporter_exportType" `radioCollection -q -select ExportTypeCollection`;
1868        fileInfo "ogreExporter_coordsType" `radioCollection -q -select CoordsTypeCollection`;
1869        fileInfo "ogreExporter_lengthUnit" `optionMenu -q -select UnitsMenu`;   
1870        fileInfo "ogreExporter_animationType" `optionMenu -q -select AnimationTypeMenu`;       
1871        fileInfo "ogreExporter_globalScale" `floatField -q -v GlobalScale`;
1872
1873        // Mesh
1874        fileInfo "ogreExporter_exportMesh" `checkBox -q -v ExportMesh`;
1875        fileInfo "ogreExporter_useSharedGeom" `checkBox -q -v UseSharedGeometry`;
1876        fileInfo "ogreExporter_exportVBA" `checkBox -q -v ExportVBA`;
1877        fileInfo "ogreExporter_exportNormals" `checkBox -q -v ExportMeshNormals`;
1878        fileInfo "ogreExporter_exportColours" `checkBox -q -v ExportMeshColours`;
1879        fileInfo "ogreExporter_exportUVs" `checkBox -q -v ExportMeshUVs`;
1880        fileInfo "ogreExporter_meshFilename" `textField -q -text ExportMeshFilename`;
1881        fileInfo "ogreExporter_buildEdges" `checkBox -q -v BuildEdges`;
1882        fileInfo "ogreExporter_buildTangents" `checkBox -q -v BuildTangents`;
1883        fileInfo "ogreExporter_tangentSemantic" `radioCollection -q -select TangentSemanticCollection`;
1884       
1885        // Materials
1886        fileInfo "ogreExporter_exportMat" `checkBox -q -v ExportMaterial`;
1887        fileInfo "ogreExporter_materialFile" `textField -q -text ExportMaterialFilename`;
1888        fileInfo "ogreExporter_matPrefix" `textField -q -text ExportMaterialPrefix`;
1889        fileInfo "ogreExporter_copyTextures" `checkBox -q -v CopyTextures`;
1890        fileInfo "ogreExporter_lightingOff" `checkBox -q -v MatLightingOff`;
1891       
1892        // Skeleton     
1893        fileInfo "ogreExporter_exportSkel" `checkBox -q -v ExportSkeleton`;
1894        fileInfo "ogreExporter_skelFilename" `textField -q -text ExportSkeletonFilename`;
1895       
1896        // Skeleton Animations
1897        fileInfo "ogreExporter_exportSkelAnims" `checkBox -q -v ExportSkelAnims`;
1898        fileInfo "ogreExporter_skelBB" `checkBox -q -v SkelBB`;
1899        fileInfo "ogreExporter_neutralPoseType" `radioButtonGrp -q -select NeutralPoseRadio`;
1900        global int $numSkelClips;
1901        fileInfo "ogreExporter_numSkelClips" $numSkelClips;
1902        int $i;
1903        for ($i=1; $i<=$numSkelClips; $i++)
1904        {
1905                fileInfo ("ogreExporter_exportSkelClip"+$i) `checkBox -q -v ("ExportSkelClip"+$i)`;
1906                fileInfo ("ogreExporter_skelClipName"+$i) `textField -q -text ("SkelClipName"+$i)`;
1907                fileInfo ("ogreExporter_skelClipRangeType"+$i) `radioButtonGrp -q -select ("SkelClipRangeRadio"+$i)`;
1908                fileInfo ("ogreExporter_skelClipStart"+$i) `floatField -q -v ("SkelClipRangeStart"+$i)`;
1909                fileInfo ("ogreExporter_skelClipEnd"+$i) `floatField -q -v ("SkelClipRangeEnd"+$i)`;
1910                fileInfo ("ogreExporter_skelClipRangeUnits"+$i) `radioButtonGrp -q -select ("SkelClipRangeUnits"+$i)`;
1911                fileInfo ("ogreExporter_skelClipRateType"+$i) `radioButtonGrp -q -select ("SkelClipRateType"+$i)`;
1912                fileInfo ("ogreExporter_skelClipRateFrames"+$i) `intField -q -v ("SkelClipRateFrames"+$i)`;
1913                fileInfo ("ogreExporter_skelClipRangeSeconds"+$i) `floatField -q -v ("SkelClipRateSeconds"+$i)`;
1914        }
1915       
1916        // Blend Shapes
1917        fileInfo "ogreExporter_exportBlendShapes" `checkBox -q -v ExportBlendShapes`;
1918        fileInfo "ogreExporter_bsBB" `checkBox -q -v BsBB`;
1919       
1920        // Blend Shape Animations
1921        fileInfo "ogreExporter_exportBSAnims" `checkBox -q -v ExportBSAnims`;
1922        global int $numBSClips;
1923        fileInfo "ogreExporter_numBSClips" $numBSClips;
1924        int $i;
1925        for ($i=1; $i<=$numBSClips; $i++)
1926        {
1927                fileInfo ("ogreExporter_exportBSClip"+$i) `checkBox -q -v ("ExportBSClip"+$i)`;
1928                fileInfo ("ogreExporter_BSClipName"+$i) `textField -q -text ("BSClipName"+$i)`;
1929                fileInfo ("ogreExporter_BSClipRangeType"+$i) `radioButtonGrp -q -select ("BSClipRangeRadio"+$i)`;
1930                fileInfo ("ogreExporter_BSClipStart"+$i) `floatField -q -v ("BSClipRangeStart"+$i)`;
1931                fileInfo ("ogreExporter_BSClipEnd"+$i) `floatField -q -v ("BSClipRangeEnd"+$i)`;
1932                fileInfo ("ogreExporter_BSClipRangeUnits"+$i) `radioButtonGrp -q -select ("BSClipRangeUnits"+$i)`;
1933                fileInfo ("ogreExporter_BSClipRateType"+$i) `radioButtonGrp -q -select ("BSClipRateType"+$i)`;
1934                fileInfo ("ogreExporter_BSClipRateFrames"+$i) `intField -q -v ("BSClipRateFrames"+$i)`;
1935                fileInfo ("ogreExporter_BSClipRangeSeconds"+$i) `floatField -q -v ("BSClipRateSeconds"+$i)`;
1936        }
1937       
1938        // Vertex Animations
1939        fileInfo "ogreExporter_exportVertexAnims" `checkBox -q -v ExportVertexAnims`;
1940        fileInfo "ogreExporter_vertBB" `checkBox -q -v VertBB`;
1941        global int $numVertClips;
1942        fileInfo "ogreExporter_numVertClips" $numVertClips;
1943        int $i;
1944        for ($i=1; $i<=$numVertClips; $i++)
1945        {
1946                fileInfo ("ogreExporter_exportVertexClip"+$i) `checkBox -q -v ("ExportVertexClip"+$i)`;
1947                fileInfo ("ogreExporter_vertexClipName"+$i) `textField -q -text ("VertexClipName"+$i)`;
1948                fileInfo ("ogreExporter_vertexClipRangeType"+$i) `radioButtonGrp -q -select ("VertexClipRangeRadio"+$i)`;
1949                fileInfo ("ogreExporter_vertexClipStart"+$i) `floatField -q -v ("VertexClipRangeStart"+$i)`;
1950                fileInfo ("ogreExporter_vertexClipEnd"+$i) `floatField -q -v ("VertexClipRangeEnd"+$i)`;
1951                fileInfo ("ogreExporter_vertexClipRangeUnits"+$i) `radioButtonGrp -q -select ("VertexClipRangeUnits"+$i)`;
1952                fileInfo ("ogreExporter_vertexClipRateType"+$i) `radioButtonGrp -q -select ("VertexClipRateType"+$i)`;
1953                fileInfo ("ogreExporter_vertexClipRateFrames"+$i) `intField -q -v ("VertexClipRateFrames"+$i)`;
1954                fileInfo ("ogreExporter_vertexClipRangeSeconds"+$i) `floatField -q -v ("VertexClipRateSeconds"+$i)`;
1955        }
1956       
1957        // Anim Curves
1958        fileInfo "ogreExporter_exportAnimCurves" `checkBox -q -v ExportAnimCurves`;
1959        fileInfo "ogreExporter_animCurvesFilename" `textField -q -text ExportAnimCurvesFilename`;
1960       
1961        // Cameras
1962        fileInfo "ogreExporter_exportCameras" `checkBox -q -v ExportCameras`;
1963        fileInfo "ogreExporter_exportCamerasAnim" `checkBox -q -v ExportCamerasAnim`;
1964        fileInfo "ogreExporter_camerasFilename" `textField -q -text ExportCamerasFilename`;
1965
1966        // Particles
1967        fileInfo "ogreExporter_exportParticles" `checkBox -q -v ExportParticles`;
1968        fileInfo "ogreExporter_particlesFilename" `textField -q -text ExportParticlesFilename`;
1969}
1970
1971global proc loadOgreExporterSettings()
1972{
1973        string $valStrings[];
1974        int $valInt;
1975        float $valFloat;
1976        $valStrings = `fileInfo -q "ogreExporter_savedSettings"`;
1977        if (`gmatch $valStrings[0] "1"`)
1978        {
1979                // Common parameters
1980                textField -edit -fileName `fileInfo -q "ogreExporter_outputDir"` OutputDirectory;
1981                radioCollection -edit -select `fileInfo -q "ogreExporter_exportType"` ExportTypeCollection;
1982                radioCollection -edit -select `fileInfo -q "ogreExporter_coordsType"` CoordsTypeCollection;
1983                $valStrings = `fileInfo -q "ogreExporter_lengthUnit"`;
1984                string $lengthUnitSel = $valStrings[0];
1985                if (`gmatch $lengthUnitSel "1"`)
1986                        optionMenu -edit -select 1 UnitsMenu;
1987                else if (`gmatch $lengthUnitSel "2"`)
1988                        optionMenu -edit -select 2 UnitsMenu;
1989                else if (`gmatch $lengthUnitSel "3"`)
1990                        optionMenu -edit -select 3 UnitsMenu;
1991                else if (`gmatch $lengthUnitSel "4"`)
1992                        optionMenu -edit -select 4 UnitsMenu;
1993                else if (`gmatch $lengthUnitSel "5"`)
1994                        optionMenu -edit -select 5 UnitsMenu;
1995                else if (`gmatch $lengthUnitSel "6"`)
1996                        optionMenu -edit -select 6 UnitsMenu;
1997                else if (`gmatch $lengthUnitSel "7"`)
1998                        optionMenu -edit -select 7 UnitsMenu;
1999                $valStrings = `fileInfo -q "ogreExporter_animationType"`;
2000                string $animType = $valStrings[0];
2001                if (`gmatch $animType "1"`)
2002                        optionMenu -edit -select 1 AnimationTypeMenu;
2003                else
2004                        optionMenu -edit -select 2 AnimationTypeMenu;
2005                $valStrings = `fileInfo -q "ogreExporter_globalScale"`;
2006                $valFloat = $valStrings[0];
2007                floatField -edit -v $valFloat GlobalScale;
2008       
2009                // Mesh
2010                $valStrings = `fileInfo -q "ogreExporter_exportMesh"`;
2011                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMesh;
2012                $valStrings = `fileInfo -q "ogreExporter_useSharedGeom"`;
2013                checkBox -edit -v `gmatch $valStrings[0] "1"` UseSharedGeometry;
2014                $valStrings = `fileInfo -q "ogreExporter_exportVBA"`;
2015                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportVBA;
2016                $valStrings = `fileInfo -q "ogreExporter_exportNormals"`;
2017                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshNormals;
2018                $valStrings = `fileInfo -q "ogreExporter_exportColours"`;
2019                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshColours;
2020                $valStrings = `fileInfo -q "ogreExporter_exportUVs"`;
2021                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMeshUVs;
2022                textField -edit -text `fileInfo -q "ogreExporter_meshFilename"` ExportMeshFilename;
2023                $valStrings = `fileInfo -q "ogreExporter_buildEdges"`;
2024                checkBox -edit -v `gmatch $valStrings[0] "1"` BuildEdges;
2025                $valStrings = `fileInfo -q "ogreExporter_buildTangents"`;
2026                checkBox -edit -v `gmatch $valStrings[0] "1"` BuildTangents;
2027                radioCollection -edit -select `fileInfo -q "ogreExporter_tangentSemantic"` TangentSemanticCollection;
2028       
2029                // Materials
2030                $valStrings = `fileInfo -q "ogreExporter_exportMat"`;
2031                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportMaterial;
2032                textField -edit -text `fileInfo -q "ogreExporter_materialFile"` ExportMaterialFilename;
2033                textField -edit -text `fileInfo -q "ogreExporter_matPrefix"` ExportMaterialPrefix;
2034                $valStrings = `fileInfo -q "ogreExporter_copyTextures"`;
2035                checkBox -edit -v `gmatch $valStrings[0] "1"` CopyTextures;
2036                $valStrings = `fileInfo -q "ogreExporter_lightingOff"`;
2037                checkBox -edit -v `gmatch $valStrings[0] "1"` MatLightingOff;
2038       
2039                // Skeleton             
2040                $valStrings = `fileInfo -q "ogreExporter_exportSkel"` ;
2041                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportSkeleton;
2042                textField -edit -text `fileInfo -q "ogreExporter_skelFilename"` ExportSkeletonFilename;
2043       
2044                // Skeleton Animations
2045                $valStrings = `fileInfo -q "ogreExporter_exportSkelAnims"`;
2046                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportSkelAnims;
2047                $valStrings = `fileInfo -q "ogreExporter_skelBB"`;
2048                checkBox -edit -v `gmatch $valStrings[0] "1"` SkelBB;
2049                $valStrings = `fileInfo -q "ogreExporter_neutralPoseType"`;
2050                $valInt = $valStrings[0];
2051                radioButtonGrp -edit -select $valInt NeutralPoseRadio;
2052                $valStrings = `fileInfo -q "ogreExporter_numSkelClips"`;
2053                int $n = $valStrings[0];
2054                $valInt = $valStrings[0];
2055                global int $numSkelClips;
2056                for (;$numSkelClips>1;delOgreExporterSkeletonClip());
2057                int $i;
2058                for ($i=1; $i<=$n; $i++)
2059                {
2060                        if ($i > 1)
2061                                addOgreExporterSkeletonClip();
2062                        $valStrings = `fileInfo -q ("ogreExporter_exportSkelClip"+$i)`;
2063                        checkBox -edit -v `gmatch $valStrings[0] "1"` ("ExportSkelClip"+$i);
2064                        textField -edit -text `fileInfo -q ("ogreExporter_skelClipName"+$i)` ("SkelClipName"+$i);
2065                        $valStrings = `fileInfo -q ("ogreExporter_skelClipRangeType"+$i)`;
2066                        $valInt = $valStrings[0];
2067                        radioButtonGrp -edit -select $valInt ("SkelClipRangeRadio"+$i);
2068                        $valStrings = `fileInfo -q ("ogreExporter_skelClipStart"+$i)`;
2069                        $valFloat = $valStrings[0];
2070                        floatField -edit -v $valFloat ("SkelClipRangeStart"+$i);
2071                        $valStrings = `fileInfo -q ("ogreExporter_skelClipEnd"+$i)`;
2072                        $valFloat = $valStrings[0];
2073                        floatField -edit -v $valFloat ("SkelClipRangeEnd"+$i);
2074                        $valStrings = `fileInfo -q ("ogreExporter_skelClipRangeUnits"+$i)`;
2075                        $valInt = $valStrings[0];
2076                        radioButtonGrp -edit -select $valInt ("SkelClipRangeUnits"+$i);
2077                        $valStrings = `fileInfo -q ("ogreExporter_skelClipRateType"+$i)`;
2078                        $valInt = $valStrings[0];
2079                        radioButtonGrp -edit -select $valInt ("SkelClipRateType"+$i);
2080                        $valStrings = `fileInfo -q ("ogreExporter_skelClipRateFrames"+$i)`;
2081                        $valInt = $valStrings[0];
2082                        intField -edit -v $valInt ("SkelClipRateFrames"+$i);
2083                        $valStrings = `fileInfo -q ("ogreExporter_skelClipRateSeconds"+$i)`;
2084                        $valFloat = $valStrings[0];
2085                        floatField -edit -v $valFloat ("SkelClipRateSeconds"+$i);
2086                }
2087               
2088                // Blend Shapes
2089                $valStrings = `fileInfo -q "ogreExporter_exportBlendShapes"` ;
2090                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportBlendShapes;
2091                $valStrings = `fileInfo -q "ogreExporter_bsBB"`;
2092                checkBox -edit -v `gmatch $valStrings[0] "1"` BsBB;
2093               
2094                // Blend Shape Animations
2095                $valStrings = `fileInfo -q "ogreExporter_exportBSAnims"`;
2096                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportBSAnims;
2097                $valStrings = `fileInfo -q "ogreExporter_numBSClips"`;
2098                int $n = $valStrings[0];
2099                $valInt = $valStrings[0];
2100                global int $numBSClips;
2101                for (;$numBSClips>1;delOgreExporterBSClip());
2102                int $i;
2103                for ($i=1; $i<=$n; $i++)
2104                {
2105                        if ($i > 1)
2106                                addOgreExporterBSClip();
2107                        $valStrings = `fileInfo -q ("ogreExporter_exportBSClip"+$i)`;
2108                        checkBox -edit -v `gmatch $valStrings[0] "1"` ("ExportBSClip"+$i);
2109                        textField -edit -text `fileInfo -q ("ogreExporter_BSClipName"+$i)` ("BSClipName"+$i);
2110                        $valStrings = `fileInfo -q ("ogreExporter_BSClipRangeType"+$i)`;
2111                        $valInt = $valStrings[0];
2112                        radioButtonGrp -edit -select $valInt ("BSClipRangeRadio"+$i);
2113                        $valStrings = `fileInfo -q ("ogreExporter_BSClipStart"+$i)`;
2114                        $valFloat = $valStrings[0];
2115                        floatField -edit -v $valFloat ("BSClipRangeStart"+$i);
2116                        $valStrings = `fileInfo -q ("ogreExporter_BSClipEnd"+$i)`;
2117                        $valFloat = $valStrings[0];
2118                        floatField -edit -v $valFloat ("BSClipRangeEnd"+$i);
2119                        $valStrings = `fileInfo -q ("ogreExporter_BSClipRangeUnits"+$i)`;
2120                        $valInt = $valStrings[0];
2121                        radioButtonGrp -edit -select $valInt ("BSClipRangeUnits"+$i);
2122                        $valStrings = `fileInfo -q ("ogreExporter_BSClipRateType"+$i)`;
2123                        $valInt = $valStrings[0];
2124                        radioButtonGrp -edit -select $valInt ("BSClipRateType"+$i);
2125                        $valStrings = `fileInfo -q ("ogreExporter_BSClipRateFrames"+$i)`;
2126                        $valInt = $valStrings[0];
2127                        intField -edit -v $valInt ("BSClipRateFrames"+$i);
2128                        $valStrings = `fileInfo -q ("ogreExporter_BSClipRateSeconds"+$i)`;
2129                        $valFloat = $valStrings[0];
2130                        floatField -edit -v $valFloat ("BSClipRateSeconds"+$i);
2131                }
2132               
2133                // Vertex Animations
2134                $valStrings = `fileInfo -q "ogreExporter_exportVertexAnims"`;
2135                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportVertexAnims;
2136                $valStrings = `fileInfo -q "ogreExporter_vertBB"`;
2137                checkBox -edit -v `gmatch $valStrings[0] "1"` VertBB;
2138                $valStrings = `fileInfo -q "ogreExporter_numVertClips"`;
2139                int $n = $valStrings[0];
2140                $valInt = $valStrings[0];
2141                global int $numVertClips;
2142                for (;$numVertClips>1;delOgreExporterVertexClip());
2143                int $i;
2144                for ($i=1; $i<=$n; $i++)
2145                {
2146                        if ($i > 1)
2147                                addOgreExporterVertexClip();
2148                        $valStrings = `fileInfo -q ("ogreExporter_exportVertexClip"+$i)`;
2149                        checkBox -edit -v `gmatch $valStrings[0] "1"` ("ExportVertexClip"+$i);
2150                        textField -edit -text `fileInfo -q ("ogreExporter_vertexSkelClipName"+$i)` ("VertexClipName"+$i);
2151                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipRangeType"+$i)`;
2152                        $valInt = $valStrings[0];
2153                        radioButtonGrp -edit -select $valInt ("VertexClipRangeRadio"+$i);
2154                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipStart"+$i)`;
2155                        $valFloat = $valStrings[0];
2156                        floatField -edit -v $valFloat ("VertexClipRangeStart"+$i);
2157                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipEnd"+$i)`;
2158                        $valFloat = $valStrings[0];
2159                        floatField -edit -v $valFloat ("VertexClipRangeEnd"+$i);
2160                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipRangeUnits"+$i)`;
2161                        $valInt = $valStrings[0];
2162                        radioButtonGrp -edit -select $valInt ("VertexClipRangeUnits"+$i);
2163                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipRateType"+$i)`;
2164                        $valInt = $valStrings[0];
2165                        radioButtonGrp -edit -select $valInt ("VertexClipRateType"+$i);
2166                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipRateFrames"+$i)`;
2167                        $valInt = $valStrings[0];
2168                        intField -edit -v $valInt ("VertexClipRateFrames"+$i);
2169                        $valStrings = `fileInfo -q ("ogreExporter_vertexClipRateSeconds"+$i)`;
2170                        $valFloat = $valStrings[0];
2171                        floatField -edit -v $valFloat ("VertexClipRateSeconds"+$i);
2172                }
2173               
2174                // Anim Curves
2175                $valStrings = `fileInfo -q "ogreExporter_exportAnimCurves"`;
2176                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportAnimCurves;
2177                textField -edit -text `fileInfo -q "ogreExporter_animCurvesFilename"` ExportAnimCurvesFilename;
2178       
2179                // Cameras
2180                $valStrings = `fileInfo -q "ogreExporter_exportCameras"`;
2181                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportCameras;
2182                $valStrings = `fileInfo -q "ogreExporter_exportCamerasAnim"`;
2183                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportCamerasAnim;
2184                textField -edit -text `fileInfo -q "ogreExporter_camerasFilename"` ExportCamerasFilename;
2185       
2186                // Particles
2187                $valStrings = `fileInfo -q "ogreExporter_exportParticles"`;
2188                checkBox -edit -v `gmatch $valStrings[0] "1"` ExportParticles;
2189                textField -edit -text `fileInfo -q "ogreExporter_particlesFilename"` ExportParticlesFilename;
2190
2191                formatOgreExporterUI();
2192        }
2193        else
2194                defaultOgreExporterSettings();
2195}
2196
2197global proc defaultOgreExporterSettings()
2198{
2199        // Common parameters
2200        textField -edit -fileName "" OutputDirectory;
2201        radioCollection -edit -select "RadioButtonAll" ExportTypeCollection;
2202        radioCollection -edit -select "RadioButtonWorld" CoordsTypeCollection;
2203        optionMenu -edit -select 1 UnitsMenu;
2204        optionMenu -edit -select 1 AnimationTypeMenu;
2205        floatField -edit -v 1 GlobalScale;
2206
2207        // Mesh
2208        checkBox -edit -v 0 ExportMesh;
2209        checkBox -edit -v 1 UseSharedGeometry;
2210        checkBox -edit -v 1 ExportVBA;
2211        checkBox -edit -v 1 ExportMeshNormals;
2212        checkBox -edit -v 0 ExportMeshColours;
2213        checkBox -edit -v 1 ExportMeshUVs;
2214        textField -edit -text "" ExportMeshFilename;
2215        checkBox -edit -v 0 BuildEdges;
2216        checkBox -edit -v 0 BuildTangents;
2217        radioCollection -edit -select "TangentSemanticTexCoord" TangentSemanticCollection;
2218
2219        // Materials
2220        checkBox -edit -v 0 ExportMaterial;
2221        textField -edit -text "" ExportMaterialFilename;
2222        textField -edit -text "" ExportMaterialPrefix;
2223        checkBox -edit -v 0 CopyTextures;
2224        checkBox -edit -v 0 MatLightingOff;
2225
2226        // Skeleton     
2227        checkBox -edit -v 0 ExportSkeleton;
2228        textField -edit -text "" ExportSkeletonFilename;
2229
2230        // Skeleton Animations
2231        checkBox -edit -v 0 ExportSkelAnims;
2232        checkBox -edit -v 0 SkelBB;
2233        radioButtonGrp -edit -select 1 NeutralPoseRadio;
2234        global int $numSkelClips;
2235        for (;$numSkelClips>1;delOgreExporterSkeletonClip());
2236        checkBox -edit -v 0 ExportSkelClip1;
2237        textField -edit -text "clip1" SkelClipName1;
2238        radioButtonGrp -edit -select 1 SkelClipRangeRadio1;
2239        floatField -edit -v 0 SkelClipRangeStart1;
2240        floatField -edit -v 0 SkelClipRangeEnd1;
2241        radioButtonGrp -edit -select 1 SkelClipRangeUnits1;
2242        radioButtonGrp -edit -select 1 SkelClipRateType1;
2243        intField -edit -v 1 SkelClipRateFrames1;
2244        floatField -edit -v 0.1 SkelClipRateSeconds1;
2245       
2246        // Blend Shapes
2247        checkBox -edit -v 0 ExportBlendShapes;
2248        checkBox -edit -v 0 BsBB;
2249       
2250        // Blend Shape Animations
2251        checkBox -edit -v 0 ExportBSAnims;
2252        global int $numBSClips;
2253        for (;$numBSClips>1;delOgreExporterBSClip());
2254        checkBox -edit -v 0 ExportBSClip1;
2255        textField -edit -text "clip1" BSClipName1;
2256        radioButtonGrp -edit -select 1 BSClipRangeRadio1;
2257        floatField -edit -v 0 BSClipRangeStart1;
2258        floatField -edit -v 0 BSClipRangeEnd1;
2259        radioButtonGrp -edit -select 1 BSClipRangeUnits1;
2260        radioButtonGrp -edit -select 1 BSClipRateType1;
2261        intField -edit -v 1 BSClipRateFrames1;
2262        floatField -edit -v 0.1 BSClipRateSeconds1;
2263       
2264        // Vertex Animation
2265        checkBox -edit -v 0 ExportVertexAnims;
2266        checkBox -edit -v 0 VertBB;
2267        global int $numVertClips;
2268        for (;$numVertClips>1;delOgreExporterVertexClip());
2269        checkBox -edit -v 0 ExportSkelClip1;
2270        textField -edit -text "clip1" VertexClipName1;
2271        radioButtonGrp -edit -select 1 VertexClipRangeRadio1;
2272        floatField -edit -v 0 VertexClipRangeStart1;
2273        floatField -edit -v 0 VertexClipRangeEnd1;
2274        radioButtonGrp -edit -select 1 VertexClipRangeUnits1;
2275        radioButtonGrp -edit -select 1 VertexClipRateType1;
2276        intField -edit -v 1 VertexClipRateFrames1;
2277        floatField -edit -v 0.1 VertexClipRateSeconds1;
2278
2279        // Anim Curves
2280        checkBox -edit -v 0 ExportAnimCurves;
2281        textField -edit -text "" ExportAnimCurvesFilename;
2282
2283        // Cameras
2284        checkBox -edit -v 0 ExportCameras;
2285        checkBox -edit -v 0 ExportCamerasAnim;
2286        textField -edit -text `fileInfo -q "ogreExporter_camerasFilename"` ExportCamerasFilename;
2287
2288        // Particles
2289        checkBox -edit -v 0 ExportParticles;
2290        textField -edit -text "" ExportParticlesFilename;
2291
2292        // Initialize filenames
2293        string $sceneFile = `file -query -sceneName`;
2294        string $sceneDir = dirname($sceneFile);
2295        string $baseFile = basename($sceneFile, ".mb");
2296        textField -edit -fileName $sceneDir SceneDirectory;
2297       
2298        // --- Mesh File
2299        string $meshFile = $baseFile + ".mesh";
2300        textField -edit -fileName $meshFile ExportMeshFilename;
2301       
2302        // --- Material File
2303        string $matFile = $baseFile + ".material";
2304        textField -edit -fileName $matFile ExportMaterialFilename;
2305
2306        // --- Skeleton File
2307        string $skelFile = $baseFile + ".skeleton";
2308        textField -edit -fileName $skelFile ExportSkeletonFilename;
2309
2310        // --- Camera File
2311        string $camFile = $baseFile + ".camera";
2312        textField -edit -fileName $camFile ExportCamerasFilename;
2313
2314        // --- Anim Curves File
2315        string $animFile = $baseFile + ".anim";
2316        textField -edit -fileName $animFile ExportAnimCurvesFilename;
2317
2318        // --- Particles File
2319        string $particlesFile = $baseFile + ".particles.xml";
2320        textField -edit -fileName $particlesFile ExportParticlesFilename;
2321
2322        formatOgreExporterUI();
2323}
2324
Note: See TracBrowser for help on using the repository browser.