最近,我开始进行MEL编程,以帮助Maya中的一些朋友。他们想在服务器上引用他们的文件,所以我需要更改reff字符串。现在,我已经编译了一个解决方案来执行此操作,并使用了另一个示例作为指导,但是当我运行脚本时,它显示了//错误:int $ nt = tokenize $TexturePath "\" $buff
; // //错误:第12.43行:未终止的字符串。// 是什么赋予了?ps下面的完整代码供任何想使用它的人使用
string $SceneTextures[] = `ls -tex`;
string $plus="";//Place a file type here to be saved in that subfolder
for ($i = 0; $i< (`size $SceneTextures`); $i++)
{
$Test = catchQuiet(`getAttr ($SceneTextures[$i] + ".fileTextureName")`);
if ($Test == 0)
{
string $TexturePath = `getAttr ($SceneTextures[$i] + ".fileTextureName")`;
string $buff[];
int $nt=`tokenize $TexturePath "\\" $buff`;
string $newPath=("${ARC_SURF}\\" + plus + "\\" + $buff[$nt-3] + "\\" + $buff[$nt-2] + "\\" + $buff[$nt-1]);
setAttr -type "string" ($SceneTextures[$i] + ".fileTextureName") $NewPath;
catchQuiet (AEfileTextureReloadCmd ($SceneTextures[$i] + ".fileTextureName"));
//print $TexturePath;
}//end if
}//end for i
编辑:修正了代码应有的位置,现在只抛出//错误:第14行:用于引用数组“ $ buff”的无效负索引。但我认为可能只有1个纹理螺钉塞满了,将进行检查并报告
我不是MEL的专家,但是许多语言\
都使用了Escape来逃避控制序列,所以我想您会在出现的许多地方都想要"\\"
而不是"\"
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句