// Copyright (C) 1997-2010 Autodesk, Inc., and/or its licensors.mayaAscii mayaBinary mel OBJ directory plug-in audio move EPS Adobe(R) Illustrator(R) image fluidCache editMA editMB furFiles furShadowMap furEqualMap furImages furAttrMap HIKCharacter HIKState HIKEffectorSet HIKPropertySet mentalRay MAYA2011 HND2 Importer Autodesk Packet File FBX FBX export DAE_FBX DAE_FBX export MAYA2011 HND2Exporter
// All rights reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its licensors,
// which is protected by U.S. and Canadian federal copyright law and by
// international treaties.
//
// The Data is provided for use exclusively by You. You have the right to use,
// modify, and incorporate this Data into other products for purposes authorized 
// by the Autodesk software license agreement, without fee.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. AUTODESK
// DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES
// INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF NON-INFRINGEMENT,
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE 
// OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS
// LICENSORS BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL,
// DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS
// LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.

global proc string[] np_getFileRuleWidgets(string $wsName)
{
	// These lines should be visible always
	//
	string $defaults[] =
	{
//		Label							Widget				Default				Current
		(uiRes("m_np_getFileRuleWidgets.kObjWidgetScenes")),				"scene",		"scenes",				"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetImgs")),				"images",		"images",				"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetSrcImgs")),	"sourceImages",	"sourceimages",			"",
		(uiRes("m_np_getFileRuleWidgets.kDiskCache")),				"diskCache",	"data",					"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetParticles")),		"particles",	"particles",			"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetRendScene")),	"renderScenes",	"renderScenes",			"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetDepth")),				"depth",		"renderData/depth",		"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetIprImgs")),		"iprImages",	"renderData/iprImages",	"",
		(uiRes("m_np_getFileRuleWidgets.kTemplateWidget")),			"templates",	"assets",				"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetClips")),				"clips",		"clips",				"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetSound")),				"audio",		"sound",				"",
		(uiRes("m_np_getFileRuleWidgets.kAdobeIllustrator")), 	"illustrator",		"data",			"",
		(uiRes("m_np_getFileRuleWidgets.kMovie")),						"movie",		"data",					"",

		// This naming admittedly doesn't make much sense - textures should be
		// shaders, lights should be lights. Since 3dPaint is now using 
		// textures we're going to point both lights and (hypershade-
		// exported) shaders into the 'lights' location (and add a separate
		// 'shaders' location later...)
		//
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetShaders")),			"lights",		"renderData/shaders",	"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetTextures")),		"textures",		"textures",				"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetMel")),					"mel",			"mel",					"",
		(uiRes("m_np_getFileRuleWidgets.kRendWidget3dPaintTex")),"3dPaintTextures",	"3dPaintTextures",	"",

		// We should always use "mentalray" going forward.
		//
		(uiRes("m_np_getFileRuleWidgets.kRendWidgetMR")),				"mentalray",	"renderData/mentalray",	"",

		"DXF",											"dxf",				"data",				"",
		"IGES",											"iges",				"data",				"",
		"OBJ",											"obj",				"data",				"",
		"RIB",											"rib",				"data",				"",
		"Wire",											"wire",				"data",				"",
		"Move",											"move",				"data",				"",
		"Anim",											"anim",				"data",				"",
		"EPS",											"eps",				"data",				"",
		"mayaAscii",									"mayaAscii",		"scenes",			"",
		"mayaBinary",									"mayaBinary",		"scenes",			"",

		"MAYA2011 HND2Exporter",						"MAYA2011 HND2Exporter",					"hnd2",			"",
		"MAYA2011 NNExporter for PlayStation2",			"MAYA2011NNExporter for PlayStation2",		"nnps2",		"",
		"MAYA2011 NNExporter for GAMECUBE",				"MAYA2011NNExporter for GAMECUBE",			"nngc",			"",
		"MAYA2011 NNExporter for DirectX G11",			"MAYA2011NNExporter for DirectXG11",		"nndxg11",		"",
		"MAYA2011 NNExporter for Lindbergh",			"MAYA2011NNExporter for Lindbergh",			"nnlb",			"",
		"MAYA2011 NNExporter for PSP",					"MAYA2011NNExporter for PSP",				"nnpsp",		"",
		"MAYA2011 NNExporter for XBOX360",				"MAYA2011NNExporter for XBOX360",			"nnxbox360",	"",
		"MAYA2011 NNExporter for DirectX G20",			"MAYA2011NNExporter for DirectXG20",		"nndxg2",		"",
		"MAYA2011 NNExporter for PlayStation3",			"MAYA2011NNExporter for PlayStation3",		"nnps3",		"",
		"MAYA2011 NNExporter for OpenGL ES 11",			"MAYA2011NNExporter for OpenGLES11",		"nngles11",		"",
		"MAYA2011 NNExporter for OpenGL ES 20",			"MAYA2011NNExporter for OpenGLES20",		"nngles20",		"",
		"MAYA2011 NNExporter for PS Vita",				"MAYA2011NNExporter for PSVita",			"nnvita",		"",

		"MAYA2011 HND2 Importer",						"MAYA2011 HND2 Importer",					"hnd2",			""
	};

	// Only add info for mayaPLE if we have an eval version
	if( `about -evalVersion` ) {
		int $index = size($defaults);
		$defaults[$index] = "mayaPLE";
		$defaults[$index+1] = "mayaPLE";
		$defaults[$index+2] = "scenes";
		$defaults[$index+3] = "";
	}

	// This is a list of translators to completely ignore
	//
	string $ignore[] =
	{
		// In 2009, we explictly add rules for mayaAscii, mayaBinary and mayaPLE,
		// and have them point to the 'scenes' folder
		//"mayaAscii",
		//"mayaBinary",
		//"mayaPLE",
		"directory",
		"plug-in",
		"fluidCache",
		// The following are added by the Data Transfer team and
		// do not require project support.
		"studioImport",
		"DWG_DXF",
		"PTC_DC",
		"SW_DC",
		"STEP_DC",
		"STL_DC",
		"IV_DC",
		"CSB_DC",
		"IGES_DC",
		"DWG_DC",
		"IGESExport",
		"DXFExport",
		"DWGExport",
		"iv2",
		"OpenFlight",
		"vrml2",
		"GE2",
		"STL",
		"rtg",
		"aliasWireExport",

		// The following are either old translator names or
		// were introduced in error during development.  They
		// should be cleaned up.
		//
		"dxf",			// should be DXF
		"iges",			// should be IGES
		"image",		// we still need the TimageAccessor to be registered (see bug 239180), but this isn't actually used anymore. 
					 	// "images" is the preferred rule. 
		"aiff"			// should be audio
	};

	int $i, $j;
	int $found, $skip;
	string $map[] = np_getTranslatorWidgetMap();
	string $widget;

	string $trans[] = `translator -q -l`;

	// If we have a workspace, add the current file rules
	//
	if ($wsName != "")
	{
		string $rules[] = `workspace -q -frl`;

		for ($i = 0; $i < size($rules); ++$i)
		{
			$trans[size($trans)] = $rules[$i];
		}
	}

	for ($i = 0; $i < size($trans); ++$i)
	{
		$widget = $trans[$i];

		$skip = 0;

		// See if this translator should be ignored
		if( stringArrayContains($widget, $ignore) ) {
			continue;
		}

		// Map the translator name to a widget
		//
		for ($j = 0; $j < size($map); $j += 2)
		{
			if ($widget == $map[$j])
			{
				$widget = $map[$j + 1];
				break;
			}
		}

		// See if the translator is already in the list so we
		// don't add it twice.
		//
		for ($j = 0; $j < size($defaults); $j += 4)
		{
			if ($widget == $defaults[$j + 1])
			{
				// Yep, we've seen this one already
				if ($wsName != "")
				{
					$defaults[$j + 3] = `workspace -q -fre $trans[$i]`;
				}
				$skip = 1;
				break;
			}
		}

		if ($skip)
		{
			continue;
		}

		string $defaultLocation = $widget;
		if ( gmatch( $trans[$i], "fur*" ) )
		{
			$defaultLocation = "fur/" + $widget;
		}

		// Having made it this far, add it to the list of widgets
		//
		$defaults[size($defaults)] = $trans[$i];
		$defaults[size($defaults)] = $widget;
		$defaults[size($defaults)] = $defaultLocation;
		if ($wsName == "")
		{
			$defaults[size($defaults)] = "";
		}
		else
		{
			$defaults[size($defaults)] = `workspace -q -fre $trans[$i]`;
		}
	}

	return $defaults;
}
