Update
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from MGP import loader
|
||||
|
||||
|
||||
class My_PickerLoaderExample(loader.MGPickerLoaderBase):
|
||||
def pickerFileForAssetName(self, assetName):
|
||||
# This is a hard-code bad example, but anyway you should return a path to a picker file:
|
||||
return "D:/My Documents/maya/MG_PickerData/Default/chase/chase.mgpkr"
|
||||
|
||||
|
||||
class MGPickerRigListerExample(loader.MGPickerRigListerBase):
|
||||
def mayaScene_rigs(self):
|
||||
# Retrieve maya rigs you wanna load pickers somehow and return the list:
|
||||
return ["char1", "char2", "prop1", "set1"]
|
||||
|
||||
def mayaScene_characters(self):
|
||||
return ["char1", "char2"]
|
||||
|
||||
def mayaScene_props(self):
|
||||
return ["prop1"]
|
||||
|
||||
def mayaScene_sets(self):
|
||||
return ["set1"]
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
This script contains procedures that supports for attribute sync between Sliders, attribute buttons and maya attributes.
|
||||
*/
|
||||
|
||||
proc string mgp_getAttrSyncCommand(string $node, string $attrLongName)
|
||||
{
|
||||
return ("MGPickerAttrSyncer -s \""+$node+"\" \""+$attrLongName+"\";");
|
||||
}
|
||||
|
||||
/*
|
||||
global proc _MGP_evaluateAllAttrSyncCommands()
|
||||
{
|
||||
// To-Do: Do a performance pass in c++ to achieve a optimum sync scheduling system.
|
||||
global int $MGPICKER_startTime_refresh;
|
||||
$elapsedTime = `timerX -startTime $MGPICKER_startTime_refresh`;
|
||||
string $pattern = "*MGPickerAttrSyncer*";
|
||||
if ($elapsedTime > 1)
|
||||
{
|
||||
$jobs = `scriptJob -listJobs`;
|
||||
for($i=0; $i<size($jobs); ++$i)
|
||||
{
|
||||
string $script_str = $jobs[$i];
|
||||
if(`gmatch $script_str $pattern`)
|
||||
{
|
||||
$parts = stringToStringArray($script_str, "\"");
|
||||
string $nodeAttr[] = stringToStringArray($parts[5], ".");
|
||||
string $syncCmd = `mgp_getAttrSyncCommand $nodeAttr[0] $nodeAttr[1]`;
|
||||
eval ($syncCmd);
|
||||
}
|
||||
}
|
||||
$MGPICKER_startTime_refresh = `timerX`;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
proc mgp_createScriptJobDoit(string $node, string $attrLongName)
|
||||
{
|
||||
// Because we need to catchQuiet when call this function, which occupies the return value,
|
||||
// so global variable is used here as a stupid workaround:
|
||||
global int $MGPICKER_WatcherID;
|
||||
string $syncCmd = `mgp_getAttrSyncCommand $node $attrLongName`;
|
||||
// to-do: check why _MGP_evaluateAllAttrSyncCommands helped but now it messed up.
|
||||
$MGPICKER_WatcherID = `scriptJob -killWithScene -attributeChange ($node+"."+$attrLongName) $syncCmd`;
|
||||
}
|
||||
|
||||
global proc int MGP_CreateWatcher(string $node, string $attrLongName)
|
||||
{
|
||||
if(!`objExists $node`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(`nodeType $node` == "container")
|
||||
{
|
||||
string $bindAttrs[]=`container -q -bindAttr $node`;
|
||||
int $sz = size($bindAttrs);
|
||||
for($i=0; $i<$sz; $i+=2)
|
||||
{
|
||||
if($bindAttrs[$i+1] == $attrLongName)
|
||||
{
|
||||
string $realObjDotName = $bindAttrs[$i];
|
||||
string $temp[]=`stringToStringArray $realObjDotName "."`;
|
||||
$node = $temp[0];
|
||||
$attrLongName = $temp[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!`attributeExists $attrLongName $node`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int $error = catchQuiet(`mgp_createScriptJobDoit $node $attrLongName`);
|
||||
if($error)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
global int $MGPICKER_WatcherID;
|
||||
return $MGPICKER_WatcherID;
|
||||
}
|
||||
global proc MGP_DeleteWatcher(int $id)
|
||||
{
|
||||
if(!`scriptJob -ex $id`)
|
||||
{
|
||||
return;
|
||||
}
|
||||
scriptJob -kill $id;
|
||||
}
|
||||
global proc int MGP_WatcherExist(int $id)
|
||||
{
|
||||
return `scriptJob -ex $id`;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
# To-Do: Maya calls need to be removed for non-maya mode.
|
||||
from maya import mel
|
||||
|
||||
|
||||
def initializePythonModules():
|
||||
def _addToSysPath(pathStr, label):
|
||||
if not os.path.isdir(pathStr):
|
||||
print(
|
||||
"Error initializing MGPicker {}, as the directory does not exist: {}".format(
|
||||
label, pathStr
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
if not sys.path.count(pathStr):
|
||||
sys.path.append(pathStr)
|
||||
|
||||
_addToSysPath(mel.eval("MGP_GetPythonAPIDir"), "python API")
|
||||
_addToSysPath(mel.eval("MGP_GetAutoLoaderDir"), "autoLoaders")
|
||||
|
||||
|
||||
initializePythonModules()
|
||||
@@ -0,0 +1,16 @@
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
|
||||
def MGP_LoadProcess(program, args=[]):
|
||||
if not program or not os.path.isfile(program):
|
||||
return False
|
||||
theArgs = [program]
|
||||
theArgs.extend(args)
|
||||
try:
|
||||
subprocess.Popen(theArgs)
|
||||
except Exception as e:
|
||||
print("Error loading program {}: {}".format(program, e.value))
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -0,0 +1,244 @@
|
||||
//==============================================================//
|
||||
// MGFloatingLicence Shared Procedures
|
||||
//==============================================================//
|
||||
//Author: Miguel (Wenfeng Gao)
|
||||
//website: http://mgland.com
|
||||
//E-mail: mgtoolspro@gmail.com
|
||||
//CopyRight Miguel @ mgland animation studio.
|
||||
//The script is shared between MGTools and MG-PickerStudio, etc.
|
||||
//==============source codes if necessary=========================
|
||||
proc initGlobalVars()
|
||||
{
|
||||
global string $gMG_LicenseConnectorDir_ov;
|
||||
$gMG_LicenseConnectorDir_ov = "MG_LicenceConnectorDir";
|
||||
|
||||
global string $gMG_Connector_APPName;
|
||||
$gMG_Connector_APPName = "MG-LicenceConnector";
|
||||
|
||||
global string $gMG_ConnectorInfoServerFileName = "MG_LicenceConnector.txt";
|
||||
global string $gMG_ConnectorInfoServerFile_Dir_Key = "MGPICKER_FLOAT_LIC_CONNECTOR_DIR";
|
||||
}
|
||||
initGlobalVars;
|
||||
proc int mg_osType()
|
||||
{
|
||||
int $osType = 0;
|
||||
if(`about -mac`)
|
||||
{
|
||||
$osType = 1;
|
||||
}
|
||||
else if(`about -linux`)
|
||||
{
|
||||
$osType = 2;
|
||||
}
|
||||
return $osType;
|
||||
}
|
||||
proc string mg_getProgramExt()
|
||||
{
|
||||
int $osType = 1-`about -win`;
|
||||
string $ext = ".exe";
|
||||
if($osType) //macos && linux
|
||||
{
|
||||
$ext = "";
|
||||
}
|
||||
return $ext;
|
||||
}
|
||||
global proc string MGP_GetConnectorProgramFileName()
|
||||
{
|
||||
global string $gMG_Connector_APPName;
|
||||
return ($gMG_Connector_APPName + `mg_getProgramExt`);
|
||||
}
|
||||
|
||||
proc string mg_substituteToLocalSep(string $path)
|
||||
{
|
||||
if(!`mg_osType`)
|
||||
{
|
||||
return `substituteAllString $path "/" "\\"`;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
//for getting programs from optionVar and server define ------------------------------
|
||||
|
||||
proc string mg_getServerConnectionFile(string $serverConfigDir)
|
||||
{
|
||||
global string $gMG_ConnectorInfoServerFileName;
|
||||
string $file = $serverConfigDir + $gMG_ConnectorInfoServerFileName;
|
||||
return `mg_substituteToLocalSep $file`;
|
||||
}
|
||||
proc string mg_getSubfolderAbsolutePath(string $serverConfigDir, string $path)
|
||||
{
|
||||
string $pwd = $serverConfigDir;
|
||||
$path = `substring $path 3 (size($path))`;
|
||||
return $pwd + $path;
|
||||
}
|
||||
proc string mg_getParentfolderAbsolutePath(string $serverConfigDir, string $path)
|
||||
{
|
||||
string $pwd = $serverConfigDir;
|
||||
string $pathParts[] = `stringToStringArray $path "/"`;
|
||||
string $nonDotParts[];
|
||||
for($p in $pathParts)
|
||||
{
|
||||
if($p == "..")
|
||||
{
|
||||
$pwd = `dirname $pwd`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nonDotParts[size($nonDotParts)] = $p;
|
||||
}
|
||||
}
|
||||
string $leftoverPath = `stringArrayToString $nonDotParts "/"`;
|
||||
if(!`endsWith $pwd "/"`)
|
||||
{
|
||||
$pwd += "/";
|
||||
}
|
||||
return $pwd + $leftoverPath;
|
||||
}
|
||||
proc string mg_parseServerConnectorPath(string $serverConfigDir, string $path, int $fullPath)
|
||||
{
|
||||
$path = strip($path);
|
||||
$path = `substituteAllString $path "\\" "/"`;
|
||||
if(`gmatch $path "./*"`)
|
||||
{
|
||||
$path = `mg_getSubfolderAbsolutePath $serverConfigDir $path`;
|
||||
}
|
||||
else if(`gmatch $path "../*"`)
|
||||
{
|
||||
$path = `mg_getParentfolderAbsolutePath $serverConfigDir $path`;
|
||||
}
|
||||
|
||||
string $programFileName = `MGP_GetConnectorProgramFileName`;
|
||||
int $isFullPath = `endsWith $path $programFileName`;
|
||||
if(!$fullPath && $isFullPath)
|
||||
{
|
||||
$path = `dirname $path` + "/";
|
||||
}
|
||||
if($fullPath && !$isFullPath)
|
||||
{
|
||||
if(!`endsWith $path "/"`)
|
||||
{
|
||||
$path += "/";
|
||||
}
|
||||
$path += $programFileName;
|
||||
}
|
||||
return `mg_substituteToLocalSep $path`;
|
||||
}
|
||||
global proc string MG_GetServerConnector(string $serverConfigDir, int $fullPath)
|
||||
{
|
||||
global string $gMG_ConnectorInfoServerFile_Dir_Key;
|
||||
string $value = strip(`getenv $gMG_ConnectorInfoServerFile_Dir_Key`);
|
||||
if(!size($value))
|
||||
{
|
||||
string $file = `mg_getServerConnectionFile $serverConfigDir`;
|
||||
if(!`filetest -f $file`)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
$readFileID=`fopen $file "r"`;
|
||||
while(!`feof $readFileID`)
|
||||
{
|
||||
$nextLine=strip(`fgetline $readFileID`);
|
||||
if (size($nextLine) && !`startsWith $nextLine "#"`)
|
||||
{
|
||||
if(`startsWith $nextLine $gMG_ConnectorInfoServerFile_Dir_Key`)
|
||||
{
|
||||
string $datas[]=`stringToStringArray $nextLine "="`;
|
||||
if(size($datas)!=2)
|
||||
{
|
||||
fclose $readFileID;
|
||||
return "";
|
||||
}
|
||||
fclose $readFileID;
|
||||
$value = $datas[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose $readFileID;
|
||||
}
|
||||
if(size($value))
|
||||
{
|
||||
return `mg_parseServerConnectorPath $serverConfigDir $value $fullPath`;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
global proc string MG_getLicenseConnectorDir(string $serverConfigDir, int $fullPath)
|
||||
{
|
||||
global string $gMG_LicenseConnectorDir_ov;
|
||||
string $dir;
|
||||
//we check out the server data file first:
|
||||
string $pathInServerFile = `MG_GetServerConnector $serverConfigDir $fullPath`;
|
||||
if(size($pathInServerFile))
|
||||
{
|
||||
if(!$fullPath)
|
||||
{
|
||||
$pathInServerFile = `mg_substituteToLocalSep $pathInServerFile `;
|
||||
if(`filetest -d $pathInServerFile`)
|
||||
{
|
||||
return $pathInServerFile;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathInServerFile = `mg_substituteToLocalSep $pathInServerFile `;
|
||||
if(`filetest -f $pathInServerFile`)
|
||||
{
|
||||
return $pathInServerFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if not server record:
|
||||
int $hasRecord = 0;
|
||||
if(`optionVar -ex $gMG_LicenseConnectorDir_ov`)
|
||||
{
|
||||
$dir = `optionVar -q $gMG_LicenseConnectorDir_ov`;
|
||||
$dir = `mg_substituteToLocalSep $dir `;
|
||||
if(`filetest -d $dir`)
|
||||
{
|
||||
if($fullPath)
|
||||
{
|
||||
string $programFileName = `MGP_GetConnectorProgramFileName`;
|
||||
$dir += $programFileName;
|
||||
$hasRecord =`filetest -f $dir`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$hasRecord = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$dir = `mg_substituteToLocalSep $dir `;
|
||||
return $dir;
|
||||
}
|
||||
|
||||
// save the connector and news to optionvar.------------------------
|
||||
proc string processDirToSave(string $filePath)
|
||||
{
|
||||
if(!size($filePath))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
$filePath = `mg_substituteToLocalSep $filePath `;
|
||||
string $dir = $filePath;
|
||||
if(`filetest -f $filePath`)
|
||||
{
|
||||
$dir = `dirname $filePath`;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!`filetest -d $filePath`)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
if(!`endsWith $dir "/"`)
|
||||
{
|
||||
$dir += "/";
|
||||
}
|
||||
$dir = `mg_substituteToLocalSep $dir `;
|
||||
return $dir;
|
||||
}
|
||||
|
||||
//=========lazy source marker proc=========================
|
||||
global proc MGFloatLicence_SharedProcs()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//==============================================================//
|
||||
// MG - Float License
|
||||
//==============================================================//
|
||||
//Author: Miguel (Wenfeng Gao)
|
||||
//website: http://mgland.com
|
||||
//Feedback: http://mgland.com/MGtools_en.html?url=Feedback
|
||||
//E-mail: mgtoolspro@gmail.com
|
||||
//CopyRight Miguel @ mgland animation studio.
|
||||
|
||||
proc sourceSharedScript()
|
||||
{
|
||||
|
||||
global string $gMGPicker_ProductName = "MGPicker";
|
||||
if(`exists "MGFloatLicence_SharedProcs"`)
|
||||
{
|
||||
return;
|
||||
}
|
||||
global string $MGPicker_ProgramPath;
|
||||
global string $MGPicker_ProgramFolder;
|
||||
global string $MGPicker_AutoSourceFolder;
|
||||
string $script = $MGPicker_ProgramPath + $MGPicker_ProgramFolder + "/"+$MGPicker_AutoSourceFolder+"/MGFloatLicence_SharedProcs.mel";
|
||||
eval ("source \""+$script+"\"");
|
||||
}
|
||||
sourceSharedScript;
|
||||
|
||||
//for getting programs------------------------------------------------------------
|
||||
proc string mgpicker_getServerConnectionDir()
|
||||
{
|
||||
global string $MGPicker_ProgramPath;
|
||||
global string $MGPicker_ProgramFolder;
|
||||
global string $MGPicker_ServerConfigFolder;
|
||||
return ($MGPicker_ProgramPath + $MGPicker_ProgramFolder + "/" + $MGPicker_ServerConfigFolder + "/");
|
||||
}
|
||||
|
||||
global proc string MGPicker_GetLicenceConnectorDir_ServerDefine(int $fullPath)
|
||||
{
|
||||
string $serverConfigDir = `mgpicker_getServerConnectionDir`;
|
||||
return `MG_GetServerConnector $serverConfigDir $fullPath`;
|
||||
}
|
||||
global proc string MGPicker_GetLicenseConnectorDir(int $fullPath)
|
||||
{
|
||||
string $serverConfigDir = `mgpicker_getServerConnectionDir`;
|
||||
return `MG_getLicenseConnectorDir $serverConfigDir $fullPath`;
|
||||
}
|
||||
|
||||
// for launching programs--------------------------------------------------------------------
|
||||
global proc int MGP_loadProcess(string $path, string $args)
|
||||
{
|
||||
string $argStr = "";
|
||||
if(size($args))
|
||||
{
|
||||
string $argList[]=`stringToStringArray $args " "`;
|
||||
$argStr = ", '" + `stringArrayToString $argList "','"` + "'";
|
||||
}
|
||||
$path = `substituteAllString $path "\\" "/"`;
|
||||
string $cmd = "import subprocess;subprocess.Popen(['"+$path+"'"+$argStr+"])";
|
||||
if(catch (`python $cmd`))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
global proc MGPickerAttrNudgerProperties ()
|
||||
//
|
||||
// Procedure Name:
|
||||
// MGPickerAttrNudgerProperties
|
||||
//
|
||||
// Description:
|
||||
// layout of tool property sheet
|
||||
//
|
||||
// Input Arguments:
|
||||
// None.
|
||||
//
|
||||
// Return Value:
|
||||
// None.
|
||||
//
|
||||
{
|
||||
setUITemplate -pushTemplate DefaultTemplate;
|
||||
|
||||
string $parent = `toolPropertyWindow -q -location`;
|
||||
setParent $parent;
|
||||
string $curctx = `currentCtx`;
|
||||
|
||||
columnLayout -adj 1 MGPickerAttrNudger; //The layout name is critical, should be the context class name.
|
||||
global string $MGPicker_ProgramPath;
|
||||
string $icon = $MGPicker_ProgramPath+"MGPicker_Program/Icons/bgimages/pickerbanner.png";
|
||||
string $fl = `formLayout -bgc 0.106 0.106 0.106`;
|
||||
string $icoWgt = `image -bgc 0.106 0.106 0.106 -i $icon -w 342 -h 84`;
|
||||
formLayout -e
|
||||
|
||||
-af $icoWgt "left" -2
|
||||
-af $icoWgt "top" -2
|
||||
-af $icoWgt "right" -2
|
||||
-af $icoWgt "bottom" -2
|
||||
$fl;
|
||||
setParent ..;
|
||||
button -l "Feedback.." -c "showHelp -a \"http://twincodes.com/mgpicker.html\"";
|
||||
|
||||
setUITemplate -popTemplate;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
global proc MGPickerAttrNudgerValues(string $toolName)
|
||||
{
|
||||
global string $MGPicker_ProgramPath;
|
||||
string $icon = $MGPicker_ProgramPath+"MGPicker_Program/Icons/Colored/Picker_designerModeIcon.png";
|
||||
string $helpHtml =($MGPicker_ProgramPath+"MGPicker_Help/English/index.html");
|
||||
string $lan = `MGPickerService -q -osl`;
|
||||
if($lan=="Chinese")$helpHtml = ($MGPicker_ProgramPath+"MGPicker_Help/SimplifiedChinese/index.html");
|
||||
|
||||
string $help = " -a \""+$helpHtml+"\"";
|
||||
toolPropertySetCommon $toolName $icon $help;
|
||||
|
||||
MGPickerAttrNudgerOptionValues($toolName);
|
||||
toolPropertySelect MGPickerAttrNudger;
|
||||
}
|
||||
global proc MGPickerAttrNudgerOptionReset()
|
||||
{
|
||||
}
|
||||
global proc MGPickerAttrNudgerOptionValues(string $toolName)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,869 @@
|
||||
/*
|
||||
This script contains publish related function codes in picker.
|
||||
It will be auto-source when MG-Picker Studio tool loads.
|
||||
*/
|
||||
|
||||
proc string mgp_ensurePathEndsWithSlash(string $path)
|
||||
{
|
||||
if(!`size $path`)
|
||||
{
|
||||
return $path;
|
||||
}
|
||||
if(!`endsWith $path "/"`)
|
||||
{
|
||||
$path += "/";
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
global proc string MGP_getSceneBasename()
|
||||
{
|
||||
string $bn = basenameEx(`file -q -shn -sn`);
|
||||
//string $inner = `mgp_ensurePathEndsWithSlash $targetDir`+ $bn;
|
||||
return $bn;
|
||||
}
|
||||
proc int mgp_testTargetDir(string $targetDir)
|
||||
{
|
||||
if(!size($targetDir))
|
||||
{
|
||||
MGP_ScriptEditorFeedback `MGP_MultiLanguage "pkr.publish.emptyDir"` 2;
|
||||
return 0;
|
||||
}
|
||||
if(!`filetest -d $targetDir`)
|
||||
{
|
||||
if(!`sysFile -md $targetDir`)
|
||||
{
|
||||
MGP_ScriptEditorFeedback `MGP_MultiLanguage_rep1 "pkr.publish.dirCantBuild.war" $targetDir` 2;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
proc int mgp_testCurrentSceneSaveState()
|
||||
{
|
||||
string $sceneFile = `file -q -sn`;
|
||||
if(!`size $sceneFile`)
|
||||
{
|
||||
confirmDialog -title `MGP_getAppName` -message `MGP_MultiLanguage "pkr.publish.sceneUntitled"` -button "OK";
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
proc string mgp_getNonDuplicateFilename(string $dir, string $filename)
|
||||
{
|
||||
if(!`filetest -d $dir`)
|
||||
{
|
||||
return $filename;
|
||||
}
|
||||
$dir = `mgp_ensurePathEndsWithSlash $dir`;
|
||||
string $ext = `fileExtension $filename`;
|
||||
string $exFiles[]=`getFileList -fld $dir -fs ("*."+$ext)`;
|
||||
string $basename = `basenameEx $filename`;
|
||||
return `MGP_GetValidNonDupFileName $basename $ext "UntitledImage" $exFiles`;
|
||||
}
|
||||
proc int mgp_copyAllImagesToDir(string $targetDir,
|
||||
int $publishTextures,
|
||||
int $publishImagePlane,
|
||||
int $toRelative,
|
||||
int $publishInScenePickers)
|
||||
{
|
||||
if(!$publishTextures && !$publishImagePlane)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
string $textureFolderName = "sourceimages";
|
||||
string $targetDirSlash = `mgp_ensurePathEndsWithSlash $targetDir`;
|
||||
string $textureDir = $targetDirSlash + $textureFolderName;
|
||||
if(!`filetest -d $textureDir`)
|
||||
{
|
||||
if(!`sysFile -md $textureDir`)
|
||||
{
|
||||
MGP_ScriptEditorFeedback `MGP_MultiLanguage_rep2 "pkr.publish.canBuildDir.withinDir" $textureFolderName $targetDir` 2;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$textureDir += "/";
|
||||
string $files[] = `ls -type "file"`;
|
||||
string $imageplanes[] = `ls -type "imagePlane"`;
|
||||
int $fileLen = size($files);
|
||||
int $imageplaneLen = size($imageplanes);
|
||||
|
||||
int $needProcess = 0;
|
||||
if($publishTextures)
|
||||
{
|
||||
if($fileLen)
|
||||
{
|
||||
$needProcess = 1;
|
||||
}
|
||||
}
|
||||
if($publishImagePlane)
|
||||
{
|
||||
if($imageplaneLen)
|
||||
{
|
||||
$needProcess = 1;
|
||||
}
|
||||
}
|
||||
if(!$needProcess)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
string $processedImage[];
|
||||
clear $processedImage;
|
||||
|
||||
//set project to support relative path:
|
||||
string $oldProj;
|
||||
if($toRelative)
|
||||
{
|
||||
$oldProj = `workspace -q -dir`;
|
||||
setProject $targetDir;
|
||||
workspace -dir $targetDir ;
|
||||
workspace -fileRule "sourceImages" "sourceimages";
|
||||
workspace -fileRule "mayaAscii" "";
|
||||
workspace -fileRule "mayaBinary" "";
|
||||
workspace -fileRule "autoSave" "";
|
||||
workspace -fileRule "offlineEdit" "";
|
||||
workspace -fileRule "movie" "";
|
||||
workspace -fileRule "templates" "";
|
||||
workspace -fileRule "particles" "";
|
||||
workspace -s;
|
||||
workspace -update;
|
||||
}
|
||||
|
||||
//copy and set relative the textures:
|
||||
if($publishTextures)
|
||||
{
|
||||
for($f in $files)
|
||||
{
|
||||
string $image = `getAttr ($f+".fileTextureName")`;
|
||||
string $bn = `basename $image ""`;
|
||||
if(`stringArrayContains $image $processedImage`)
|
||||
{
|
||||
if($toRelative)
|
||||
{
|
||||
//print ($textureFolderName+"/"+$bn+"\n");
|
||||
setAttr -type "string" ($f+".fileTextureName") ($textureFolderName+"/"+$bn);
|
||||
$rep = `MGP_MultiLanguage "pkr.publish.texture.relative"`;
|
||||
MGP_ScriptEditorFeedback $rep 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(`filetest -f $image`)
|
||||
{
|
||||
$bn = `mgp_getNonDuplicateFilename $textureDir $bn`;
|
||||
string $targetFile = ($textureDir + $bn);
|
||||
if(!`sysFile -copy $targetFile $image`)
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.errorCopyTexture"`+" "+$image+".") 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
string $rep = (`MGP_MultiLanguage "pkr.publish.textureCopied"`+" "+$image);
|
||||
if($toRelative)
|
||||
{
|
||||
//print ($textureFolderName+"/"+$bn+"\n");
|
||||
setAttr -type "string" ($f+".fileTextureName") ($textureFolderName+"/"+$bn);
|
||||
$rep += (", " + `MGP_MultiLanguage "pkr.publish.andRelative"`);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rep += ".";
|
||||
}
|
||||
MGP_ScriptEditorFeedback $rep 0;
|
||||
$processedImage[size($processedImage)] = $image;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.textureNotExist"`+" "+$image+".") 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//copy and set relative the imageplane images:
|
||||
if($publishImagePlane)
|
||||
{
|
||||
for($ip in $imageplanes)
|
||||
{
|
||||
string $image = `getAttr ($ip+".imageName")`;
|
||||
string $bn = `basename $image ""`;
|
||||
if(`stringArrayContains $image $processedImage`)
|
||||
{
|
||||
if($toRelative)
|
||||
{
|
||||
setAttr -type "string" ($ip+".imageName") ($textureFolderName+"/"+$bn);
|
||||
$rep = `MGP_MultiLanguage_rep1 "pkr.publish.imagePlane.relative" $ip`;
|
||||
MGP_ScriptEditorFeedback $rep 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(`filetest -f $image`)
|
||||
{
|
||||
$bn = `mgp_getNonDuplicateFilename $textureDir $bn`;
|
||||
string $targetFile = ($textureDir + $bn);
|
||||
if(!`sysFile -copy $targetFile $image`)
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.errorCopyImageplane"`+" "+$image+".") 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
string $rep = (`MGP_MultiLanguage "pkr.publish.imageplaneCopied"`+" "+$image);
|
||||
if($toRelative)
|
||||
{
|
||||
setAttr -type "string" ($ip+".imageName") ($textureFolderName+"/"+$bn);
|
||||
$rep += (", "+`MGP_MultiLanguage "pkr.publish.andRelative"`);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rep += ".";
|
||||
}
|
||||
MGP_ScriptEditorFeedback $rep 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.iamgeplaneNotExist"`+" "+$image+".") 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file -save;
|
||||
string $scFile = `file -q -sn`;
|
||||
if($publishInScenePickers)
|
||||
{
|
||||
string $bn = `basenameEx $scFile`;
|
||||
int $result = `MGPickerView -e -saveAsSceneNode $bn 1`;
|
||||
if(!$result)
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.inscenePicker.error"`) 2;
|
||||
file -new -f;
|
||||
if($toRelative)
|
||||
{
|
||||
//remember to set back the project:
|
||||
setProject $oldProj;
|
||||
workspace -dir $oldProj;
|
||||
workspace -update;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
file -save;
|
||||
|
||||
//now copy the scene dir:
|
||||
string $scDir = ($targetDirSlash+"scenes/pickerimages");
|
||||
//print ($scDir+"\n");
|
||||
|
||||
if(`filetest -d $scDir`)
|
||||
{
|
||||
//print "scDir exists!\n";
|
||||
string $tgtDir = ($targetDirSlash+"/pickerimages");
|
||||
int $result = MGP_CopyFolder($tgtDir,$scDir,1);
|
||||
//print ("\n"+$result+"\n"+"Source: "+$tgtDir+"\nTarget:"+$tgtDir+"\n");
|
||||
if($result)
|
||||
{
|
||||
MGP_DeleteFolder_Ex($scDir,"","",1, 0);
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.inscenePicker.done"`) 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.erroCopyImageDir"`) 2;
|
||||
file -new -f;
|
||||
if($toRelative)
|
||||
{
|
||||
//remember to set back the project:
|
||||
setProject $oldProj;
|
||||
workspace -dir $oldProj;
|
||||
workspace -update;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.inscenePicker.done"`) 0;
|
||||
}
|
||||
MGPicker -e -close "" 1 "";
|
||||
|
||||
}
|
||||
//now clean up:
|
||||
if($toRelative)
|
||||
{
|
||||
//clear all the project folder things:
|
||||
//they are all folders: assets, autosave, scenes
|
||||
sysFile -removeEmptyDir ($targetDirSlash+"assets");
|
||||
sysFile -removeEmptyDir ($targetDirSlash+"autosave");
|
||||
sysFile -removeEmptyDir ($targetDirSlash+"scenes/edits");
|
||||
//remember to set back the project:
|
||||
setProject $oldProj;
|
||||
}
|
||||
|
||||
//move out from scene dir:
|
||||
string $targetFile = ($targetDirSlash+`basename $scFile ""`);
|
||||
sysFile -cp $targetFile $scFile;
|
||||
sysFile -del $scFile;
|
||||
sysFile -removeEmptyDir ($targetDirSlash+"scenes");
|
||||
file -new -f;
|
||||
return 1;
|
||||
}
|
||||
global proc int MGP_PulishCurrentMayaScene(string $targetDir,
|
||||
int $publishTextures,
|
||||
int $publishImagePlane,
|
||||
int $makeImageRelative,
|
||||
int $publishInScenePickers)
|
||||
{
|
||||
if(!`mgp_testCurrentSceneSaveState`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(!`mgp_testTargetDir $targetDir`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//Save the scene to the target dir first:
|
||||
string $sn = `file -q -sn -shortName`;
|
||||
$targetDir = `mgp_ensurePathEndsWithSlash $targetDir`;
|
||||
string $scDir = ($targetDir+"scenes");
|
||||
if(!`filetest -d $scDir`)
|
||||
{
|
||||
sysFile -md $scDir;
|
||||
}
|
||||
file -rename ($scDir+"/"+$sn);
|
||||
file -save;
|
||||
//copy the textures and make them relative if desired:
|
||||
if($publishTextures || $publishImagePlane)
|
||||
{
|
||||
if(!`mgp_copyAllImagesToDir $targetDir $publishTextures $publishImagePlane $makeImageRelative $publishInScenePickers`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
global proc string[] MGP_listAllSubFolderFilesRecursively(int $listMode , string $cFolder, int $folderFirstOrLast)
|
||||
//$listMode 0: list only folder
|
||||
//$listMode 1: list only file
|
||||
//$listMode 2: list both, in this mode, folder will be listed ahead of files with one parentFolder.
|
||||
//if $cFolder is actually a file, on array with a single record: the file will be returned.
|
||||
//$folderFirstOrLast: 0: will list folder ahead of its contained files. Useful when copy folder tree, which should create folder first.
|
||||
//$folderFirstOrLast: 1: will list files ahead of its contained folder. Useful when delete folder tree, which should delete files first.
|
||||
{
|
||||
string $result[];
|
||||
if(!size($cFolder))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
//if it is a folder:
|
||||
if(`filetest -d $cFolder`)
|
||||
{
|
||||
if(!`endsWith $cFolder "/"`)
|
||||
{
|
||||
$cFolder += "/";
|
||||
}
|
||||
if($listMode != 1 && !$folderFirstOrLast)
|
||||
{
|
||||
$result[size($result)] = $cFolder;
|
||||
}
|
||||
}
|
||||
else if(`filetest -f $cFolder`) //if it is actually a file, we return one single record: the file
|
||||
{
|
||||
if($listMode)
|
||||
{
|
||||
$result[size($result)] = $cFolder;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
else //if it is not a file nor a folder, we return;
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
string $items[] = `getFileList -fld $cFolder`;
|
||||
if(!size($items)) //if it is empty folder and we need to list foler and the folder is listed last, we append the foler:
|
||||
{
|
||||
if($listMode != 1 && $folderFirstOrLast)
|
||||
{
|
||||
$result[size($result)] = $cFolder;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
string $cPath;
|
||||
string $cSubFiles[];
|
||||
if(!$folderFirstOrLast) //if list folder first, we list the folder first:
|
||||
{
|
||||
if($listMode != 1)
|
||||
{
|
||||
for($item in $items)
|
||||
{
|
||||
if($item == "." || $item == "..")
|
||||
continue;
|
||||
|
||||
$cPath = $cFolder+$item;
|
||||
//if it is a directory, we recursively call this proc. The path will be record in the head of this proc.
|
||||
if(`filetest -d $cPath`)
|
||||
{
|
||||
$cPath +="/";
|
||||
$result = stringArrayCatenate ($result ,`MGP_listAllSubFolderFilesRecursively $listMode $cPath $folderFirstOrLast`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($listMode)
|
||||
{
|
||||
for($item in $items)
|
||||
{
|
||||
$cPath = $cFolder+$item;
|
||||
if(!`filetest -d $cPath`) //if it is a file and we are in listMode that list the files, we record it in $cSubFiles. So that we could add the files to the tail.
|
||||
{
|
||||
$cSubFiles[size($cSubFiles)] = $cPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($listMode) //we add files first with one folder.
|
||||
{
|
||||
for($item in $items)
|
||||
{
|
||||
$cPath = $cFolder+$item;
|
||||
if(!`filetest -d $cPath`) //if it is a file and we are in listMode that list the files, we record it in $cSubFiles. So that we could add the files to the tail.
|
||||
{
|
||||
$cSubFiles[size($cSubFiles)] = $cPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($listMode != 1)
|
||||
{
|
||||
for($item in $items)
|
||||
{
|
||||
$cPath = $cFolder+$item;
|
||||
//if it is a directory, we recursively call this proc. The path will be record in the head of this proc.
|
||||
if(`filetest -d $cPath`)
|
||||
{
|
||||
$cPath +="/";
|
||||
$result = stringArrayCatenate ($result ,`MGP_listAllSubFolderFilesRecursively $listMode $cPath $folderFirstOrLast`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add files last if we are in listMode that list the files:
|
||||
if($listMode)
|
||||
{
|
||||
$result = stringArrayCatenate ($result , $cSubFiles);
|
||||
}
|
||||
if($listMode != 1 && $folderFirstOrLast)
|
||||
{
|
||||
$result[size($result)] = $cFolder;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
global proc int MGP_CopyFolder_Ex(string $targetFolder,string $sourceFolder,string $progressBarControl,string $textControl, int $returnAtFirstError, int $autoHideProgressBarWhenIsDone)
|
||||
//only copy folder, file as a $sourceFolder parameter will be skipped.
|
||||
//$progressBarControl: a progressBar Control
|
||||
//$textControl: a text Control
|
||||
//this proc will always override the exist folder/file.
|
||||
//$returnAtFirstError 1: will return at first error.
|
||||
{
|
||||
$targetFolder = `fromNativePath $targetFolder`;
|
||||
$sourceFolder = `fromNativePath $sourceFolder`;
|
||||
if(!`filetest -d $sourceFolder`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(!`filetest -d $targetFolder`)
|
||||
{
|
||||
//if fail in the first step. we return quickly.
|
||||
if(!`sysFile -md $targetFolder`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(!`endsWith $targetFolder "/"`)
|
||||
{
|
||||
$targetFolder+="/";
|
||||
}
|
||||
if(!`endsWith $sourceFolder "/"`)
|
||||
{
|
||||
$sourceFolder+="/";
|
||||
}
|
||||
int $sourceFolderSize = size($sourceFolder);
|
||||
|
||||
int $updateStatusBar = `control -q -ex $progressBarControl`;
|
||||
int $updateStatusText =`control -q -ex $textControl`;
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -vis 1 -progress 0 $progressBarControl;
|
||||
}
|
||||
|
||||
//list all sub folders and files, will list folders first, then the files.
|
||||
string $subItems [] = `MGP_listAllSubFolderFilesRecursively 2 $sourceFolder 0`;
|
||||
int $totalNum = size($subItems);
|
||||
int $actualTotalNum =$totalNum-1;
|
||||
if(!$totalNum)
|
||||
{
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -progress 100 $progressBarControl;
|
||||
if($autoHideProgressBarWhenIsDone)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int $cPercentage = 0;
|
||||
int $cResult;
|
||||
string $cTarget;
|
||||
string $cSource;
|
||||
string $cSubfix;
|
||||
if($totalNum > 1)
|
||||
{
|
||||
string $errorLbl = `MGP_MultiLanguage "pkr.error"`;
|
||||
for($i=1; $i<$totalNum; $i++) //we skip the first one because we have make $targetFolder;
|
||||
{
|
||||
$cSource = $subItems[$i];
|
||||
$cSubfix = `substring $cSource ($sourceFolderSize+1) (size($cSource))`;
|
||||
$cTarget = $targetFolder+$cSubfix;
|
||||
//if it is a folder:
|
||||
if(`endsWith $cTarget "/"`)
|
||||
{
|
||||
$cResult = `sysFile -md $cTarget`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cResult = `sysFile -cp $cTarget $cSource`;
|
||||
}
|
||||
if($updateStatusBar)
|
||||
{
|
||||
$cPercentage =( $i/float($actualTotalNum))*100;
|
||||
progressBar -e -progress $cPercentage $progressBarControl;
|
||||
}
|
||||
|
||||
if($cResult)
|
||||
{
|
||||
//print ($cSubfix+"\n");
|
||||
if($updateStatusText)
|
||||
{
|
||||
text -e -l $cSubfix $textControl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($updateStatusText)
|
||||
{
|
||||
text -e -l ("!!! "+$errorLbl+" @ "+$cSubfix) $textControl;
|
||||
}
|
||||
if($returnAtFirstError)
|
||||
{
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -progress 100 $progressBarControl;
|
||||
if($autoHideProgressBarWhenIsDone)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($autoHideProgressBarWhenIsDone && $updateStatusBar)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
global proc int MGP_CopyFolder(string $targetFolder,string $sourceFolder,int $returnAtFirstError)
|
||||
//only copy folder, file as a $sourceFolder parameter will be skipped.
|
||||
//this proc will always override the exist folder/file.
|
||||
//$returnAtFirstError 1: will return at first error.
|
||||
{
|
||||
$targetFolder = `fromNativePath $targetFolder`;
|
||||
$sourceFolder = `fromNativePath $sourceFolder`;
|
||||
if(!`filetest -d $sourceFolder`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(!`filetest -d $targetFolder`)
|
||||
{
|
||||
//if fail in the first step. we return quickly.
|
||||
if(!`sysFile -md $targetFolder`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(!`endsWith $targetFolder "/"`)
|
||||
{
|
||||
$targetFolder+="/";
|
||||
}
|
||||
if(!`endsWith $sourceFolder "/"`)
|
||||
{
|
||||
$sourceFolder+="/";
|
||||
}
|
||||
int $sourceFolderSize = size($sourceFolder);
|
||||
|
||||
|
||||
//list all sub folders and files, will list folders first, then the files.
|
||||
string $subItems [] = `MGP_listAllSubFolderFilesRecursively 2 $sourceFolder 0`;
|
||||
int $totalNum = size($subItems);
|
||||
int $actualTotalNum =$totalNum-1;
|
||||
if(!$totalNum)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int $cPercentage = 0;
|
||||
int $cResult;
|
||||
string $cTarget;
|
||||
string $cSource;
|
||||
string $cSubfix;
|
||||
if($totalNum > 1)
|
||||
{
|
||||
string $errorLbl = `MGP_MultiLanguage "pkr.error"`;
|
||||
for($i=1; $i<$totalNum; $i++) //we skip the first one because we have make $targetFolder;
|
||||
{
|
||||
$cSource = $subItems[$i];
|
||||
$cSubfix = `substring $cSource ($sourceFolderSize+1) (size($cSource))`;
|
||||
$cTarget = $targetFolder+$cSubfix;
|
||||
//if it is a folder:
|
||||
if(`endsWith $cTarget "/"`)
|
||||
{
|
||||
$cResult = `sysFile -md $cTarget`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cResult = `sysFile -cp $cTarget $cSource`;
|
||||
}
|
||||
if(!$cResult)
|
||||
{
|
||||
if($returnAtFirstError)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
global proc int MGP_DeleteFolder_Ex(string $deleteFolder,string $progressBarControl,string $textControl,int $returnAtFirstError, int $autoHideProgressBarWhenIsDone)
|
||||
//only delete folder, file as a $sourceFolder parameter will be skipped.
|
||||
//$progressBarControl: a progressBar Control
|
||||
//$textControl: a text Control
|
||||
//$returnAtFirstError 1: will return at first error.
|
||||
{
|
||||
$deleteFolder = `fromNativePath $deleteFolder`;
|
||||
if(!`filetest -d $deleteFolder`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(!`endsWith $deleteFolder "/"`)
|
||||
{
|
||||
$deleteFolder+="/";
|
||||
}
|
||||
|
||||
int $updateStatusBar = `control -q -ex $progressBarControl`;
|
||||
int $updateStatusText =`control -q -ex $textControl`;
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -vis 1 -progress 0 $progressBarControl;
|
||||
}
|
||||
|
||||
//list all sub files and folders, will list files first, then the folers.
|
||||
string $subItems [] = `MGP_listAllSubFolderFilesRecursively 2 $deleteFolder 1`;
|
||||
//print $subItems;
|
||||
int $totalNum = size($subItems);
|
||||
int $actualTotalNum =$totalNum-1;
|
||||
int $cResult;
|
||||
string $errorLbl = `MGP_MultiLanguage "pkr.error"`;
|
||||
if(!$totalNum) //if nothing to delete.
|
||||
{
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -progress 100 $progressBarControl;
|
||||
if($autoHideProgressBarWhenIsDone)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else if($totalNum == 1) //the folder is empty
|
||||
{
|
||||
if(`endsWith $subItems[0] "/"`)
|
||||
{
|
||||
$cResult = `sysFile -removeEmptyDir $subItems[0]`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cResult = `sysFile -delete $subItems[0]`;
|
||||
}
|
||||
if($cResult)
|
||||
{
|
||||
if($updateStatusText)
|
||||
{
|
||||
text -e -l $subItems[0] $textControl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($updateStatusText)
|
||||
{
|
||||
text -e -l ("!!! "+$errorLbl+" @ "+$subItems[0]) $textControl;
|
||||
}
|
||||
}
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -progress 100 $progressBarControl;
|
||||
if($autoHideProgressBarWhenIsDone)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
}
|
||||
return $cResult;
|
||||
}
|
||||
|
||||
int $cPercentage = 0;
|
||||
string $cItem;
|
||||
for($i=0; $i<$totalNum; $i++)
|
||||
{
|
||||
$cItem = $subItems[$i];
|
||||
//if it is a folder:
|
||||
if(`endsWith $cItem "/"`)
|
||||
{
|
||||
$cResult = `sysFile -removeEmptyDir $cItem`;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cResult = `sysFile -delete $cItem`;
|
||||
}
|
||||
if($updateStatusBar)
|
||||
{
|
||||
$cPercentage =( ($i+1)/float($actualTotalNum))*100;
|
||||
progressBar -e -progress $cPercentage $progressBarControl;
|
||||
}
|
||||
if($cResult)
|
||||
{
|
||||
//print ($cItem+"\n");
|
||||
if($updateStatusText)
|
||||
{
|
||||
text -e -l $cItem $textControl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($updateStatusText)
|
||||
{
|
||||
text -e -l ("!!! "+$errorLbl+" @ "+$cItem) $textControl;
|
||||
}
|
||||
if($returnAtFirstError)
|
||||
{
|
||||
if($updateStatusBar)
|
||||
{
|
||||
progressBar -e -progress 100 $progressBarControl;
|
||||
if($autoHideProgressBarWhenIsDone)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($autoHideProgressBarWhenIsDone && $updateStatusBar)
|
||||
{
|
||||
progressBar -e -vis 0 -progress 0 $progressBarControl;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
proc string mgp_getProgramPublishTargetRootPath(string $targetDir)
|
||||
{
|
||||
if(!size($targetDir))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
global string $MGPicker_FolderName;
|
||||
$targetDir = `mgp_ensurePathEndsWithSlash $targetDir`;
|
||||
$targetDir += ($MGPicker_FolderName + "/");
|
||||
return $targetDir;
|
||||
}
|
||||
|
||||
global proc int MGP_PulishPickerPrograms(string $targetDir,
|
||||
int $publishAutosourced)
|
||||
{
|
||||
if(!`mgp_testTargetDir $targetDir`)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
$targetDir = (`mgp_ensurePathEndsWithSlash $targetDir`);
|
||||
|
||||
global string $MGPicker_AppName;
|
||||
global string $MGPicker_ProgramPath;
|
||||
if(!`filetest -d $MGPicker_ProgramPath`)
|
||||
{
|
||||
MGP_ScriptEditorFeedback `MGP_MultiLanguage_rep1 "pkr.publish.cantFindProgram" $MGPicker_AppName` 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//publish picker program code.
|
||||
global string $MGPicker_FolderName;
|
||||
string $targetRoot = `mgp_getProgramPublishTargetRootPath $targetDir`;
|
||||
string $targetFolder = $targetRoot + $MGPicker_FolderName;
|
||||
if(!`filetest -d $targetFolder`)
|
||||
{
|
||||
if(!`sysFile -md $targetFolder`)
|
||||
{
|
||||
MGP_ScriptEditorFeedback (`MGP_MultiLanguage "pkr.publish.canBuildDir"`+" "+$targetFolder+".") 2;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$targetFolder += "/";
|
||||
string $sourceDir = `mgp_ensurePathEndsWithSlash $MGPicker_ProgramPath`;
|
||||
|
||||
//now copy the installation resource first:
|
||||
string $installMel_source = $MGPicker_ProgramPath + "MGPicker_Program/Installer/MGPicker_installer.mel";
|
||||
string $installMel_target = $targetRoot + "MGPicker_installer.mel";
|
||||
sysFile -cp $installMel_target $installMel_source;
|
||||
|
||||
string $installMel_ReadMeSource1 = $MGPicker_ProgramPath + "MGPicker_Program/Installer/HowToInstall_English.txt";
|
||||
string $installMel_ReadMeTarget1 = $targetRoot + "HowToInstall_English.txt";
|
||||
sysFile -cp $installMel_ReadMeTarget1 $installMel_ReadMeSource1;
|
||||
|
||||
string $installMel_ReadMeSource2 = $MGPicker_ProgramPath + "MGPicker_Program/Installer/HowToInstall_SimplifiedChinese.txt";
|
||||
string $installMel_ReadMeTarget2 = $targetRoot + "HowToInstall_SimplifiedChinese.txt";
|
||||
sysFile -cp $installMel_ReadMeTarget2 $installMel_ReadMeSource2;
|
||||
|
||||
string $installMel_ReadMeSource3 = $MGPicker_ProgramPath + "MGPicker_Program/Installer/HowToInstall_TraditionalChinese.txt";
|
||||
string $installMel_ReadMeTarget3 = $targetRoot + "HowToInstall_TraditionalChinese.txt";
|
||||
sysFile -cp $installMel_ReadMeTarget3 $installMel_ReadMeSource3;
|
||||
|
||||
$targetFolder = `mgp_ensurePathEndsWithSlash $targetFolder`;
|
||||
//now copy other folders:
|
||||
string $fileFolders[]=`getFileList -fld $sourceDir`;
|
||||
for($f in $fileFolders)
|
||||
{
|
||||
if($f == "." || $f == "..")
|
||||
continue;
|
||||
|
||||
string $cf = ($sourceDir + $f);
|
||||
string $tf = ($targetFolder + $f);
|
||||
if(`filetest -f $cf`)
|
||||
{
|
||||
sysFile -cp $tf $cf;
|
||||
}
|
||||
else if(`filetest -d $cf`)
|
||||
{
|
||||
if($f == "MGPicker_UserConfig")
|
||||
{
|
||||
if($publishAutosourced)
|
||||
{
|
||||
string $sourceAutoSourceFld=$cf + "/AutoSourced";
|
||||
string $targetAutoSourceFld=$tf + "/AutoSourced";
|
||||
MGP_CopyFolder $targetAutoSourceFld $sourceAutoSourceFld 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MGP_CopyFolder $tf $cf 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
//Switch the camera of current actived 3d view to persp camera.
|
||||
MGP_SetActiveViewCamera "persp"; //change the camera string to switch to that camera.
|
||||
@@ -0,0 +1,4 @@
|
||||
//get attribute float array value. Only works when you query attributes like .translate, .rotate, .scale, etc.
|
||||
//Input the objectName.attribute without its namespace, the namespace will be replaced by the namespace of picker:
|
||||
//Error will occur if there is no such object or attribute.
|
||||
float $theAttVs[] = `MGP_GetAttributeFloatValueArray_ViaPickerNamespace "objNameWithoutNamespace.attr"`;
|
||||
@@ -0,0 +1,4 @@
|
||||
//get a attribute float value.
|
||||
//Input the objectName.attribute without its namespace, the namespace will be replaced by the namespace of picker:
|
||||
//Error will occur if there is no such object or attribute.
|
||||
float $theAttV = `MGP_GetAttributeFloatValue_ViaPickerNamespace "objNameWithoutNamespace.attr"`;
|
||||
@@ -0,0 +1,5 @@
|
||||
//Get currently attribute button's maya attribute:
|
||||
//if the attribute is not linked to a maya attribute, this will return empty string.
|
||||
//the return attribute string is of format: [ns:]nodeName.attributeName.
|
||||
//0 for no namespace, 1 for has namespace.
|
||||
string $objDotAttr = `MGP_GetCurrentAttributeButton_Attribute 0`;
|
||||
@@ -0,0 +1 @@
|
||||
string $currentPickerDir = `MGP_GetCurrentPickerDirectory`; //get the dierctory path of current picker file.
|
||||
@@ -0,0 +1 @@
|
||||
string $currentPickerFileOrNode = `MGP_GetCurrentPickerFileOrNode`; //get the full path of current picker file or the picker node name.
|
||||
@@ -0,0 +1,4 @@
|
||||
//get current mouse interactiving picker item name:
|
||||
//When you want to change the item itself within its script type property, such as color or position, use this to query its id.
|
||||
string $currentPickerItem = `MGP_GetCurrentInteractiveItem`;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
string $currentPickerNamespace = `MGP_GetCurrentPickerNamespace`; //get the namespace of current picker file/node.
|
||||
@@ -0,0 +1 @@
|
||||
MGP_CancelIsolation; //Cancel the isolation for currently activated model view.
|
||||
@@ -0,0 +1 @@
|
||||
MGP_IsolateSelectedObjects; //Isolat selected objects for currently activated model view.
|
||||
@@ -0,0 +1 @@
|
||||
MGP_IsolateSelectedRig; //Isolate selected objects' whole rigs for currently activated model view.
|
||||
@@ -0,0 +1 @@
|
||||
float $fillColor[] = `MGPickerItem -q -fillColor ""`; //To-Do: input the button id string to get the fill color of it.
|
||||
@@ -0,0 +1 @@
|
||||
string $label = `MGPickerItem -q -label ""`; //To-Do: input the button id string to get the label of it.
|
||||
@@ -0,0 +1 @@
|
||||
float $labelColor[] = `MGPickerItem -q -labelColor ""`; //To-Do: input the button id string to get the label color of it.
|
||||
@@ -0,0 +1 @@
|
||||
float $opacity = `MGPickerItem -q -opacity ""`; //To-Do: input the button id string to get the opacity of it.
|
||||
@@ -0,0 +1,3 @@
|
||||
//To-Do: input the button id string to get the 2D position of it:
|
||||
int $x = `MGPickerItem -q -x ""`;
|
||||
int $y = `MGPickerItem -q -y ""`;
|
||||
@@ -0,0 +1,3 @@
|
||||
//To-Do: input the button id string to get the size of it:
|
||||
int $width = `MGPickerItem -q -width ""`;
|
||||
int $height = `MGPickerItem -q -height ""`;
|
||||
@@ -0,0 +1 @@
|
||||
float $valueColor[] = `MGPickerItem -q -valueColor ""`; //To-Do: input the button id string to get the value color of it.
|
||||
@@ -0,0 +1 @@
|
||||
int $visible = `MGPickerItem -q -visible ""`; //To-Do: input the button id string to get the visibility of it.
|
||||
@@ -0,0 +1,15 @@
|
||||
//To-Do: hardcode this button id. The id won't not changed once it is created.
|
||||
string $pickerButtonID = "";
|
||||
//below the full edit flags are listed, feel free to remove unwanted lines.
|
||||
MGPickerItem -e //with/without -e is the same;
|
||||
-visible 1 //set the visibility of the button;
|
||||
-label "" //set the label of the button,repace the string with your desired label string;
|
||||
-x 0 //set the x position of your button;
|
||||
-y 0 //set the y position of your button;
|
||||
-w 20 //set the width of your button;
|
||||
-h 20 //set the height of your button;
|
||||
-fillColor 1 0 0 1 //set the fill color of your button;
|
||||
-labelColor 0 0 0 1 //set the label color of your button;
|
||||
-valueColor 1 1 1 1 //set the value color of your button. only make sense when it is a attribute button;
|
||||
-opacity 1 //set the opacity of your button, you could also set this through the last parameter of "-fillColor" flag;
|
||||
$pickerButtonID;
|
||||
@@ -0,0 +1 @@
|
||||
MG_SetKeyframeNonDefaultChannels; //Set keyframs at current frame, only on those channels are of non-default values.
|
||||
@@ -0,0 +1,3 @@
|
||||
//Popup a prompt dialog, which user could input a frame count to keyframe object at this each frame count.
|
||||
//arg: 0 for each keytick, 1 for each certain frames.
|
||||
MGP_SetKeyframeEachKeyOrGap 1;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Set keyframe each keytick via time range control.The ensure each selected object all have keys at same frames:
|
||||
//arg: 0 for each keytick, 1 for each certain frames.
|
||||
MGP_SetKeyframeEachKeyOrGap 0;
|
||||
@@ -0,0 +1 @@
|
||||
MGP_SetKeyframeForOnlyKeyframed; //Set keyframe only if the attribute is already keyframed.
|
||||
@@ -0,0 +1,3 @@
|
||||
//Reactivate the model view, so animators could have access to the hotkeys features of Maya, such as set keys,etc.
|
||||
//but ususually you don't need to do so, cos MG-Picker in animator interactive mode does so automatically after each mouse left mouse button clicking.
|
||||
MGP_ReactiveModelViewport;
|
||||
@@ -0,0 +1 @@
|
||||
MGP_MirrorSelection 1; //Add Mirrored objects into selection via current picker panel's mirror relationship.
|
||||
@@ -0,0 +1,3 @@
|
||||
//Add all selectButton & Slider members of current picker panel to scene selection.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPanelAllSelectButtons 1;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Add all selectButton & Slider members of current picker to scene selection:
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPickerAllSelectButtons 1;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Deselect all selectButton & Slider members of current picker panel from scene selection.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPanelAllSelectButtons 2;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Deselect all selectButton & Slider members of current picker from scene selection.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPickerAllSelectButtons 2;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Toggle all selectButton & Slider members selection states of current picker panel.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPanelAllSelectButtons 3;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Toggle all selectButton & Slider members selection states of current picker.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPickerAllSelectButtons 3;
|
||||
@@ -0,0 +1 @@
|
||||
MGP_MirrorSelection 0; //Mirror selection via current picker panel's mirror relationship.
|
||||
@@ -0,0 +1,3 @@
|
||||
//Select all selectButton & Slider members of current picker panel.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPanelAllSelectButtons 0;
|
||||
@@ -0,0 +1,4 @@
|
||||
//Select all selectButton & Slider members of the picker panel with the panel index.
|
||||
//The first int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
//the second int arg stands for the target picker panel index.
|
||||
MGP_EvalPanelAllSelectButtons_viaPanelIndex 0 0;
|
||||
@@ -0,0 +1,3 @@
|
||||
//Select all selectButton & Slider members of current picker.
|
||||
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
MGP_EvalPickerAllSelectButtons 0;
|
||||
@@ -0,0 +1,3 @@
|
||||
//set a attribute with a value. Input the objectName.attribute without its namespace, the namespace will be replaced by the namespace of picker:
|
||||
//Error will occur if there is no such object or attribute.
|
||||
MGP_SetAttributeViaPickerNamespace "objNameWithoutNamespace.attr" 0;
|
||||
@@ -0,0 +1 @@
|
||||
MGP_SetCurrentPickerNamespace ""; //To-Do: replace the "" with your namespace to set current picker namespace.
|
||||
@@ -0,0 +1,2 @@
|
||||
//pop up set namespace ui:
|
||||
MGP_SetCurrentPickerNamespace_WithUI;
|
||||
@@ -0,0 +1 @@
|
||||
MGP_GoToPanel 0; //To-Do: replace the int with the target panel index, 0 is usually the first panel.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Switch the camera of current actived 3d view to persp camera.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval('MGP_SetActiveViewCamera "persp"')
|
||||
# To-Do: replace the string with the camera name you wanna switch to.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Get currently interactive attribute button's maya attribute:
|
||||
# if the attribute is not linked to a maya attribute, this will return empty string.
|
||||
# the return attribute string is of format: nodeName.attributeName.
|
||||
# argument: 0 for no namespace, 1 for has namespace.
|
||||
import maya.mel as mel
|
||||
|
||||
attribute = mel.eval("MGP_GetCurrentAttributeButton_Attribute 0")
|
||||
@@ -0,0 +1,4 @@
|
||||
# get the dierctory path of current picker file.
|
||||
import maya.mel as mel
|
||||
|
||||
pickerDir = mel.eval("MGP_GetCurrentPickerDirectory")
|
||||
@@ -0,0 +1,4 @@
|
||||
# get the full path of current picker file/node.
|
||||
import maya.mel as mel
|
||||
|
||||
pickerFileOrNode = mel.eval("MGP_GetCurrentPickerFileOrNode")
|
||||
@@ -0,0 +1,4 @@
|
||||
# get the namespace of current picker file.
|
||||
import maya.mel as mel
|
||||
|
||||
currentPickerNamespace = mel.eval("MGP_GetCurrentPickerNamespace")
|
||||
@@ -0,0 +1,4 @@
|
||||
# Cancel the isolation for currently activated model view.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_CancelIsolation")
|
||||
@@ -0,0 +1,4 @@
|
||||
# Isolate selected objects for currently activated model view.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_IsolateSelectedObjects")
|
||||
@@ -0,0 +1,4 @@
|
||||
# Isolate selected objects' whole rigs for currently activated model view.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_IsolateSelectedRig")
|
||||
@@ -0,0 +1,4 @@
|
||||
# Set keyframs at current frame, only on those channels are of non-default values.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MG_SetKeyframeNonDefaultChannels")
|
||||
@@ -0,0 +1,6 @@
|
||||
# Popup a prompt dialog, which user could input a frame count to keyframe object at this each frame count.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval(
|
||||
"MGP_SetKeyframeEachKeyOrGap 1"
|
||||
) # arg: 0 for each keytick, 1 for each certain frames.
|
||||
@@ -0,0 +1,6 @@
|
||||
# Set keyframe each keytick via time range control.The ensure each selected object all have keys at same frames.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval(
|
||||
"MGP_SetKeyframeEachKeyOrGap 0"
|
||||
) # arg: 0 for each keytick, 1 for each certain frames.
|
||||
@@ -0,0 +1,4 @@
|
||||
# Set keyframe only if the attribute is already keyframed.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_SetKeyframeForOnlyKeyframed")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Reactivate the model view, so animators could have access to the hotkeys features of Maya, such as set keys,etc.
|
||||
# but ususually you don't need to do so, cos MG-Picker in animator interactive mode does so automatically after each mouse left mouse button clicking.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_ReactiveModelViewport")
|
||||
@@ -0,0 +1,6 @@
|
||||
# Add Mirrored objects into selection via current picker's mirror relationship.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval(
|
||||
"MGP_MirrorSelection 1"
|
||||
) # arg: 0 for replace selection, 1 for add to selection.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Add all selectButton & slider members of current picker panel to scene selection.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPanelAllSelectButtons 1")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Add all selectButton & slider members of current picker to scene selection:
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPickerAllSelectButtons 1")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Deselect all selectButton & slider members of current picker panel from scene selection.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPanelAllSelectButtons 2")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Deselect all selectButton & slider members of current picker from scene selection.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPickerAllSelectButtons 2")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Toggle all selectButton & slider members selection states of current picker panel.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPanelAllSelectButtons 3")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Toggle all selectButton & slider members selection states of current picker.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPickerAllSelectButtons 3")
|
||||
@@ -0,0 +1,4 @@
|
||||
# Mirror selection & slider via current picker's mirror relationship.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_MirrorSelection 0") # arg: 0 for replace selection,1 for add selection.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Select all selectButton & slider members of current picker panel.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPanelAllSelectButtons 0")
|
||||
@@ -0,0 +1,6 @@
|
||||
# Select all selectButton & slider members of the picker panel with the panel index.
|
||||
# The first int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
# The second int arg stands for the panel index.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPanelAllSelectButtons_viaPanelIndex 0 0")
|
||||
@@ -0,0 +1,5 @@
|
||||
# Select all selectButton & slider members of current picker.
|
||||
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_EvalPickerAllSelectButtons 0")
|
||||
@@ -0,0 +1,6 @@
|
||||
import maya.mel as mel
|
||||
|
||||
newNamespace = "" # To-Do: replace the "newNamespace" variable with your value.
|
||||
mel.eval(
|
||||
'MGP_SetCurrentPickerNamespace "' + newNamespace + '"'
|
||||
) # set current picker namespace.
|
||||
@@ -0,0 +1,4 @@
|
||||
# pop up set namespace ui:
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_SetCurrentPickerNamespace_WithUI")
|
||||
@@ -0,0 +1,4 @@
|
||||
# To-Do: replace the int with the target panel index, 0 is usually the first panel.
|
||||
import maya.mel as mel
|
||||
|
||||
mel.eval("MGP_GoToPanel 0")
|
||||
@@ -0,0 +1,2 @@
|
||||
//Switch the camera of current actived 3d view to persp camera.
|
||||
MGP_SetActiveViewCamera "persp";
|
||||
@@ -0,0 +1 @@
|
||||
Switch the camera of current actived 3d view to persp camera.
|
||||
@@ -0,0 +1,2 @@
|
||||
//Cancel the isolation for currently model view.
|
||||
MGP_CancelIsolation;
|
||||
@@ -0,0 +1 @@
|
||||
Cancel the isolation for currently model view.
|
||||
@@ -0,0 +1,2 @@
|
||||
//Isolat selected objects for currently model view.
|
||||
MGP_IsolateSelectedObjects;
|
||||
@@ -0,0 +1 @@
|
||||
Isolat selected objects for currently model view.
|
||||
@@ -0,0 +1,2 @@
|
||||
//Isolat selected objects' whole rigs for currently model view.
|
||||
MGP_IsolateSelectedRig;
|
||||
@@ -0,0 +1 @@
|
||||
Isolat selected objects' whole rigs for currently model view.
|
||||
@@ -0,0 +1,2 @@
|
||||
//Set keyframs at current frame, only on those channels are of non-default values.
|
||||
MG_SetKeyframeNonDefaultChannels;
|
||||
@@ -0,0 +1 @@
|
||||
Set keyframs at current frame, only on those channels are of non-default values<65><73>
|
||||
@@ -0,0 +1,2 @@
|
||||
//Keyframe all the Select-Button & Slider memebers from current panel.
|
||||
MGP_KeyframeCurrentPanel;
|
||||
@@ -0,0 +1 @@
|
||||
Keyframe all the Select-Button & Slider memebers from current panel<65><6C>
|
||||
@@ -0,0 +1,2 @@
|
||||
//Keyframe all the Select-Button & Slider memebers from current picker.
|
||||
MGP_KeyframeCurrentPicker;
|
||||
@@ -0,0 +1 @@
|
||||
Keyframe all the Select-Button & Slider memebers from current picker
|
||||
@@ -0,0 +1,2 @@
|
||||
//Popup dialog asking for frame count,and keyframe object at each frame count.
|
||||
MGP_SetKeyframeEachKeyOrGap 1; //Arg: 0 for each keytick, 1 for each certain frames.
|
||||
@@ -0,0 +1 @@
|
||||
Popup dialog asking for frame count,and keyframe object at each frame count
|
||||
@@ -0,0 +1,3 @@
|
||||
//Set keyframe each keytick within current visible time range.
|
||||
//This ensures each selected object all have keys at same frames:
|
||||
MGP_SetKeyframeEachKeyOrGap 0; //arg: 0 for each keytick, 1 for each certain frames.
|
||||
@@ -0,0 +1,2 @@
|
||||
Set keyframe each keytick within current visible time range.
|
||||
This ensures each selected object all have keys at same frames<65><73>
|
||||
@@ -0,0 +1,2 @@
|
||||
//Set keyframe on the attributes only if their are already keyframed.
|
||||
MGP_SetKeyframeForOnlyKeyframed;
|
||||
@@ -0,0 +1 @@
|
||||
Set keyframe on the attributes only if their are already keyframed.
|
||||
@@ -0,0 +1,2 @@
|
||||
//Pop up namespace editor to set current picker's namespace:
|
||||
MGP_SetCurrentPickerNamespace_WithUI;
|
||||
@@ -0,0 +1 @@
|
||||
Pop up namespace editor to set current picker's namespace<63><65>
|
||||
@@ -0,0 +1,2 @@
|
||||
//Get namespace form the first selected reference object and set as current picker's namespace.
|
||||
MGP_SetPickerNamespace_Via_Selection;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user