//---------------------------------------------------------------------------
//  ccAttributeDispatcher.mel
//
//  Copyright (C) 2002 - 2009 SEGA Corporation CS R&D Support Department
//  All Rights Reserved.
//
//  Module  : ccAttributeDispatcher
//  File    : ccAttributeDispatcher.mel
//  Create  : 2006/06/16
//  Modify  : 2007/09/27 : Maya2008対応
//          : 2009/10/28 : OpenGL ES 1.1 版対応
//          : 2010/05/26 : プラグイン名の変更による再ロードできないバグ対応。
//          : 2011/06/29 : OpenGL ES 2.0, PS Vita版追加。
//  Version : 1.20.00
//  Note    : Ninja,NN,SymphonyのAttributeのDispatcher
//
//---------------------------------------------------------------------------
// SCA プラグインロード情報取得
proc int ccGetSCAPluginInfo()
{
	int $info = (`pluginInfo -query -loaded "Maya85ScaLoadInfo"`      ||
				 `pluginInfo -query -loaded "Maya85x64ScaLoadInfo"`   ||
				 `pluginInfo -query -loaded "Maya2008ScaLoadInfo"`    ||
				 `pluginInfo -query -loaded "Maya2008x64ScaLoadInfo"` ||
				 `pluginInfo -query -loaded "Maya2009ScaLoadInfo"`    ||
				 `pluginInfo -query -loaded "Maya2009x64ScaLoadInfo"` ||
				 `pluginInfo -query -loaded "Maya2010ScaLoadInfo"`    ||
				 `pluginInfo -query -loaded "Maya2010x64ScaLoadInfo"`  );
	return $info;
}

// NN プラグインロード情報取得
proc int ccGetNNPluginInfo()
{
	int $info = (
	// HND2 Exporter
/*****
				 `pluginInfo -query -loaded "MAYA85toHND2"`          ||
				 `pluginInfo -query -loaded "MAYA85x64toHND2"`       ||
				 `pluginInfo -query -loaded "MAYA2008toHND2"`        ||
				 `pluginInfo -query -loaded "MAYA2008x64toHND2"`     ||
				 `pluginInfo -query -loaded "MAYA2009toHND2"`        ||
				 `pluginInfo -query -loaded "MAYA2009x64toHND2"`     ||
				 `pluginInfo -query -loaded "MAYA2010toHND2"`        ||
				 `pluginInfo -query -loaded "MAYA2010x64toHND2"`     ||
******/
	// NN Exporter for GAMECUBE
				 `pluginInfo -query -loaded "MAYA85toNNGC"`          ||
				 `pluginInfo -query -loaded "MAYA85x64toNNGC"`       ||
				 `pluginInfo -query -loaded "MAYA2008toNNGC"`        ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNGC"`     ||
				 `pluginInfo -query -loaded "MAYA2009toNNGC"`        ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNGC"`     ||
				 `pluginInfo -query -loaded "MAYA2010toNNGC"`        ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNGC"`     ||
	// NN Exporter for Playstation2
				 `pluginInfo -query -loaded "MAYA85toNNPS2"`         ||
				 `pluginInfo -query -loaded "MAYA85x64toNNPS2"`      ||
				 `pluginInfo -query -loaded "MAYA2008toNNPS2"`       ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNPS2"`    ||
				 `pluginInfo -query -loaded "MAYA2009toNNPS2"`       ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNPS2"`    ||
				 `pluginInfo -query -loaded "MAYA2010toNNPS2"`       ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNPS2"`    ||
	// NN Exporter for PlayStation3
				 `pluginInfo -query -loaded "MAYA85toNNPS3"`         ||
				 `pluginInfo -query -loaded "MAYA85x64toNNPS3"`      ||
				 `pluginInfo -query -loaded "MAYA2008toNNPS3"`       ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNPS3"`    ||
				 `pluginInfo -query -loaded "MAYA2009toNNPS3"`       ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNPS3"`    ||
				 `pluginInfo -query -loaded "MAYA2010toNNPS3"`       ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNPS3"`    ||
	// NN Exporter for PSP  
				 `pluginInfo -query -loaded "MAYA85toNNPSP"`         ||
				 `pluginInfo -query -loaded "MAYA85x64toNNPSP"`      ||
				 `pluginInfo -query -loaded "MAYA2008toNNPSP"`       ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNPSP"`    ||
				 `pluginInfo -query -loaded "MAYA2009toNNPSP"`       ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNPSP"`    ||
				 `pluginInfo -query -loaded "MAYA2010toNNPSP"`       ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNPSP"`    ||
	// NN Exporter for DirectX G1.1
				 `pluginInfo -query -loaded "MAYA85toNNXB"`          ||
				 `pluginInfo -query -loaded "MAYA2008toNNXB"`        ||
				 `pluginInfo -query -loaded "MAYA2009toNNXB"`        ||
				 `pluginInfo -query -loaded "MAYA2010toNNXB"`        ||
	// NN Exporter for Xbox360
				 `pluginInfo -query -loaded "MAYA85toNNXB360"`       ||
				 `pluginInfo -query -loaded "MAYA85x64toNNXB360"`    ||
				 `pluginInfo -query -loaded "MAYA2008toNNXB360"`     ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNXB360"`  ||
				 `pluginInfo -query -loaded "MAYA2009toNNXB360"`     ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNXB360"`  ||
				 `pluginInfo -query -loaded "MAYA2010toNNXB360"`     ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNXB360"`  ||
	// NN Exporter for DirectX G2.0
				 `pluginInfo -query -loaded "MAYA85toNNDXG2"`        ||
				 `pluginInfo -query -loaded "MAYA85x64toNNDXG2"`     ||
				 `pluginInfo -query -loaded "MAYA2008toNNDXG2"`      ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNDXG2"`   ||
				 `pluginInfo -query -loaded "MAYA2009toNNDXG2"`      ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNDXG2"`   ||
				 `pluginInfo -query -loaded "MAYA2010toNNDXG2"`      ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNDXG2"`   ||
	// NN Exporter for Lindbergh
				 `pluginInfo -query -loaded "MAYA85toNNLB"`          ||
				 `pluginInfo -query -loaded "MAYA85x64toNNLB"`       ||
				 `pluginInfo -query -loaded "MAYA2008toNNLB"`        ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNLB"`     ||
				 `pluginInfo -query -loaded "MAYA2009toNNLB"`        ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNLB"`     ||
				 `pluginInfo -query -loaded "MAYA2010toNNLB"`        ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNLB"`     ||
	// NN Exporter for OpenGL ES1.1
				 `pluginInfo -query -loaded "MAYA85toNNGLES11"`      ||
				 `pluginInfo -query -loaded "MAYA85x64toNNGLES11"`   ||
				 `pluginInfo -query -loaded "MAYA2008toNNGLES11"`    ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNGLES11"` ||
				 `pluginInfo -query -loaded "MAYA2009toNNGLES11"`    ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNGLES11"` ||
				 `pluginInfo -query -loaded "MAYA2010toNNGLES11"`    ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNGLES11"` ||
	// NN Exporter for OpenGL ES2.0
				 `pluginInfo -query -loaded "MAYA85toNNGLES20"`      ||
				 `pluginInfo -query -loaded "MAYA85x64toNNGLES20"`   ||
				 `pluginInfo -query -loaded "MAYA2008toNNGLES20"`    ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNGLES20"` ||
				 `pluginInfo -query -loaded "MAYA2009toNNGLES20"`    ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNGLES20"` ||
				 `pluginInfo -query -loaded "MAYA2010toNNGLES20"`    ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNGLES20"` ||
	// NN Exporter for PS Vita
				 `pluginInfo -query -loaded "MAYA85toNNVITA"`      ||
				 `pluginInfo -query -loaded "MAYA85x64toNNVITA"`   ||
				 `pluginInfo -query -loaded "MAYA2008toNNVITA"`    ||
				 `pluginInfo -query -loaded "MAYA2008x64toNNVITA"` ||
				 `pluginInfo -query -loaded "MAYA2009toNNVITA"`    ||
				 `pluginInfo -query -loaded "MAYA2009x64toNNVITA"` ||
				 `pluginInfo -query -loaded "MAYA2010toNNVITA"`    ||
				 `pluginInfo -query -loaded "MAYA2010x64toNNVITA"` );

	return $info;
}


