//---------------------------------------------------------------------------
//
//  mayaToNNBatchExport.mel
//
//  Copyright (C) 2002 - 2009 SEGA Corporation CS R&D Support Department
//  All Rights Reserved.
//
//  Module  : mayaToNNBatchExport
//  File    : mayaToNNBatchExport.mel
//  Create  : 2002/10/02
//  Modify  : 2002/11/26
//          : 2004/12/09 : Maya6.5対応
//          : 2007/09/27 : Maya2008対応
//          : 2008/12/19 : NNRファイルが無い時は、UserInitを使うように変更
//          : 2011/06/29 : OpenGL ES 2.0, PS Vita版追加。
//  Version : 1.20.00
//  Note    : mayaToNNBatchExport
//
//---------------------------------------------------------------------------

global string $mtnbCurrentProjectDir;
global string $mtnbCurrentSceneDir;
global string $mtnbDirectoryType;
global string $mtnbFileType;
global string $mtnbDebug = false;

//---------------------------------------------------------------------------
//  関数名 : mayaToNNBatchExport
//  機　能 : MAYA4 to NN Exporter for Playstation2/GAMECUBEの
//  　　　   バッチコンバート用のダイアログを表示します。
//  書　式 : global proc mtnCreateBatchExportDialogTemplate()
//  引　数 : なし
//
//  戻り値 : なし
//  説　明 : このスクリプトはMAYA4 to NN Exporter for Playstation2/GAMECUBEの
//  　　　   プラグインがインストールされている状態で起動してください。
//  　　　   このスクリプトだけではエクスポートすることができません。
//---------------------------------------------------------------------------
global proc mayaToNNBatchExport( string $fileType )
{
	// グローバル変数を初期化
	mtnbInitGlobalValue();
	// ファイルタイプをセット
	mtnbSetGlobalValue( "FileType", $fileType );
	// GUI用テンプレート作成
	mtnbCreateBatchExportDialogTemplate;
	// windowがすでにある場合は一度削除
	if ( `window -exists MTNB_BatchExportWindow` ){
		deleteUI -window MTNB_BatchExportWindow;
	}

	// MTNB_BatchExportWindow作成
	window
		-title					`mtnbGetTitleName`
		-menuBar				true
		-width					520
		-height					300
		-resizeToFitChildren	true
		-sizeable				true
		MTNB_BatchExportWindow;
	// GUI用テンプレートをセット
	setUITemplate -pushTemplate MTNB_BatchExportTemplate;
	// columnLayout [[
	columnLayout MTNB_ExportOptionColumnLayout;
	setParent ..;
	// ]] columnLayout

	// MTNB_BatchExportWindowにメニューバーを追加
	mtnbMakeLayoutExportMenu  ( "MTNB_BatchExportWindow"		);
	// MTNB_ExportOptionColumnLayoutにレイアウトを追加
	mtnbMakeLayoutExportOption( "MTNB_ExportOptionColumnLayout" );
	// テンプレート終了
	setUITemplate -popTemplate MTNB_BatchExportTemplate;
	// ウィンドウを表示
	showWindow MTNB_BatchExportWindow;
}

//---------------------------------------------------------------------------
//  関数名 : mtnbCreateBatchExportDialogTemplate
//  機　能 : BatchExportDialogTemplateを作成します。
//  書　式 : global proc mtnbCreateBatchExportDialogTemplate()
//  引　数 : なし
//
//  戻り値 : なし
//  説　明 : mayaToNNBatchExportで使用するレイアウトのテンプレートを定義します。
//---------------------------------------------------------------------------
global proc mtnbCreateBatchExportDialogTemplate()
{
	// MTNB_BatchExportTemplateがすでに存在している場合は一度削除する。
	if ( `uiTemplate -exists MTNB_BatchExportTemplate` ) {
		deleteUI -uiTemplate MTNB_BatchExportTemplate;
	}
	// MTNB_BatchExportTemplateを作成
	uiTemplate MTNB_BatchExportTemplate;
	// columnLayout
	columnLayout
		-defineTemplate		MTNB_BatchExportTemplate

//		-adjustableColumn	true
		-adjustableColumn	false
		;
	// frameLayout
	frameLayout
		-defineTemplate 	MTNB_BatchExportTemplate

		-visible			true
		-collapsable		false
		-collapse			false
		-borderVisible		true
		-borderStyle		"etchedOut"
		-label				""
		-labelVisible		true
		-labelAlign			center
		-labelIndent		5
		-marginWidth		5
		-marginHeight		5
		;
	// textFieldButtonGrp
	textFieldButtonGrp
		-defineTemplate		MTNB_BatchExportTemplate

		-rowAttach 1 bottom 10
		-label				""
		-text				""
		-buttonLabel		""
		-columnAttach		1 both 0
		-columnAttach		2 both 0
		-columnAttach		3 both 10
		-columnAlign		1 right
		-columnAlign		2 left
		-columnAlign		3 center
		;
	// button
	button
		-defineTemplate		MTNB_BatchExportTemplate

		-label				""
		-align				center
		;
}

global proc mtnbMakeLayoutExportMenu( string $parent )
{
	setParent $parent;

	// Directory
	menu
		-label		"Directory"
		-tearOff	true
		-mnemonic	"D"
		MTNB_Menu_Directory;
		// SceneDirectory
		menuItem
			-label			"Scene Directory"
			-command		"mtnbGetDirectory( \"SceneDirectory\" )"
			MTNB_MenuItem_SceneDirectory;
		// OutputDirectory
		menuItem
			-label			"Output Directory"
			-command		"mtnbGetDirectory( \"OutputDirectory\" )"
			MTNB_MenuItem_OutputDirectory;
		// NnrDirectory
		menuItem
			-label			"NNR Directory"
			-command		"mtnbGetDirectory( \"NnrDirectory\" )"
			MTNB_MenuItem_NnrDirectory;
	setParent -menu ..;

	// Export
	menu
		-label		"Export"
		-tearOff	true
		-mnemonic	"E"
		MTNB_Menu_Export;
		// Export
		menuItem
			-label		"Export"
			-command	"mtnbExportMain"
			MTNB_MenuItem_Export;
		// Reset
		menuItem
			-label			"Reset"
			-command		"mtnbResetOption"
			MTNB_MenuItem_Reset;
		// Close
		menuItem
			-label			"Close"
			-command		"mtnbCloseWindow"
			MTNB_MenuItem_Close;
	setParent -menu ..;

	// Help
	menu
		-label		"Help"
		-helpMenu	true
		-tearOff	true
		-mnemonic	"H"
		MTNB_Menu_Version;
		// Version
		menuItem
			-label			"Version"
			-command		"mtnbGetVersion"
			MTNB_MenuItem_Version;
	setParent -menu ..;
}

global proc mtnbMakeLayoutExportOption( string $parent )
{
	setParent $parent;

	formLayout MTNB_ExportOptionFormLayout;
	setParent ..;

	mtnbMakeLayoutOutputOption( "MTNB_ExportOptionFormLayout" );
	mtnbMakeLayoutExport      ( "MTNB_ExportOptionFormLayout" );
	mtnbMakeLayoutNnLogoImage ( "MTNB_ExportOptionFormLayout" );

	formLayout
		-edit
		// MTNB_OutputOptionFrameLayout
		-attachForm		MTNB_OutputOptionFrameLayout 	top		5
		-attachForm		MTNB_OutputOptionFrameLayout 	left	5
		-attachNone		MTNB_OutputOptionFrameLayout 	bottom
		-attachForm		MTNB_OutputOptionFrameLayout 	right	5
		// MTNB_ExportFrameLayout
		-attachControl	MTNB_ExportFrameLayout			top		5	MTNB_OutputOptionFrameLayout
		-attachForm		MTNB_ExportFrameLayout			left	5
		-attachNone		MTNB_ExportFrameLayout			bottom
		-attachForm		MTNB_ExportFrameLayout			right	5
		// MTNB_NnLogoImageColumnLayout
		-attachControl	MTNB_NnLogoImageFrameLayout	top		0	MTNB_ExportFrameLayout
		-attachForm		MTNB_NnLogoImageFrameLayout	left	5
		-attachNone		MTNB_NnLogoImageFrameLayout	bottom
		-attachNone		MTNB_NnLogoImageFrameLayout	right
		MTNB_ExportOptionFormLayout;
}

