MetaBox/Scripts/Animation/AdvancedSkeleton/install.mel

87 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

2025-01-14 03:11:03 +08:00
global string $gShelfTopLevel;
string $currentShelf = `tabLayout -query -selectTab $gShelfTopLevel`;
setParent $currentShelf;
string $asInstallScriptLocation=`asInstallScriptLocation`;
if (`gmatch $asInstallScriptLocation "*\*"`)
$asInstallScriptLocation=`substituteAllString $asInstallScriptLocation "\\" "/"`;
string $scriptName="AdvancedSkeleton5";
string $sourceFile=$asInstallScriptLocation+$scriptName+".mel";
string $command="source \""+$sourceFile+"\";"+$scriptName+";";
string $iconExt="png";
if (`asMayaVersionAsFloat`<2012)
$iconExt="xpm";
string $icon=$asInstallScriptLocation+"AdvancedSkeleton5Files/icons/AS5."+$iconExt;
if (!`file -q -ex $sourceFile`)
error ("Something went wrong, can not find: \""+$sourceFile+"\"");
shelfButton
-command $command
-annotation $scriptName
-label $scriptName
-image $icon
-image1 $icon
-sourceType "mel"
;
//--installTemplate pause--//
shelfButton
-command ("source \""+$asInstallScriptLocation+"AdvancedSkeleton5Files/Selector/biped.mel\";")
-annotation "Selector:biped"
-label "Selector:biped"
-image ($asInstallScriptLocation+"AdvancedSkeleton5Files/icons/asBiped."+$iconExt)
-image1 ($asInstallScriptLocation+"AdvancedSkeleton5Files/icons/asBiped."+$iconExt)
-sourceType "mel"
;
shelfButton
-command ("source \""+$asInstallScriptLocation+"AdvancedSkeleton5Files/Selector/face.mel\";")
-annotation "Selector:face"
-label "Selector:face"
-image ($asInstallScriptLocation+"AdvancedSkeleton5Files/icons/asFace."+$iconExt)
-image1 ($asInstallScriptLocation+"AdvancedSkeleton5Files/icons/asFace."+$iconExt)
-sourceType "mel"
;
shelfButton
-command ("source \""+$asInstallScriptLocation+"AdvancedSkeleton5Files/picker/picker.mel\";")
-annotation "picker"
-label "picker"
-image ($asInstallScriptLocation+"AdvancedSkeleton5Files/picker/pickerFiles/icons/picker."+$iconExt)
-image1 ($asInstallScriptLocation+"AdvancedSkeleton5Files/picker/pickerFiles/icons/picker."+$iconExt)
-sourceType "mel"
;
//--installTemplate resume--//
print ("\n// "+$scriptName+" has been added to current shelf.\n");
global proc asInstallScriptLocator (){}
global proc string asInstallScriptLocation ()
{
string $whatIs=`whatIs asInstallScriptLocator`;
string $fullPath=`substring $whatIs 25 999`;
string $buffer[];
string $slash="/";
if (`gmatch $whatIs "*\\\\*"`)//sourced from ScriptEditor
$slash="\\";
int $numTok=`tokenize $fullPath $slash $buffer`;
int $numLetters=size($fullPath);
int $numLettersLastFolder=size($buffer[$numTok-1]);
string $scriptLocation=`substring $fullPath 1 ($numLetters-$numLettersLastFolder)`;
return $scriptLocation;
}
global proc float asMayaVersionAsFloat ()
{
float $version=2012;
if (`exists getApplicationVersionAsFloat`)
return `getApplicationVersionAsFloat`;
string $versionString=`about -v`;
string $tempString[];
string $char;
tokenize $versionString $tempString;
//default to 2012, if versionString is not all numbers
for ($i=0;$i<size($tempString[0]);$i++)
{
$char=`substring $tempString[0] ($i+1) ($i+1)`;
if (!`gmatch $char "[0-9]"`)
return 2012;
}
$version=$tempString[0];
return $version;
}