// Ninja プラグインロード情報取得
proc int ccGetNinjaPluginInfo()
{
//	int $info = (`pluginInfo -query -loaded "MAYA6 NINJA Exporter                           "` ||
	int $info = (`pluginInfo -query -loaded "MAYA65 NINJA Exporter                          "` ||
				 `pluginInfo -query -loaded "MAYA7 NINJA Exporter                           "` ||
				 `pluginInfo -query -loaded "MAYA8 NINJA Exporter                           "` ||
//				 `pluginInfo -query -loaded "MAYA85 NINJA Exporter                          "` ||
				 `pluginInfo -query -loaded "MAYA85toNINJA"`                                   ||
				 `pluginInfo -query -loaded "MAYA2008 NINJA Exporter                        "` ||
				 `pluginInfo -query -loaded "MAYA2008toNINJA"`                                 ||
				 `pluginInfo -query -loaded "MAYA2009 NINJA Exporter                        "` ||
				 `pluginInfo -query -loaded "MAYA2010 NINJA Exporter                        "` );
	return $info;
}

global proc ccAttributeDispatcher( string $nodeName )
{
	string $nodeType =`nodeType $nodeName`;

	switch( $nodeType ) {
		case "mesh":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			if( ccGetNNPluginInfo() )		nnNodeAttribute( $nodeName );
			if( ccGetNinjaPluginInfo() )	ninjaNodeAttribute( $nodeName );
			break;
		case "locator":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			if( ccGetNNPluginInfo() )		nnNodeAttribute( $nodeName );
			break;
		case "joint":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			if( ccGetNNPluginInfo() )		nnNodeAttribute( $nodeName );
			break;
		case "ikHandle":
		case "ikEffector":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			break;
		case "lambert":
		case "anisotropic":
		case "blinn":
		case "phong":
		case "phongE":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			if( ccGetNNPluginInfo() )		nnMaterialAttribute( $nodeName );
			if( ccGetNinjaPluginInfo() )	ninjaMaterialAttribute( $nodeName );
			break;
		case "file":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			if( ccGetNNPluginInfo() )		nnTextureAttribute( $nodeName );
			break;
		case "pointLight":
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
			if( ccGetNNPluginInfo() )		nnPointLightAttribute( $nodeName );
			break;
		default:
			if( ccGetSCAPluginInfo() )		SEGACustomAttribute( $nodeName );
//			if( ccGetNNPluginInfo() )		nnNodeAttribute( $nodeName );
			break;
	}
}
// End of file
