maya贴图路径找回脚本(3)

2019-01-10 13:14

switch (size($fileRegularName)) { case 0: // sick!!! break; case 1:// only file name presented $fileName = $fileRegularName[0]; break; case 2:// the second/last element could be sequence number, format extension or nothing; if (FTM_FCWhatIs($fileRegularName[1]) == 0) { $fileName = $fileRegularName[0]; $fileFormat = $fileRegularName[1]; } else if (FTM_FCWhatIs($fileRegularName[1]) == 1) { $fileName = $fileRegularName[0]; $seqNum = $fileRegularName[1]; } else // FTM_FCWhatIs($fileRegularName[1]) = 2, which means the second/last element is just part of file basename, sick!!! $fileName = basename($file,\ break; default: // there are 3 or more pieces. consider the last 2 only. string $lastPiece = $fileRegularName[size($fileRegularName)-1]; if (FTM_FCWhatIs($lastPiece) == 0) { $fileFormat = $lastPiece; $fileName = basenameEx($file); // strip the last piece to judge again $lastPiece = $fileRegularName[size($fileRegularName)-2]; if (FTM_FCWhatIs($lastPiece) == 1) { $seqNum = $lastPiece; $fileName = basenameEx($fileName); } } else if (FTM_FCWhatIs($lastPiece) == 1) { $seqNum = $lastPiece; $fileName = basenameEx($file); // strip the last piece to judge again $lastPiece = $fileRegularName[size($fileRegularName)-2]; if (FTM_FCWhatIs($lastPiece) == 0) {

$fileFormat = $lastPiece; $fileName = basenameEx($fileName); } } else if (FTM_FCWhatIs($lastPiece) == 3) //bot { $fileFormat = $fileRegularName[size($fileRegularName)-2] + \ if (size($fileRegularName) == 3) $fileName = $fileRegularName[0]; else { $lastPiece = $fileRegularName[size($fileRegularName)-3]; if (FTM_FCWhatIs($lastPiece) == 1) { $seqNum = $lastPiece; $fileName = basenameEx(basenameEx(basenameEx($file))); } else $fileName = basenameEx(basenameEx($file)); } } else // really sick!!! $fileName = basename($file,\ break; }

$fileRegularName[0] = $fileName; $fileRegularName[1] = $seqNum; $fileRegularName[2] = $fileFormat;

return $fileRegularName; }

///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// //

// check string $inputString,replace the first (count backwards) matching string $targetPattern with string $newPattern //

proc string FTM_FCSubstituteLastPattern(string $inputString, string $targetPattern, string $newPattern) {

$inputString = substituteAll(\

//strip everything behind the last string $targetPattern's existence string $exp1 = \string $noTail = match($exp1,$inputString);

//replace the last $targetPattern in $noTail with $newPattern string $exp2 = $targetPattern + \

string $newNoEnd = substitute($exp2,$noTail,$newPattern);

//replace $noTail part in $inputString with $newNoEnd // substitute all special characters

string $badChar[] = {\for ($char in $badChar) $noTail = `substituteAllString $noTail $char (\

string $exp3 = \string $outputString = substitute($exp3,$inputString,$newNoEnd);

$outputString = toNativePath($outputString); return $outputString; }

//////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////// //

// to analyse the number of digits for input filename //

proc int FTM_FCDigitsNumber(string $fileName) {

string $fileRegularName[] = FTM_FCFileRegularName($fileName);

$fileName = FTM_FCSubstituteLastPattern($fileName,$fileRegularName[1],\string $filesInSeq[] = `getFileList -fs $fileName`;

int $digiNum = 0;

for ($i=0;$i

return $digiNum; }

//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

//

// the file format converter //

proc FTM_FCGo(int $progressUI, string $sourceFormatUI, string $targetFormat, int $handleSeq, int $updatePath, int $removeOrig) //int $progressUI - need progress UI; 0 - No UI for progress, which is designed for command line uses.

//string $sourceFormatUI - format convert from //string $targetFormat - format convert to //int $handleSeq - handle sequence textures; 0 - do not handle sequence textures. //int $updatePath - update path info; 0 - do not update path info. //int $removeOrig - remove original textures; 0 - do not remove original textures. {

if (FTM_SelCheck(`ls -sl -typ file -typ mentalrayTexture`)) {// if (0) waitCursor -state on; FTM_Log \ // list for file nodes to be handled string $fileNodesList[] = FTM_FCGetMatches($sourceFormatUI); int $isSeq[];// if it is using an image sequence as texture int $isOneOfSeq[];// if it is using only one image of a whole sequence as texture. string $file;// current file to be converted string $fileFC;// current file in suitable naming for FC use string $fileUpdatePath;// current file in suitable naming for updatePath use string $fileRemove;// current file in proper naming for removing // build progress feedback only in UI mode if ($progressUI) { // base of progress feedback setup int $progress = 0; int $percentage = 0; progressWindow -t \Working...\-pr $progress -ii 1 -min 0 -max `size($fileNodesList)`; } // executes cooresponding commands for each file node specified. // the core process. for ($i=0;$i

if ( `progressWindow -q -ic` ){ FTM_Log \ break; } $progress = $i+1; $percentage = $progress * (100/size($fileNodesList)); progressWindow -e -pr $progress -st (\\+ $fileNodesList[$i] + \ ...... \ } $file = toNativePath(substituteAll(\($fileNodesList[$i] \ $fileFC = $file; $fileRemove = $file; string $fileRegularName[] = FTM_FCFileRegularName($file); string $isBOT = `match \ if (size($isBOT)) { FTM_Log \ continue; } string $targetFile FTM_FCSubstituteLastPattern($file,$fileRegularName[2],$targetFormat); // it is bad that a file has no extension to indicate its format, so add one if needed. if (!size($fileRegularName[2])) $targetFile += \ $fileUpdatePath = $targetFile; string $cmp1,$cmp2; $cmp1 = $fileUpdatePath; $cmp2 = $fileRemove; if (`about -nt`) { $cmp1 = toNativePath(tolower($cmp1)); $cmp2 = toNativePath(tolower($cmp2)); } // skip all process if the file node was already handled before. if($cmp1 == $cmp2) FTM_Log \ else{ //else (1) $isSeq[$i] = 0; $isOneOfSeq[$i] = 0; if (`nodeType $fileNodesList[$i]` == \ if (`getAttr ($fileNodesList[$i] + \ $isSeq[$i] = 1;

+ =


maya贴图路径找回脚本(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:标准化党支部资料目录

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: