cod2-sdk/bin/maya/CODToolsMenu.mel

195 lines
7.5 KiB
Plaintext

/* This script creates and install COD Tools Menu
Proc List
CODStartup
CODToolsMenu
InstallCODToolsMenu
*/
//-------------------------------------------------------------------------------------------------------------------------------------//
// PROC: CODStartup
//
// COD Startup - Load plugins for now.
//-------------------------------------------------------------------------------------------------------------------------------------//
global proc CODStartup()
{
int $pluginLoaded;
// check if the plugin is loaded. If not, load it. If that fails, error out
$pluginLoaded = `pluginInfo -q -loaded XanimExport`;
if ( $pluginLoaded == 0 )
loadPlugin XanimExport;
$pluginLoaded = `pluginInfo -q -loaded XModelExport`;
if ( $pluginLoaded == 0 )
loadPlugin XModelExport;
$pluginLoaded = `pluginInfo -q -loaded runprocess`;
if ( $pluginLoaded == 0 )
loadPlugin runprocess;
}
//-------------------------------------------------------------------------------------------------------------------------------------//
// PROC: CODToolsMenu
//
// Create COD Tools Menu
//-------------------------------------------------------------------------------------------------------------------------------------//
global proc CODToolsMenu()
{
global string $gMainWindow;
global string $gMenuModeButton;
string $mayaMode = `setMenuMode`;
string $os = `about -operatingSystem`;
if(`menu -exists CODToolsMenu`)
deleteUI -menu CODToolsMenu;
setParent $gMainWindow;
menu -label "COD Tools"
-parent $gMainWindow
-allowOptionBoxes false
-tearOff true
CODToolsMenu;
menuItem -label "Model Exporter" -command "source CODExportModelWindow;CODExportModelWindow";
menuItem -label "Animation Exporter" -command "CODExportAnimationWindow";
menuItem -divider true;
//menuItem -subMenu true -tearOff true -label "Model Errors";
//menuItem -label "List all Error log files" -command "source CODExportErrorList;CODExportErrorList";
//menuItem -label "Show errors in open maya file" -command "source CODExportErrorWindow;CODExportErrorWindow";
//setParent -menu ..;
//menuItem -label "Animation Rig Controls" -command "source COD2_RigB_Controls;COD2_RigB_Controls";
menuItem -label "Notetrack Window" -command "source NoteTrack; NoteTrack";
//menuItem -label "Open Dumpanim" -command "getDumpedAnimation";
menuItem -divider true;
//menuItem -subMenu true -tearOff true -label "Animation Tools";
//menuItem -label "Copy Attributes" -command "source CopyAttributes;CopyAttributes;";
//menuItem -label "Paste Attributes" -command "source CopyAttributes;PasteAttributes;";
//setParent -menu ..;
//menuItem -divider true;
/*
menuItem -subMenu true -tearOff true -label "View Model";
menuItem -label "Load View Model" -command "source ViewModelControlWindow;LoadVMRig";
menuItem -label "Switch Gun File" -command "source ViewModelControlWindow;VM_ChangeGun";
menuItem -label "Update Maya files from master def mesh file" -command "source ViewModelControlWindow;MakeVMExportRig";
menuItem -divider true;
menuItem -label "Convert Old Animation" -command "source ConvertViewModelAnim;ConvertViewModelAnim";
menuItem -label "Batch Convert Old Animation" -command "source ConvertViewModelAnim;ConvertViewModelAnimBatch;";
menuItem -divider true;
menuItem -label "Attach left extra hand" -command "source ViewModelControlWindow ;Parent_Extra LE";
menuItem -label "Attach right extra hand" -command "source ViewModelControlWindow ;Parent_Extra RI";;
setParent -menu ..;
menuItem -divider true;
menuItem -subMenu true -tearOff true -label "Polygons";
menuItem -label "Align Vertices Up" -command "source polyAlignVertex.mel;polyAlignVertexUp";
menuItem -label "Align Vertices Down" -command "source polyAlignVertex.mel;polyAlignVertexDown";
menuItem -label "Align Vertices Left" -command "source polyAlignVertex.mel;polyAlignVertexLeft";
menuItem -label "Align Vertices Right" -command "source polyAlignVertex.mel;polyAlignVertexRight";
menuItem -label "Convert UV's to Mesh" -command "source UVs2Mesh; UVs2Mesh";
setParent -menu ..;
menuItem -divider true;
menuItem -subMenu true -tearOff true -label "Vertex Colors";
menuItem -label "Make all Vertex colors white" -command "source VTXColors.mel; WhiteVTXColor";
menuItem -divider true;
menuItem -divider true;
menuItem -label "Display selected vertex colors" -command "source VTXColors.mel; VTXColors 1 emission 0";
menuItem -label "Display selected vertex colors shaded" -command "source VTXColors.mel; VTXColors 1 diffuse 0";
menuItem -divider true;
menuItem -label "Display all vertex colors" -command "source VTXColors.mel; VTXColors 1 emission 1";
menuItem -label "Display all vertex colors shaded" -command "source VTXColors.mel; VTXColors 1 diffuse 1";
menuItem -divider true;
menuItem -label "Disable selected vertex colors" -command "source VTXColors.mel; VTXColors 0 diffuse 0";
menuItem -label "Disable all vertex colors" -command "source VTXColors.mel; VTXColors 0 diffuse 1";
setParent -menu ..;
//global proc VTXColors(int $DisplayVTXColor, string $ShadedMode, int $Global)
menuItem -divider true;
menuItem -subMenu true -tearOff true -label "Rigging";
menuItem -label "CopyPaste Weights Window" -command "source copyIndividualWeights;copyIndividualWeights;";
menuItem -label "Copy skin Cluster" -command "source CreateDupSkinCluster;CreateDupSkinCluster;";
menuItem -divider true;
menuItem -label "Count skinCluster influences" -command "source ShowInfluence;ShowInfluence;";
menuItem -label "Prune skin weights to joint number" -command "source PruneInfluence;PruneInfluence;";
setParent -menu ..;
menuItem -divider true;
menuItem -subMenu true -tearOff true -label "Shading";
menuItem -label "Normal shader" -command "source MakeNormalTexture; MakeNormalTexture;";
menuItem -label "Height map shader" -command "source MakeHeightMap; MakeHeightMap;";
menuItem -divider true;
menuItem -label "Normal Light Rig" -command "source xt_normalis; xt_normalis;";
*/
setParent -menu;
hotBox -updateMenus;
}
//-------------------------------------------------------------------------------------------------------------------------------------//
// PROC: InstallCODToolsMenu
//
// Installs COD Tools Menu, only if BonusTools is installed because of "whatIs" command
//-------------------------------------------------------------------------------------------------------------------------------------//
global proc InstallCODToolsMenu()
{
string $whatIsOutput;
string $userSetupFilePath;
int $whatIsOutputSize;
int $fileID;
$whatIsOutput = `whatIs usersetup.mel`;
$whatIsOutputSize = `size ( $whatIsOutput )`;
if ( $whatIsOutputSize == 0 )
return;
//print $whatIsOutput;
if ( size($whatIsOutput) > 17 )
{
$userSetupFilePath = `substring $whatIsOutput 18 $whatIsOutputSize `;
//print $userSetupFilePath;
$fileID = `fopen $userSetupFilePath "a"`;
}
else
{
$userSetupFilePath = `internalVar -usd`;
$userSetupFilePath += "usersetup.mel";
//print $userSetupFilePath;
$fileID = `fopen $userSetupFilePath "w"`;
}
fprint $fileID "\n\n";
fprint $fileID "// scriptJob to rebuild menu as working mode changes\n";
fprint $fileID "scriptJob -permanent -event \"MenuModeChanged\" \"CODToolsMenu\";\n\n";
fprint $fileID "// COD Startup\n";
fprint $fileID "CODStartup;\n";
fprint $fileID "// COD Tools Menu\n";
fprint $fileID "CODToolsMenu;\n";
fclose $fileID;
};