MetaFusion/Reference/SuperRiggingEditor/install.mel
2025-02-03 22:58:41 +08:00

108 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

global proc SGInstallation ()
{
string $InstallScriptLocation = `SGInstallScriptLocation`;
string $module = " SuperRiggingEditor any " + $InstallScriptLocation;
string $plugins = "plug-ins: plug-ins/";
string $icons = "XBMLANGPATH+:=images";
string $poseDriver = "PYTHONPATH+:=files/poseDriverConnect/python";
string $path = "SG_PATH:=";
string $write;
int $versions[] = {2018,2019,2020,2022,2023,2024,2025};
for ( $i=0; $i < size($versions); $i++ ){
$write += "+ MAYAVERSION:" + $versions[$i] + $module + "\n";
$write += $plugins + $versions[$i] +"\n";
$write += $icons + "\n";
$write += $poseDriver + "\n";
$write += $path + "\n\n";
}
string $allparts[];
string $separator = ( `about -nt` ) ? ";" : ":";
tokenize( getenv("MAYA_MODULE_PATH"), $separator, $allparts );
int $fileId;
string $modules;
for ( $i=0; $i < size($allparts); $i++ ){
if(`gmatch $allparts[$i] ("*/Documents/maya/modules")`){
$modules = $allparts[$i];
break;
}
}
if(!`file -q -ex $modules`)
{
sysFile -md $modules;
}
string $fileName = $modules + "/SuperRiggingEditor.mod" ;
$fileId = `fopen $fileName "w"`;
fwrite $fileId $write;
fclose $fileId;
deleteUI -window installWin;
confirmDialog
-title "SuperRiggingEditor"
-message "安装成功请重启maya后生效..."
-button "确定" ;
}
global proc METAHUMAN_INSTALL()
{
float $version = `MayaVersionAsFloat`;
if($version < 2017){
error -n "This version is not supported...";
}
if(`window -ex installWin`)
deleteUI -window installWin;
string $iconsName = `SGInstallScriptLocation`+"images/about.png";
window -title "SuperRiggingEditor" -s 0 installWin;
columnLayout -adj 1 ;
image -i $iconsName ;
separator -st "in" -h 5;
button -w 161 -h 36 -label "安装 SuperRiggingEditor" -command "SGInstallation;";
setParent ..;
window -e -widthHeight 328 126 installWin;
showWindow installWin;
}
METAHUMAN_INSTALL;
global proc SGInstallScriptLocator (){}
global proc string SGInstallScriptLocation()
{
string $whatIs=`whatIs SGInstallScriptLocator`;
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-1)`;
if (`gmatch $scriptLocation "*\*"`)
$scriptLocation=`substituteAllString $scriptLocation "\\" "/"`;
return $scriptLocation + "/";
}
global proc float MayaVersionAsFloat ()
{
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;
}