最近,我参加了梅尔编程,帮助玛雅的几个朋友。他们希望将他们的文件保存在服务器上,所以我需要更改reff字符串。现在我已经编译了一个解决方案来完成这个操作,并使用另一个示例作为指导,但是当我运行脚本时,它是// Error: int $nt=tokenize $TexturePath "\" $buff;/ Error:第12.43行:未终止的字符串。//什么情况?附注:下面是所有想要使用它的人的完整代码
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“的无效负索引。但我认为可能只有一个纹理错误的东西,将检查和报告。
发布于 2016-03-10 11:11:56
我不是MEL方面的专家,但是在许多语言中,\都是用来逃避控制序列的,所以我想你需要的是"\\"而不是"\",在它出现的很多地方。
https://stackoverflow.com/questions/35914653
复制相似问题