global proc mtnbMakeLayoutOutputOption( string $parent )
{
	setParent $parent;

	// frameLayout [[
	frameLayout
		-label			"Directory"
		-borderStyle	"etchedOut"
		MTNB_OutputOptionFrameLayout;
		// column [[
		columnLayout MTNB_OutputOptionColumnLayout;
			// MTNB_SceneDirectory
			textFieldButtonGrp
				-label 			"Scene Directory : "
//				-text 			(mtnbGetGlobalValue( "CurrentProjectDir" ))
				-text 			(mtnbGetGlobalValue( "CurrentSceneDir" ))
				-buttonLabel 	"Select"
				-buttonCommand 	"mtnbGetDirectory( \"SceneDirectory\" )"
				-columnWidth3 	115 300 115
 				-editable 		false
				MTNB_SceneDirectory;
			// OutputDirectory
			textFieldButtonGrp
				-label 			"Output Directory : "
				-text 			(mtnbGetGlobalValue( "CurrentProjectDir" ))
				-buttonLabel 	"Select"
				-buttonCommand 	"mtnbGetDirectory( \"OutputDirectory\" )"
				-columnWidth3 	115 300 115
				-editable 		false
				MTNB_OutputDirectory;
			// NnrDirectory
			textFieldButtonGrp
				-label 			"NNR Directory : "
				-text 			(mtnbGetGlobalValue( "CurrentProjectDir" ))
				-buttonLabel 	"Select"
				-buttonCommand 	"mtnbGetDirectory( \"NnrDirectory\" )"
				-columnWidth3 	115 300 115
				-editable 		false
				MTNB_NnrDirectory;
		// ]] columnLayout
		setParent ..;
	// ]] frameLayout
	setParent ..;
}

global proc mtnbMakeLayoutExport( string $parent )
{
	setParent $parent;

	// frameLayout [[
	frameLayout
		-label 			"Export"
		-collapsable	false
		-borderStyle	"etchedOut"
		 MTNB_ExportFrameLayout;
		// rowLayout [[
		rowLayout
			-width				510
			-numberOfColumns	3
			-columnWidth3		170 170 170
			-columnAttach3		both both both
			-columnOffset3		20 20 20
			-columnAlign3		center center center
			MTNB_ExportRowLayout;
			// Export
			button
				-label		"Export"
				-command	"mtnbExportMain"
				-width		100
				MTNB_ExportButton;
			// Reset
			button
				-label		"Reset"
				-command	"mtnbResetOption"
				-width		100
				MTNB_ResetButton;
			// Reset
			button
				-label		"Close"
				-command	"mtnbCloseWindow"
				-width		100
				MTNB_CloseButton;
		// ]] rowLayout
		setParent ..;
	// ]] frameLayout
	setParent ..;
}

global proc mtnbMakeLayoutNnLogoImage( string $parent )
{
	setParent $parent;

	// frameLayout [[
	frameLayout
		-label			""
		-labelVisible	false
		-collapsable	false
		-borderStyle	"etchedOut"
		MTNB_NnLogoImageFrameLayout;

		columnLayout MTNB_NnLogoImageColumnLayout;
			// NN Logo
			image
				-image	`mtnbGetImageFileDir`
				-width	520
				-height	`mtnbGetImageFileHeight`
				MTNB_NnLogoImage;
		// ]] columnLayout
		setParent ..;

	// ]] frameLayout
	setParent ..;
}
//---------------------------------------------------------------------------
//  関数名 : mtnbGetTitleName
//  機  能 : タイトル名を取得します。
//  書  式 : global proc mtnbGetTitleName()
//  引  数 : なし
//  戻り値 : なし
//  説  明 :
//---------------------------------------------------------------------------
global proc string mtnbGetTitleName()
{
	string $pluginName;
	string $fileType = mtnbGetGlobalValue( "FileType" );
	switch( $fileType ){
//		case "MAYA4 NNExporter for PlayStation2":
//		case "MAYA45 NNExporter for PlayStation2":
//		case "MAYA5 NNExporter for PlayStation2":
//		case "MAYA6 NNExporter for PlayStation2":
//		case "MAYA65 NNExporter for PlayStation2":
//		case "MAYA7 NNExporter for PlayStation2":
//		case "MAYA8 NNExporter for PlayStation2":
		case "MAYA85 NNExporter for PlayStation2":
		case "MAYA2008 NNExporter for PlayStation2":
		case "MAYA2009 NNExporter for PlayStation2":
		case "MAYA2010 NNExporter for PlayStation2":
			$pluginName = mtngGetPluginNamePS2();
			break;
//		case "MAYA4 NNExporter for GAMECUBE":
//		case "MAYA45 NNExporter for GAMECUBE":
//		case "MAYA5 NNExporter for GAMECUBE":
//		case "MAYA6 NNExporter for GAMECUBE":
//		case "MAYA65 NNExporter for GAMECUBE":
//		case "MAYA7 NNExporter for GAMECUBE":
//		case "MAYA8 NNExporter for GAMECUBE":
		case "MAYA85 NNExporter for GAMECUBE":
		case "MAYA2008 NNExporter for GAMECUBE":
		case "MAYA2009 NNExporter for GAMECUBE":
		case "MAYA2010 NNExporter for GAMECUBE":
			$pluginName = mtngGetPluginNameGC();
			break;
//		case "MAYA4 NNExporter for DirectX G1.1":
//		case "MAYA45 NNExporter for DirectX G1.1":
//		case "MAYA5 NNExporter for DirectX G1.1":
//		case "MAYA6 NNExporter for DirectX G1.1":
//		case "MAYA65 NNExporter for DirectX G1.1":
//		case "MAYA7 NNExporter for DirectX G1.1":
//		case "MAYA8 NNExporter for DirectX G1.1":
		case "MAYA85 NNExporter for DirectX G1.1":
		case "MAYA2008 NNExporter for DirectX G1.1":
		case "MAYA2009 NNExporter for DirectX G1.1":
		case "MAYA2010 NNExporter for DirectX G1.1":
			$pluginName = mtngGetPluginNameXB();
			break;
//		case "MAYA4 NNExporter for Lindbergh":
//		case "MAYA45 NNExporter for Lindbergh":
//		case "MAYA5 NNExporter for Lindbergh":
//		case "MAYA6 NNExporter for Lindbergh":
//		case "MAYA65 NNExporter for Lindbergh":
//		case "MAYA7 NNExporter for Lindbergh":
//		case "MAYA8 NNExporter for Lindbergh":
		case "MAYA85 NNExporter for Lindbergh":
		case "MAYA2008 NNExporter for Lindbergh":
		case "MAYA2009 NNExporter for Lindbergh":
		case "MAYA2010 NNExporter for Lindbergh":
			$pluginName = mtngGetPluginNameLB();
			break;
//		case "MAYA4 NNExporter for PSP":
//		case "MAYA45 NNExporter for PSP":
//		case "MAYA5 NNExporter for PSP":
//		case "MAYA6 NNExporter for PSP":
//		case "MAYA65 NNExporter for PSP":
//		case "MAYA7 NNExporter for PSP":
//		case "MAYA8 NNExporter for PSP":
		case "MAYA85 NNExporter for PSP":
		case "MAYA2008 NNExporter for PSP":
		case "MAYA2009 NNExporter for PSP":
		case "MAYA2010 NNExporter for PSP":
			$pluginName = mtngGetPluginNamePSP();
			break;
//		case "MAYA4 NNExporter for DT06":
//		case "MAYA45 NNExporter for DT06":
//		case "MAYA5 NNExporter for DT06":
//		case "MAYA6 NNExporter for DT06":
//		case "MAYA65 NNExporter for DT06":
//		case "MAYA7 NNExporter for DT06":
//		case "MAYA8 NNExporter for DT06":
//		case "MAYA85 NNExporter for DT06":
//			$pluginName = mtngGetPluginNameDT06();
//			break;
//		case "MAYA4 NNExporter for XBOX360":
//		case "MAYA45 NNExporter for XBOX360":
//		case "MAYA5 NNExporter for XBOX360":
//		case "MAYA6 NNExporter for XBOX360":
//		case "MAYA65 NNExporter for XBOX360":
//		case "MAYA7 NNExporter for XBOX360":
//		case "MAYA8 NNExporter for XBOX360":
		case "MAYA85 NNExporter for XBOX360":
		case "MAYA2008 NNExporter for XBOX360":
		case "MAYA2009 NNExporter for XBOX360":
		case "MAYA2010 NNExporter for XBOX360":
			$pluginName = mtngGetPluginNameXB360();
			break;
//		case "MAYA4 NNExporter for PlayStation3":
//		case "MAYA45 NNExporter for PlayStation3":
//		case "MAYA5 NNExporter for PlayStation3":
//		case "MAYA6 NNExporter for PlayStation3":
//		case "MAYA65 NNExporter for PlayStation3":
//		case "MAYA7 NNExporter for PlayStation3":
//		case "MAYA8 NNExporter for PlayStation3":
		case "MAYA85 NNExporter for PlayStation3":
		case "MAYA2008 NNExporter for PlayStation3":
		case "MAYA2009 NNExporter for PlayStation3":
		case "MAYA2010 NNExporter for PlayStation3":
			$pluginName = mtngGetPluginNamePS3();
			break;
//		case "MAYA7 NNExporter for DirectX G2.0":
//		case "MAYA8 NNExporter for DirectX G2.0":
		case "MAYA85 NNExporter for DirectX G2.0":
		case "MAYA2008 NNExporter for DirectX G2.0":
		case "MAYA2009 NNExporter for DirectX G2.0":
		case "MAYA2010 NNExporter for DirectX G2.0":
			$pluginName = mtngGetPluginNameDXG2();
			break;
		case "MAYA85 NNExporter for OpenGL ES 1.1":
		case "MAYA2008 NNExporter for OpenGL ES 1.1":
		case "MAYA2009 NNExporter for OpenGL ES 1.1":
		case "MAYA2010 NNExporter for OpenGL ES 1.1":
			$pluginName = mtngGetPluginNameGLES11();
			break;
		case "MAYA2008 NNExporter for OpenGL ES 2.0":
		case "MAYA2009 NNExporter for OpenGL ES 2.0":
		case "MAYA2010 NNExporter for OpenGL ES 2.0":
			$pluginName = mtngGetPluginNameGLES20();
			break;
		case "MAYA2008 NNExporter for PS Vita":
		case "MAYA2009 NNExporter for PS Vita":
		case "MAYA2010 NNExporter for PS Vita":
			$pluginName = mtngGetPluginNameVITA();
			break;
	}
	if( size($pluginName) == 0 ) {
		error( "NN Exporter Plugin is not loaded!\n" );
		return "";
	}

	string $version = `pluginInfo -query -version $pluginName`;
	string $title = $fileType + " " + $version + " Batch Exporter";

	return $title;
}

