MEL 错误未终止的字符串,用于纹理更改其字符串的脚本
MEL error unterminated string, script for textures to change their strings
最近我开始学习 MEL 编程来帮助一些使用 Maya 的朋友。他们想在服务器上引用他们的文件,所以我需要更改引用字符串。现在我已经编译了一个解决方案来执行此操作,并使用另一个示例作为指南,但是当我 运行 脚本时它说
// 错误:int $nt=tokenize $TexturePath "\" $buff
;
//
// 错误:第 12.43 行:未终止的字符串。 //
是什么赋予了?
p.s。下面的完整代码供任何想使用它的人使用
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 专家,但在许多语言中 \
用于转义控制序列,所以我猜你想要 "\"
而不是 "\"
,在它出现的地方很多。
最近我开始学习 MEL 编程来帮助一些使用 Maya 的朋友。他们想在服务器上引用他们的文件,所以我需要更改引用字符串。现在我已经编译了一个解决方案来执行此操作,并使用另一个示例作为指南,但是当我 运行 脚本时它说
// 错误:int $nt=tokenize $TexturePath "\" $buff
;
//
// 错误:第 12.43 行:未终止的字符串。 //
是什么赋予了?
p.s。下面的完整代码供任何想使用它的人使用
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 专家,但在许多语言中 \
用于转义控制序列,所以我猜你想要 "\"
而不是 "\"
,在它出现的地方很多。