swardson
01-01-2005, 11:48 PM
Hey all,
I found this fun little script for saving a list of fileTextures to a text doc. it works great but I wanted to add a UI for inputing the filename and write path. I am having trouble passing the value of the textFieldGrp (the text in the field) to the procedure for listing the file textures. Could you all take a look at this and hopefully see some stupid mistake I am making. Thanks all
Brad
global proc printTextures()
{
window
-title "Print List of File Textures to File"
writeWindow;
columnLayout;
string $fileName = `textFieldGrp -label "/filePath/fileName" -text "/Users/Brad/Desktop/"`;
button -label "Write File" -command "listFileTextures($fileName)";
showWindow writeWindow;
}
global proc listFileTextures(string $fileName)
{
int $fileId = fopen ($fileName, "w");
string $textures[] = `listConnections defaultTextureList1`;
for ($tex in $textures) {
string $fileTex = ($tex +".fileTextureName");
if (`objExists $fileTex`) {
print (`getAttr $fileTex` + "\n");
fprint ($fileId, `getAttr $fileTex` + "\n") ;
}
}
fclose $fileId;
deleteUI writeWindow;
}
I found this fun little script for saving a list of fileTextures to a text doc. it works great but I wanted to add a UI for inputing the filename and write path. I am having trouble passing the value of the textFieldGrp (the text in the field) to the procedure for listing the file textures. Could you all take a look at this and hopefully see some stupid mistake I am making. Thanks all
Brad
global proc printTextures()
{
window
-title "Print List of File Textures to File"
writeWindow;
columnLayout;
string $fileName = `textFieldGrp -label "/filePath/fileName" -text "/Users/Brad/Desktop/"`;
button -label "Write File" -command "listFileTextures($fileName)";
showWindow writeWindow;
}
global proc listFileTextures(string $fileName)
{
int $fileId = fopen ($fileName, "w");
string $textures[] = `listConnections defaultTextureList1`;
for ($tex in $textures) {
string $fileTex = ($tex +".fileTextureName");
if (`objExists $fileTex`) {
print (`getAttr $fileTex` + "\n");
fprint ($fileId, `getAttr $fileTex` + "\n") ;
}
}
fclose $fileId;
deleteUI writeWindow;
}