//---------------------------------------------------------------------------
//  関数名 : mtnbExportAll
//  機　能 : NNファイルへエクスポートします。
//  書　式 : global proc mtnExportAll( string $option, string $fileType, string $outputDir, string $sceneName )
//  引　数 : string $option　：オプション文字列(format : optionName1=optionValue1;optionName2=optionValue2;... )
//  　　　   string $fileType：ファイルタイプ("MAYA4 NNExporter for PlayStation2" or "MAYA4 NNExporter for GAMECUBE")
//  　　　   string $outputDir：出力ディレクトリ
//  　　　   string $sceneName：出力ファイル名(シーン名を使用)
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbExportAll( string $option, string $fileType, string $outputDir, string $sceneName )
{
// Debug [[
	mtnbDebugPrint( "option="	 + $option	  + "\n" );
	mtnbDebugPrint( "fileType="	 + $fileType  + "\n" );
	mtnbDebugPrint( "outputDir=" + $outputDir + "\n" );
	mtnbDebugPrint( "sceneName=" + $sceneName + "\n" );
// ]] Debug
	file -exportAll -options $option -type $fileType ($outputDir+"/"+$sceneName);
}

//---------------------------------------------------------------------------
//  関数名 : mtnExportMain
//  機　能 : BatchExportメイン処理を行います
//  書　式 : global proc mtnExportMain
//  引　数 : なし
//
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbExportMain()
{
	// シーンを初期化
	file -force -new;
	// Outputディレクトリを取得
	string $outputDir = mtnbGetStringOption( "OutputDirectory" );
	// ファイルタイプを取得
	string $fileType = mtnbGetGlobalValue( "FileType" );
	// シーンディレクトリを取得
	string $sceneFileDir = mtnbGetStringOption( "SceneDirectory" ) + "/";
	// ディレクトリ内のsceneファイル名を取得
	string $sceneFileList[] = `getFileList -folder $sceneFileDir -filespec "*.mb"`;
	// シーンファイルがなければ終了
	if( size( $sceneFileList ) == 0 ) {
		mtnbMessageDialog( "mtnbExportMain : scene file is not found!\n" + $sceneFileDir + "*.mb\n" );
		return;
	}
	// メインプログレスバーを初期化
	global string $gMainProgressBar;
	progressBar
		-edit
		-beginProgress
		-isInterruptable	true
		-status				"NN Export ..."
		-maxValue			`size $sceneFileList`
		$gMainProgressBar;
	// エクスポートカウンタを初期化
	int $exportNumber = 0;
	// シーンファイルごとにNNファイルへエクスポート
	for( $sceneFile in $sceneFileList ) {
		string $sceneFullName = $sceneFileDir + $sceneFile;
		print ($sceneFullName + "\n");
		// シーンファイル読み込み
		file -open -force $sceneFullName;
		// シーン名を取得 $sceneName[0]:シーン名 $sceneName[1]：拡張子(mb)
		string $sceneName[];
		tokenize $sceneFile "." $sceneName;
		// シーンファイルに対応したNNRファイルからオプション文字列を取得
		string $exportOptionString = mtnbGetExportOptionString( $sceneName[0] );
		// プログレスバーを更新
		progressBar -edit -status "NN Export ..." $gMainProgressBar;

		string $outputNNDir = $outputDir + "/" + $sceneName[0];
		// NNファイルへエクスポート
		mtnbExportAll( $exportOptionString, $fileType, $outputNNDir, $sceneName[0] );
//		mtnbExportAll( $exportOptionString, $fileType, $outputDir, $sceneName[0] );
		// カウンタ増分
		$exportNumber++;
		// プログレスバーのステップを1つ進める
		progressBar -edit -step 1 $gMainProgressBar;
		// キャンセルされたら(Escボタンを押されたら)処理を終了
		if( `progressBar -query -isCancelled $gMainProgressBar` == true ) {
			// ダイアログ表示
			mtnbMessageDialog( "NN Export is Canceled!\n" );
			break;
		}
	}
	// シーンを初期化
	file -force -new;
	// メインプログレスバー終了処理
	progressBar	-edit -endProgress $gMainProgressBar;
	// ダイアログ表示
	mtnbMessageDialog( "NN Export is Finished!!\n\n" + "Excecute "+ $exportNumber + " Maya Binary File Export NN File." );
}

