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