Hey all, i have just finished a script that selects all of the preexisting textures in a scene and converts their strings into server paths, and only taking the last 3 attributes of the path into the new path.
A few friends of mine are migrating on a server and wanted for it to be fast and seamless.
However i bumped into a problem. It says an array of strings ($buff) is going into negative indexing, which should not happen
Here is the code in question;
string $SceneTextures[] = ls -tex;
string $plus="";//Type the subfolder for the server here
for ($i = 0; $i< (size $SceneTextures); $i++)
{
$Test = catchQuiet(getAttr ($SceneTextures[$i] + ".fileTextureName"));
if ($Test == 0)
{
string $TexturePath = getAttr ($SceneTextures[$i] + ".fileTextureName");
string $buff[];
$nt=tokenize $TexturePath "\\" $buff;
string $NewPath;
$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
The error itself
// Error: line 14: Invalid negative index used to reference array “$buff”. //
Any help would be appreciated. Also i will add the code the sticky once i finalize it.