//---------------------------------------------------------------------------
//  関数名 : mtnbCloseWindow
//  機　能 : BatchExportWindowを閉じます。
//  書　式 : global proc mtnbCloseWindow()
//  引　数 : なし
//
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbCloseWindow()
{
	if ( `window -exists MTNB_BatchExportWindow` == true ) {
		deleteUI -window MTNB_BatchExportWindow;
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbResetOption
//  機　能 : オプションを初期化します
//  書　式 : global proc mtnbResetOption()
//  引　数 : なし
//
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbResetOption()
{
	// プロジェクトディレクトリを取得
	string $projectDir	= mtnbGetGlobalValue( "CurrentProjectDir" );
	string $sceneDir	= mtnbGetGlobalValue( "CurrentSceneDir" );;

	// プロジェクトのパスをセット
	mtnbSetStringOption( "SceneDirectory",	$sceneDir );
//	mtnbSetStringOption( "SceneDirectory",	$projectDir );
	mtnbSetStringOption( "OutputDirectory",	$projectDir );
	mtnbSetStringOption( "NnrDirectory",	$projectDir );
}

//---------------------------------------------------------------------------
//  関数名 : mtnbGetExportOptionString
//  機　能 : NNRオプションからエクスポートオプションの文字列を作成します。
//  書　式 : global proc string mtnbGetExportOptionString( string $sceneFileName )
//  引　数 : string $sceneFileName：シーンファイル名
//
//  戻り値 : オプション文字列(format : optionName1=optionValue1;optionName2=optionValue2;... )
//  説　明 :
//---------------------------------------------------------------------------
global proc string mtnbGetExportOptionString( string $sceneFileName )
{
	// NNRファイルからオプションを取得
	string $nnrOptionsList[] = mtnbLoadNnr( $sceneFileName );

	// OptionStrings作成
	string $exportOptionString;
	for( $nnrOption in $nnrOptionsList ) {
		string $optionList[];
		// オプションを" "で切り離す $optionList[0]:optionName $optionList[1]:optionValue
		tokenize $nnrOption " " $optionList;
		$exportOptionString += $optionList[0] + "=" + $optionList[1] + ";";
	}

	string $outputDir = mtnbGetStringOption( "OutputDirectory"   );
	$outputDir = $outputDir + "/" + $sceneFileName;
	print("Output Dir " + $outputDir + "\n");
	// 出力ディレクトリが存在しない場合は作成
	if( `filetest -d $outputDir` == 0 ) {
		string $cmdStr = "mkdir " + $outputDir + "\n";
		$cmdStr = `substituteAllString $cmdStr "/" "\\"`;
		print($cmdStr + "\n");
		// ディレクトリの作成
		system( $cmdStr );
	}

	print("outputDir = " + $outputDir + "\n");
	// NNR以外のオプションをセット
//	$exportOptionString += "outputDirName="	+ mtnbGetStringOption( "OutputDirectory"   )	+ ";";
	$exportOptionString += "outputDirName="	+ $outputDir									+ ";";
	$exportOptionString += "projectPath="	+ mtnbGetGlobalValue ( "CurrentProjectDir" )	+ ";";
	$exportOptionString += "sceneName="		+ $sceneFileName								+ ";";
	$exportOptionString += "batchExport="	+ true											+ ";";

	return $exportOptionString;
}

//---------------------------------------------------------------------------
//  関数名 : mtnbGetDirectory
//  機　能 : ファイルブラウザからディレクトリ名を取得します。
//  書　式 : global proc mtnbGetDirectory( string $member )
//  引　数 : なし
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbGetDirectory( string $member )
{

	// グローバル変数にディレクトリタイプをセット
	mtnbSetGlobalValue( "DirectoryType", $member );
	// ディレクトリを取得
	string $dir		= mtnbGetStringOption( $member );
	// カレントのワークスペースディレクトリ保存
	string $orgDir	= `workspace -query -dir`;
	// ファイルブラウザをディレクトリモードでオープン
	workspace -dir $dir;
	fileBrowser( "mtnbSetDirectory", "Select", $dir, 4 );

	// ワークスペースディレクトリの復元
	workspace -dir $orgDir;
}

//---------------------------------------------------------------------------
//  関数名 : mtnbSetDirectory
//  機　能 : ファイルブラウザで選択したディレクトリ名をテキストフィールドに設定します。
//  書　式 : global proc mtnbSetDirectory( string $dir, string $fileType )
//  引　数 : string $dir     ：パス名
//  　　　   string $fileType：ファイルタイプ
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbSetDirectory( string $dir, string $fileType )
{
	// ファイルタイプが"directory"の時、フィールドにパスをセット
	if( $fileType == "directory" ) {
		// グローバル変数からディレクトリタイプを取得
		string $dirtype = mtnbGetGlobalValue( "DirectoryType" );
		// ディレクトリをセット
		mtnbSetStringOption( $dirtype, $dir );
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbGetGlobalValue
//  機　能 : グローバル変数の値を取得します。
//  書　式 : global proc string mtnbGetGlobalValue( string $member )
//  引　数 : string $member : メンバー名
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc string mtnbGetGlobalValue( string $member )
{
	global string $mtnbCurrentProjectDir;
	global string $mtnbCurrentSceneDir;
	global string $mtnbDirectoryType;
	global string $mtnbFileType;

	switch( $member ) {
		case "CurrentProjectDir":
			return $mtnbCurrentProjectDir;
		case "CurrentSceneDir":
			return $mtnbCurrentSceneDir;
		case "DirectoryType":
			return $mtnbDirectoryType;
		case "FileType":
			return $mtnbFileType;
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbSetGlobalValue
//  機　能 : グローバル変数に値をセットします。
//  書　式 : global proc mtnbSetGlobalValue( string $member, string $value )
//  引　数 : string $member : メンバー名
//  　　　 : string $value  : 値
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbSetGlobalValue( string $member, string $value )
{
	global string $mtnbCurrentSceneDir;
	global string $mtnbCurrentProjectDir;
	global string $mtnbDirectoryType;
	global string $mtnbFileType;

	switch( $member ) {
		case "CurrentProjectDir":
			$mtnbCurrentProjectDir = $value;	break;
		case "CurrentSceneDir":
			$mtnbCurrentSceneDir   = $value;	break;
		case "DirectoryType":
			$mtnbDirectoryType	   = $value;	break;
		case "FileType":
			$mtnbFileType		   = $value;	break;
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbInitGlobalValue
//  機　能 : グローバル変数を初期化します。
//  書　式 : global proc mtnbInitGlobalValue()
//  引　数 : なし
//  戻り値 : なし
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbInitGlobalValue()
{
	global string $mtnbCurrentProjectDir;
	global string $mtnbCurrentSceneDir;
	global string $mtnbDirectoryType;
	global string $mtnbFileType;

	$mtnbCurrentProjectDir	= `workspace -query -fullName`;
	$mtnbDirectoryType		= "";
	$mtnbFileType			= "";

	$mtnbCurrentSceneDir  	= $mtnbCurrentProjectDir;
	string $sceneDirList[]	= `workspace -query -objectType $mtnbCurrentProjectDir`;

	if( size($sceneDirList) ) {
		$mtnbCurrentSceneDir = $mtnbCurrentSceneDir + "/" + $sceneDirList[1];
	}

}

//---------------------------------------------------------------------------
//  関数名 : mtnbGetImageFileDir
//  機　能 : イメージファイルのディレクトリを取得します。
//  書　式 : global proc string mtnbGetImageFileDir( string $fileType )
//  引　数 : string $fileType：ファイルタイプ
//
//  戻り値 :
//  説　明 :
//---------------------------------------------------------------------------
global proc string mtnbGetImageFileDir()
{
	string $fileType = mtnbGetGlobalValue( "FileType" );
	string $scriptPath = `getenv MAYA_SCRIPT_PATH`;
	string $searchPath[];
	int $numTokens = `tokenize $scriptPath  "\;" $searchPath`;
	switch( $fileType ) {
//		case "MAYA4 NNExporter for PlayStation2":
//			return	`file	-query	-location	"mayannexpps2logo.jpg"`;
//		case "MAYA45 NNExporter for PlayStation2":
//			return	`file	-query	-location	"maya45nnexpps2logo.jpg"`;
//		case "MAYA5 NNExporter for PlayStation2":
//			return	`file	-query	-location	"maya5nnexpps2logo.jpg"`;
//		case "MAYA6 NNExporter for PlayStation2":
//			return	`file	-query	-location	"maya6nnexpps2logo.jpg"`;
//		case "MAYA65 NNExporter for PlayStation2":
//			return	`file	-query	-location	"maya65nnexpps2logo.jpg"`;
		case "MAYA7 NNExporter for PlayStation2":
			return	`file	-query	-location	"maya7nnexpps2logo.jpg"`;
		case "MAYA8 NNExporter for PlayStation2":
		case "MAYA85 NNExporter for PlayStation2":
		case "MAYA2008 NNExporter for PlayStation2":
			return	`file	-query	-location	"mayannexplogo_ps2.jpg"`;
		case "MAYA2009 NNExporter for PlayStation2":
		case "MAYA2010 NNExporter for PlayStation2":
			return searchPathArray( "mayannexplogo_ps2.jpg", $searchPath);

//		case "MAYA4 NNExporter for GAMECUBE":
//			return	`file	-query	-location	"mayannexpgclogo.jpg"`;
//		case "MAYA45 NNExporter for GAMECUBE":
//			return	`file	-query	-location	"maya45nnexpgclogo.jpg"`;
//		case "MAYA5 NNExporter for GAMECUBE":
//			return	`file	-query	-location	"maya5nnexpgclogo.jpg"`;
//		case "MAYA6 NNExporter for GAMECUBE":
//			return	`file	-query	-location	"maya6nnexpgclogo.jpg"`;
//		case "MAYA65 NNExporter for GAMECUBE":
//			return	`file	-query	-location	"maya65nnexpgclogo.jpg"`;
		case "MAYA7 NNExporter for GAMECUBE":
			return	`file	-query	-location	"maya7nnexpgclogo.jpg"`;
		case "MAYA8 NNExporter for GAMECUBE":
		case "MAYA85 NNExporter for GAMECUBE":
		case "MAYA2008 NNExporter for GAMECUBE":
			return	`file	-query	-location	"mayannexplogo_gc.jpg"`;
		case "MAYA2009 NNExporter for GAMECUBE":
		case "MAYA2010 NNExporter for GAMECUBE":
			return searchPathArray( "mayannexplogo_gc.jpg", $searchPath);

//		case "MAYA45 NNExporter for DirectX G1.1":
//			return	`file	-query	-location	"maya45nnexpxboxlogo.jpg"`;
//		case "MAYA5 NNExporter for DirectX G1.1":
//			return	`file	-query	-location	"maya5nnexpdxg11logo.jpg"`;
//		case "MAYA6 NNExporter for DirectX G1.1":
//			return	`file	-query	-location	"maya6nnexpdxg11logo.jpg"`;
//		case "MAYA65 NNExporter for DirectX G1.1":
//			return	`file	-query	-location	"maya65nnexpdxg11logo.jpg"`;
		case "MAYA7 NNExporter for DirectX G1.1":
			return	`file	-query	-location	"maya7nnexpdxg11logo.jpg"`;
		case "MAYA8 NNExporter for DirectX G1.1":
		case "MAYA85 NNExporter for DirectX G1.1":
		case "MAYA2008 NNExporter for DirectX G1.1":
			return	`file	-query	-location	"mayannexplogo_dxg11.jpg"`;
		case "MAYA2009 NNExporter for DirectX G1.1":
		case "MAYA2010 NNExporter for DirectX G1.1":
			return searchPathArray( "mayannexplogo_dxg11.jpg", $searchPath);

//		case "MAYA5 NNExporter for Lindbergh":
//			return	`file	-query	-location	"maya5nnexplindlogo.jpg"`;
//		case "MAYA6 NNExporter for Lindbergh":
//			return	`file	-query	-location	"maya6nnexplindlogo.jpg"`;
//		case "MAYA65 NNExporter for Lindbergh":
//			return	`file	-query	-location	"maya65nnexplindlogo.jpg"`;
		case "MAYA7 NNExporter for Lindbergh":
			return	`file	-query	-location	"maya7nnexplindlogo.jpg"`;
		case "MAYA8 NNExporter for Lindbergh":
		case "MAYA85 NNExporter for Lindbergh":
		case "MAYA2008 NNExporter for Lindbergh":
			return	`file	-query	-location	"mayannexplogo_lind.jpg"`;
		case "MAYA2009 NNExporter for Lindbergh":
		case "MAYA2010 NNExporter for Lindbergh":
			return searchPathArray( "mayannexplogo_lind.jpg", $searchPath);

//		case "MAYA6 NNExporter for PSP":
//			return	`file	-query	-location	"maya6nnexppsplogo.jpg"`;
//		case "MAYA65 NNExporter for PSP":
//			return	`file	-query	-location	"maya65nnexppsplogo.jpg"`;
		case "MAYA7 NNExporter for PSP":
			return	`file	-query	-location	"maya7nnexppsplogo.jpg"`;
		case "MAYA8 NNExporter for PSP":
		case "MAYA85 NNExporter for PSP":
		case "MAYA2008 NNExporter for PSP":
			return	`file	-query	-location	"mayannexplogo_psp.jpg"`;
		case "MAYA2009 NNExporter for PSP":
		case "MAYA2010 NNExporter for PSP":
			return searchPathArray( "mayannexplogo_psp.jpg", $searchPath);

//		case "MAYA6 NNExporter for DT06":
//			return	`file	-query	-location	"maya6nnexpdt06logo.jpg"`;
//		case "MAYA65 NNExporter for DT06":
//			return	`file	-query	-location	"maya65nnexpdt06logo.jpg"`;
//		case "MAYA7 NNExporter for DT06":
//			return	`file	-query	-location	"maya7nnexpdt06logo.jpg"`;
//		case "MAYA8 NNExporter for DT06":
//		case "MAYA85 NNExporter for DT06":
//			return	`file	-query	-location	"maya85nnexpdt06logo.jpg"`;

//		case "MAYA6 NNExporter for XBOX360":
//			return	`file	-query	-location	"maya6nnexpx360logo.jpg"`;
//		case "MAYA65 NNExporter for XBOX360":
//			return	`file	-query	-location	"maya65nnexpx360logo.jpg"`;
		case "MAYA7 NNExporter for XBOX360":
			return	`file	-query	-location	"maya7nnexpx360logo.jpg"`;
		case "MAYA8 NNExporter for XBOX360":
		case "MAYA85 NNExporter for XBOX360":
		case "MAYA2008 NNExporter for XBOX360":
			return	`file	-query	-location	"mayannexplogo_xb360.jpg"`;
		case "MAYA2009 NNExporter for XBOX360":
		case "MAYA2010 NNExporter for XBOX360":
			return searchPathArray( "mayannexplogo_xb360.jpg", $searchPath);

//		case "MAYA6 NNExporter for PlayStation3":
//		case "MAYA65 NNExporter for PlayStation3":
		case "MAYA7 NNExporter for PlayStation3":
			return	`file	-query	-location	"mayannexpps3logo.jpg"`;
		case "MAYA8 NNExporter for PlayStation3":
		case "MAYA85 NNExporter for PlayStation3":
		case "MAYA2008 NNExporter for PlayStation3":
			return	`file	-query	-location	"mayannexplogo_ps3.jpg"`;
		case "MAYA2009 NNExporter for PlayStation3":
		case "MAYA2010 NNExporter for PlayStation3":
			return searchPathArray( "mayannexplogo_ps3.jpg", $searchPath);

//		case "MAYA7 NNExporter for DirectX G2.0":
//		case "MAYA8 NNExporter for DirectX G2.0":
		case "MAYA85 NNExporter for DirectX G2.0":
		case "MAYA2008 NNExporter for DirectX G2.0":
			return	`file	-query	-location	"mayannexplogo_dxg20.jpg"`;
		case "MAYA2009 NNExporter for DirectX G2.0":
		case "MAYA2010 NNExporter for DirectX G2.0":
			return searchPathArray( "mayannexplogo_dxg20.jpg", $searchPath);
		case "MAYA85 NNExporter for OpenGL ES 1.1":
		case "MAYA2008 NNExporter for OpenGL ES 1.1":
			return	`file	-query	-location	"mayannexplogo_gles11.jpg"`;
		case "MAYA2009 NNExporter for OpenGL ES 1.1":
		case "MAYA2010 NNExporter for OpenGL ES 1.1":
			return searchPathArray( "mayannexplogo_gles11.jpg", $searchPath);

		case "MAYA2008 NNExporter for OpenGL ES 2.0":
			return	`file	-query	-location	"mayannexplogo_gles20.jpg"`;
		case "MAYA2009 NNExporter for OpenGL ES 2.0":
		case "MAYA2010 NNExporter for OpenGL ES 2.0":
			return searchPathArray( "mayannexplogo_gles20.jpg", $searchPath);

		case "MAYA2008 NNExporter for OpenGL ES 2.0":
			return	`file	-query	-location	"mayannexplogo_vita.jpg"`;
		case "MAYA2009 NNExporter for PS Vita":
		case "MAYA2010 NNExporter for PS Vita":
			return searchPathArray( "mayannexplogo_vita.jpg", $searchPath);
	}
}
global proc int mtnbGetImageFileHeight()
{
	string $fileType = mtnbGetGlobalValue( "FileType" );

	switch( $fileType ) {
//		case "MAYA45 NNExporter for PlayStation2":
//		case "MAYA45 NNExporter for GAMECUBE":
//		case "MAYA45 NN Exporter for DirectX G1.1":
//		case "MAYA45 NN Exporter for Lindbergh":
//		case "MAYA45 NN Exporter for PSP":
//		case "MAYA45 NN Exporter for DENSO Telematics 06Model":
//			return	90;

//		case "MAYA4 NNExporter for PlayStation2":
//		case "MAYA4 NNExporter for GAMECUBE":

//		case "MAYA5 NNExporter for PlayStation2":
//		case "MAYA5 NNExporter for GAMECUBE":
//		case "MAYA5 NNExporter for DirectX G1.1":
//		case "MAYA5 NNExporter for Lindbergh":

//		case "MAYA6 NNExporter for PlayStation2":
//		case "MAYA6 NNExporter for GAMECUBE":
//		case "MAYA6 NNExporter for DirectX G1.1":
//		case "MAYA6 NNExporter for Lindbergh":
//		case "MAYA6 NNExporter for PSP":
//		case "MAYA6 NNExporter for DENSO Telematics 06Model":
//		case "MAYA6 NNExporter for XBOX360":
//		case "MAYA6 NNExporter for PlayStation3":

//		case "MAYA65 NNExporter for PlayStation2":
//		case "MAYA65 NNExporter for GAMECUBE":
//		case "MAYA65 NNExporter for DirectX G1.1":
//		case "MAYA65 NNExporter for Lindbergh":
//		case "MAYA65 NNExporter for PSP":
//		case "MAYA65 NNExporter for DENSO Telematics 06Model":
//		case "MAYA65 NNExporter for XBOX360":
//		case "MAYA65 NNExporter for PlayStation3":

//		case "MAYA7 NNExporter for PlayStation2":
//		case "MAYA7 NNExporter for GAMECUBE":
//		case "MAYA7 NNExporter for DirectX G1.1":
//		case "MAYA7 NNExporter for Lindbergh":
//		case "MAYA7 NNExporter for PSP":
//		case "MAYA7 NNExporter for DENSO Telematics 06Model":
//		case "MAYA7 NNExporter for XBOX360":
//		case "MAYA7 NNExporter for PlayStation3":
//			return	100;
//		case "MAYA7 NNExporter for DirectX G2.0":
//			return	60;

//		case "MAYA8 NNExporter for PlayStation2":
//		case "MAYA8 NNExporter for GAMECUBE":
//		case "MAYA8 NNExporter for DirectX G1.1":
//		case "MAYA8 NNExporter for Lindbergh":
//		case "MAYA8 NNExporter for PSP":
//		case "MAYA8 NNExporter for DENSO Telematics 06Model":
//		case "MAYA8 NNExporter for XBOX360":
//		case "MAYA8 NNExporter for PlayStation3":
//		case "MAYA8 NNExporter for DirectX G2.0":

		case "MAYA85 NNExporter for PlayStation2":
		case "MAYA85 NNExporter for GAMECUBE":
		case "MAYA85 NNExporter for DirectX G1.1":
		case "MAYA85 NNExporter for Lindbergh":
		case "MAYA85 NNExporter for PSP":
//		case "MAYA85 NNExporter for DENSO Telematics 06Model":
		case "MAYA85 NNExporter for XBOX360":
		case "MAYA85 NNExporter for PlayStation3":
		case "MAYA85 NNExporter for DirectX G2.0":
		case "MAYA85 NNExporter for OpenGL ES 1.1":

		case "MAYA2008 NNExporter for PlayStation2":
		case "MAYA2008 NNExporter for GAMECUBE":
		case "MAYA2008 NNExporter for DirectX G1.1":
		case "MAYA2008 NNExporter for Lindbergh":
		case "MAYA2008 NNExporter for PSP":
//		case "MAYA2008 NNExporter for DENSO Telematics 06Model":
		case "MAYA2008 NNExporter for XBOX360":
		case "MAYA2008 NNExporter for PlayStation3":
		case "MAYA2008 NNExporter for DirectX G2.0":
		case "MAYA2008 NNExporter for OpenGL ES 1.1":
		case "MAYA2008 NNExporter for OpenGL ES 2.0":
		case "MAYA2008 NNExporter for PS Vita":

		case "MAYA2009 NNExporter for PlayStation2":
		case "MAYA2009 NNExporter for GAMECUBE":
		case "MAYA2009 NNExporter for DirectX G1.1":
		case "MAYA2009 NNExporter for Lindbergh":
		case "MAYA2009 NNExporter for PSP":
//		case "MAYA2009 NNExporter for DENSO Telematics 06Model":
		case "MAYA2009 NNExporter for XBOX360":
		case "MAYA2009 NNExporter for PlayStation3":
		case "MAYA2009 NNExporter for DirectX G2.0":
		case "MAYA2009 NNExporter for OpenGL ES 1.1":
		case "MAYA2009 NNExporter for OpenGL ES 2.0":
		case "MAYA2009 NNExporter for PS Vita":

		case "MAYA2010 NNExporter for PlayStation2":
		case "MAYA2010 NNExporter for GAMECUBE":
		case "MAYA2010 NNExporter for DirectX G1.1":
		case "MAYA2010 NNExporter for Lindbergh":
		case "MAYA2010 NNExporter for PSP":
//		case "MAYA2010 NNExporter for DENSO Telematics 06Model":
		case "MAYA2010 NNExporter for XBOX360":
		case "MAYA2010 NNExporter for PlayStation3":
		case "MAYA2010 NNExporter for DirectX G2.0":
		case "MAYA2010 NNExporter for OpenGL ES 1.1":
		case "MAYA2010 NNExporter for OpenGL ES 2.0":
		case "MAYA2010 NNExporter for PS Vita":

			return	60;

		default:
			warning( "mtnbGetImageFileHeight : fileType [" + $fileType + "] is invalid!\n" );
			return 0;
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbSetStringOption
//  機　能 : オプションをセットします。
//  書　式 : global proc mtnbSetStringOption( string $member, string $value )
//  引　数 : string $member：メンバー名
//  　　　   string $value ：セットする値
//  戻り値 :
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbSetStringOption( string $member, string $value )
{
	switch( $member ){
		case "SceneDirectory":
			textFieldButtonGrp	-edit	-text	$value MTNB_SceneDirectory;	break;
		case "OutputDirectory":
			textFieldButtonGrp	-edit	-text	$value MTNB_OutputDirectory;	break;
		case "NnrDirectory":
			textFieldButtonGrp 	-edit	-text	$value MTNB_NnrDirectory;		break;
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbGetStringOption
//  機　能 : オプションを取得します。
//  書　式 : global proc string mtnbGetStringOption( string $member )
//  引　数 : string $member：メンバー名
//
//  戻り値 : オプションの現在の値
//  説　明 :
//---------------------------------------------------------------------------
global proc string mtnbGetStringOption( string $member )
{
	switch( $member ){
		case "SceneDirectory":
			return	`textFieldButtonGrp	-query	-text	MTNB_SceneDirectory`;
		case "OutputDirectory":
			return	`textFieldButtonGrp -query	-text	MTNB_OutputDirectory`;
		case "NnrDirectory":
			return	`textFieldButtonGrp -query	-text	MTNB_NnrDirectory`;
	}
}

//---------------------------------------------------------------------------
//  関数名 : mtnbLoadNnr
//  機　能 : オプションを取得します。
//  書　式 : global proc string[] mtnbLoadNnr( string $fileType, string $sceneName )
//  引　数 : string $sceneName : シーン名
//  戻り値 : string[] : NNRオプション
//  説　明 :
//---------------------------------------------------------------------------
global proc string[] mtnbLoadNnr( string $sceneName )
{
	string $fileType = mtnbGetGlobalValue ( "FileType" );
	string $nnrDir   = mtnbGetStringOption( "NnrDirectory" );
	string $nnrOptionsList[];

	string $nnrPath = $nnrDir + "/" + $sceneName;
	if( !`filetest -r ($nnrPath + ".nnr")` ) {
		$nnrPath = `internalVar -userAppDir` + "userInit";
	}

	switch( $fileType ) {
//		case "MAYA4 NNExporter for PlayStation2":
//		case "MAYA45 NNExporter for PlayStation2":
//		case "MAYA5 NNExporter for PlayStation2":
//		case "MAYA6 NNExporter for PlayStation2":
//		case "MAYA65 NNExporter for PlayStation2":
//		case "MAYA7 NNExporter for PlayStation2":
//		case "MAYA8 NNExporter for PlayStation2":
		case "MAYA85 NNExporter for PlayStation2":
		case "MAYA2008 NNExporter for PlayStation2":
		case "MAYA2009 NNExporter for PlayStation2":
		case "MAYA2010 NNExporter for PlayStation2":
//			$nnrOptionsList = mthLoadNnrPS2( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrPS2( $nnrPath );
			break;

//		case "MAYA4 NNExporter for GAMECUBE":
//		case "MAYA45 NNExporter for GAMECUBE":
//		case "MAYA5 NNExporter for GAMECUBE":
//		case "MAYA6 NNExporter for GAMECUBE":
//		case "MAYA65 NNExporter for GAMECUBE":
//		case "MAYA7 NNExporter for GAMECUBE":
//		case "MAYA8 NNExporter for GAMECUBE":
		case "MAYA85 NNExporter for GAMECUBE":
		case "MAYA2008 NNExporter for GAMECUBE":
		case "MAYA2009 NNExporter for GAMECUBE":
		case "MAYA2010 NNExporter for GAMECUBE":
//			$nnrOptionsList = mthLoadNnrGC( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrGC( $nnrPath );
			break;

//		case "MAYA45 NN Exporter for DirectX G1.1":
//		case "MAYA5 NNExporter for DirectX G1.1":
//		case "MAYA6 NNExporter for DirectX G1.1":
//		case "MAYA65 NNExporter for DirectX G1.1":
//		case "MAYA7 NNExporter for DirectX G1.1":
//		case "MAYA8 NNExporter for DirectX G1.1":
		case "MAYA85 NNExporter for DirectX G1.1":
		case "MAYA2008 NNExporter for DirectX G1.1":
		case "MAYA2009 NNExporter for DirectX G1.1":
		case "MAYA2010 NNExporter for DirectX G1.1":
//			$nnrOptionsList = mthLoadNnrXB( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrXB( $nnrPath );
			break;

//		case "MAYA45 NN Exporter for Lindbergh":
//		case "MAYA5 NNExporter for Lindbergh":
//		case "MAYA6 NNExporter for Lindbergh":
//		case "MAYA65 NNExporter for Lindbergh":
//		case "MAYA7 NNExporter for Lindbergh":
//		case "MAYA8 NNExporter for Lindbergh":
		case "MAYA85 NNExporter for Lindbergh":
		case "MAYA2008 NNExporter for Lindbergh":
		case "MAYA2009 NNExporter for Lindbergh":
		case "MAYA2010 NNExporter for Lindbergh":
//			$nnrOptionsList = mthLoadNnrLB( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrLB( $nnrPath );
			break;

//		case "MAYA45 NN Exporter for PSP":
//		case "MAYA5 NNExporter for PSP":
//		case "MAYA6 NNExporter for PSP":
//		case "MAYA65 NNExporter for PSP":
//		case "MAYA7 NNExporter for PSP":
//		case "MAYA8 NNExporter for PSP":
		case "MAYA85 NNExporter for PSP":
		case "MAYA2008 NNExporter for PSP":
		case "MAYA2009 NNExporter for PSP":
		case "MAYA2010 NNExporter for PSP":
//			$nnrOptionsList = mthLoadNnrPSP( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrPSP( $nnrPath );
			break;

//		case "MAYA45 NN Exporter for DENSO Telematics 06Model":
//		case "MAYA5 NNExporter for DENSO Telematics 06Model":
//		case "MAYA6 NNExporter for DENSO Telematics 06Model":
//		case "MAYA65 NNExporter for DENSO Telematics 06Model":
//		case "MAYA7 NNExporter for DENSO Telematics 06Model":
//		case "MAYA8 NNExporter for DENSO Telematics 06Model":
//		case "MAYA85 NNExporter for DENSO Telematics 06Model":
//		case "MAYA2008 NNExporter for DENSO Telematics 06Model":
//		case "MAYA2009 NNExporter for DENSO Telematics 06Model":
//			$nnrOptionsList = mthLoadNnrDT06(  $nnrDir + "/" + $sceneName );
//			break;

//		case "MAYA45 NN Exporter for XBOX360":
//		case "MAYA5 NNExporter for XBOX360":
//		case "MAYA6 NNExporter for XBOX360":
//		case "MAYA65 NNExporter for XBOX360":
//		case "MAYA7 NNExporter for XBOX360":
		case "MAYA8 NNExporter for XBOX360":
		case "MAYA85 NNExporter for XBOX360":
		case "MAYA2008 NNExporter for XBOX360":
		case "MAYA2009 NNExporter for XBOX360":
		case "MAYA2010 NNExporter for XBOX360":
//			$nnrOptionsList = mthLoadNnrXB360( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrXB360( $nnrPath );
			break;

//		case "MAYA45 NN Exporter for PlayStation3":
//		case "MAYA5 NNExporter for PlayStation3":
//		case "MAYA6 NNExporter for PlayStation3":
//		case "MAYA65 NNExporter for PlayStation3":
//		case "MAYA7 NNExporter for PlayStation3":
//		case "MAYA8 NNExporter for PlayStation3":
		case "MAYA85 NNExporter for PlayStation3":
		case "MAYA2008 NNExporter for PlayStation3":
		case "MAYA2009 NNExporter for PlayStation3":
		case "MAYA2010 NNExporter for PlayStation3":
//			$nnrOptionsList = mthLoadNnrPS3( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrPS3( $nnrPath );
			break;

//		case "MAYA7 NNExporter for DirectX G2.0":
//		case "MAYA8 NNExporter for DirectX G2.0":
		case "MAYA85 NNExporter for DirectX G2.0":
		case "MAYA2008 NNExporter for DirectX G2.0":
		case "MAYA2009 NNExporter for DirectX G2.0":
		case "MAYA2010 NNExporter for DirectX G2.0":
//			$nnrOptionsList = mthLoadNnrDXG2( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrDXG2( $nnrPath );
			break;

		case "MAYA85 NNExporter for OpenGL ES 1.1":
		case "MAYA2008 NNExporter for OpenGL ES 1.1":
		case "MAYA2009 NNExporter for OpenGL ES 1.1":
		case "MAYA2010 NNExporter for OpenGL ES 1.1":
//			$nnrOptionsList = mthLoadNnrDXG2( $nnrDir + "/" + $sceneName );
			$nnrOptionsList = mthLoadNnrGLES11( $nnrPath );
			break;

		case "MAYA2008 NNExporter for OpenGL ES 2.0":
		case "MAYA2009 NNExporter for OpenGL ES 2.0":
		case "MAYA2010 NNExporter for OpenGL ES 2.0":
			$nnrOptionsList = mthLoadNnrGLES20( $nnrPath );
			break;

		case "MAYA2008 NNExporter for PS Vita":
		case "MAYA2009 NNExporter for PS Vita":
		case "MAYA2012 NNExporter for PS Vita":
			$nnrOptionsList = mthLoadNnrVITA( $nnrPath );
			break;

		default:
			error( "mtnbLoadNnr : invalid filetype [" + $fileType + "]\n" );
			break;
	}
	return $nnrOptionsList;
}

//---------------------------------------------------------------------------
//  関数名 : mtnGetVersion
//  機　能 : バージョン情報を取得します。
//  書　式 : global proc mtnGetVersion()
//  引　数 :
//
//  戻り値 :
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbGetVersion()
{
	string $allVersionInfo[];
	string $fileType = mtnbGetGlobalValue( "FileType" );
	switch( $fileType ){
//		case "MAYA4 NNExporter for PlayStation2":
//		case "MAYA45 NNExporter for PlayStation2":
//		case "MAYA5 NNExporter for PlayStation2":
//		case "MAYA6 NNExporter for PlayStation2":
//		case "MAYA65 NNExporter for PlayStation2":
//		case "MAYA7 NNExporter for PlayStation2":
//		case "MAYA8 NNExporter for PlayStation2":
		case "MAYA85 NNExporter for PlayStation2":
		case "MAYA2008 NNExporter for PlayStation2":
		case "MAYA2009 NNExporter for PlayStation2":
		case "MAYA2010 NNExporter for PlayStation2":
			$allVersionInfo = `mthGetVerPS2`;
			break;

//		case "MAYA4 NNExporter for GAMECUBE":
//		case "MAYA45 NNExporter for GAMECUBE":
//		case "MAYA5 NNExporter for GAMECUBE":
//		case "MAYA6 NNExporter for GAMECUBE":
//		case "MAYA65 NNExporter for GAMECUBE":
//		case "MAYA7 NNExporter for GAMECUBE":
//		case "MAYA8 NNExporter for GAMECUBE":
		case "MAYA85 NNExporter for GAMECUBE":
		case "MAYA2008 NNExporter for GAMECUBE":
		case "MAYA2009 NNExporter for GAMECUBE":
		case "MAYA2010 NNExporter for GAMECUBE":
			$allVersionInfo = `mthGetVerGC`;
			break;

//		case "MAYA45 NN Exporter for DirectX G1.1":
//		case "MAYA5 NNExporter for DirectX G1.1":
//		case "MAYA6 NNExporter for DirectX G1.1":
//		case "MAYA65 NNExporter for DirectX G1.1":
//		case "MAYA7 NNExporter for DirectX G1.1":
//		case "MAYA8 NNExporter for DirectX G1.1":
		case "MAYA85 NNExporter for DirectX G1.1":
		case "MAYA2008 NNExporter for DirectX G1.1":
		case "MAYA2009 NNExporter for DirectX G1.1":
		case "MAYA2010 NNExporter for DirectX G1.1":
			$allVersionInfo = `mthGetVerXB`;
			break;

//		case "MAYA45 NN Exporter for Lindbergh":
//		case "MAYA5 NNExporter for Lindbergh":
//		case "MAYA6 NNExporter for Lindbergh":
//		case "MAYA65 NNExporter for Lindbergh":
//		case "MAYA7 NNExporter for Lindbergh":
//		case "MAYA8 NNExporter for Lindbergh":
		case "MAYA85 NNExporter for Lindbergh":
		case "MAYA2008 NNExporter for Lindbergh":
		case "MAYA2009 NNExporter for Lindbergh":
		case "MAYA2010 NNExporter for Lindbergh":
			$allVersionInfo = `mthGetVerLB`;
			break;

//		case "MAYA45 NN Exporter for PSP":
//		case "MAYA5 NNExporter for PSP":
//		case "MAYA6 NNExporter for PSP":
//		case "MAYA65 NNExporter for PSP":
//		case "MAYA7 NNExporter for PSP":
//		case "MAYA8 NNExporter for PSP":
		case "MAYA85 NNExporter for PSP":
		case "MAYA2008 NNExporter for PSP":
		case "MAYA2009 NNExporter for PSP":
		case "MAYA2010 NNExporter for PSP":
			$allVersionInfo = `mthGetVerPSP`;
			break;

//		case "MAYA45 NN Exporter for DENSO Telematics 06Model":
//		case "MAYA5 NNExporter for DENSO Telematics 06Model":
//		case "MAYA6 NNExporter for DENSO Telematics 06Model":
//		case "MAYA65 NNExporter for DENSO Telematics 06Model":
//		case "MAYA7 NNExporter for DENSO Telematics 06Model":
//		case "MAYA8 NNExporter for DENSO Telematics 06Model":
//		case "MAYA85 NNExporter for DENSO Telematics 06Model":
//			$allVersionInfo = `mthGetVerDT06`;
//			break;

//		case "MAYA45 NN Exporter for XBOX360":
//		case "MAYA5 NNExporter for XBOX360":
//		case "MAYA6 NNExporter for XBOX360":
//		case "MAYA65 NNExporter for XBOX360":
//		case "MAYA7 NNExporter for XBOX360":
//		case "MAYA8 NNExporter for XBOX360":
		case "MAYA85 NNExporter for XBOX360":
		case "MAYA2008 NNExporter for XBOX360":
		case "MAYA2009 NNExporter for XBOX360":
		case "MAYA2010 NNExporter for XBOX360":
			$allVersionInfo = `mthGetVerXB360`;
			break;

//		case "MAYA45 NN Exporter for PlayStation3":
//		case "MAYA5 NNExporter for PlayStation3":
//		case "MAYA6 NNExporter for PlayStation3":
//		case "MAYA65 NNExporter for PlayStation3":
//		case "MAYA7 NNExporter for PlayStation3":
//		case "MAYA8 NNExporter for PlayStation3":
		case "MAYA85 NNExporter for PlayStation3":
		case "MAYA2008 NNExporter for PlayStation3":
		case "MAYA2009 NNExporter for PlayStation3":
		case "MAYA2010 NNExporter for PlayStation3":
			$allVersionInfo = `mthGetVerPS3`;
			break;

//		case "MAYA7 NNExporter for DirectX G2.0":
//		case "MAYA8 NNExporter for DirectX G2.0":
		case "MAYA85 NNExporter for DirectX G2.0":
		case "MAYA2008 NNExporter for DirectX G2.0":
		case "MAYA2009 NNExporter for DirectX G2.0":
		case "MAYA2010 NNExporter for DirectX G2.0":
			$allVersionInfo = `mthGetVerDXG2`;
			break;

		case "MAYA85 NNExporter for OpenGL ES 1.1":
		case "MAYA2008 NNExporter for OpenGL ES 1.1":
		case "MAYA2009 NNExporter for OpenGL ES 1.1":
		case "MAYA2010 NNExporter for OpenGL ES 1.1":
			$allVersionInfo = `mthGetVerGLES11`;
			break;

		case "MAYA2008 NNExporter for OpenGL ES 2.0":
		case "MAYA2009 NNExporter for OpenGL ES 2.0":
		case "MAYA2010 NNExporter for OpenGL ES 2.0":
			$allVersionInfo = `mthGetVerGLES20`;
			break;

		case "MAYA2008 NNExporter for PS Vita":
		case "MAYA2009 NNExporter for PS Vita":
		case "MAYA2010 NNExporter for PS Vita":
			$allVersionInfo = `mthGetVerVITA`;
			break;
	}

	string $verinfo;
	string $info;
	string $copyright = "Copyright (C) 2002-2011 SEGA CS R&D Support Department";
	$verinfo = $copyright + "\n\n";
	for( $info in $allVersionInfo ) {
		$info = `substituteAllString $info "\n" ""`;
		$verinfo += $info + "\n\n";
	}

	confirmDialog
		-title			`mtnbGetTitleName`
		-message		$verinfo
		-messageAlign	"center"
		-button			"OK"
		-defaultButton	"OK"
		-dismissString	"OK";
}

//---------------------------------------------------------------------------
//  関数名 : mtnEcho
//  機　能 : コメント用ダイアログを表示します。
//  書　式 : global proc mtnEcho( string $comment )
//  引　数 : string $comment：表示するコメント
//
//  戻り値 :
//  説　明 :
//---------------------------------------------------------------------------
global proc mtnbMessageDialog( string $comment )
{
	confirmDialog
		-title			`mtnbGetTitleName`
		-message		$comment
		-messageAlign	"center"
		-button			"OK"
		-defaultButton	"OK";
}

global proc mtnbDebugPrint( string $comment )
{
	global string $mtnbDebug;
	if( $mtnbDebug == true )
		print( $comment );
}
