Isia
07-01-2007, 12:02 PM
Hey all.
I am using Maya 8.5 at college now, and am in need of an SMD importer/exporter. I did find one script but alas it did not seem to work. The reason I am after the SMD importer/exporter is because I am creating a game mod (Mount & Blade) with a few friends as a small project.
Because I could not find the SMD importer/exporter. I decided to try and code my own. Partly as a challenge and a way to learn the MEL I/O.
The problem I am having is with the fopen command. It seems to not open the file for reading at all. Every file I have tried has failed. The fileID number that is assigned when you open a file, just returns 0 each time.
Here is the code.
proc importSMD ()
{
//declair variables
string $filePath;
int $fileID;
string $header;
//open a file dialog for the user to find the file
$filePath = `fileDialog -directoryMask "*.smd"`;
print ("Path: " + $filePath + "\n");
//check to see if filePath contains something
if ($filePath != "")
{//file path contains something
if (!`filetest -f $filePath`)
{
error ($filePath + " was not found, or could not be accessed.\n");
}
$fildID = `fopen $filePath "r"`;
if ($fileID == 0)
{
print "Does not work";
} else
{
print "working";
}
fclose $fileID;
} else //file path contains something
{//file path contains nothing
error "No file path has been specified, exiting script.\n";
}//file path contains nothing
}
Any help is much appriciated! Thank you
Isia
Edit:: sorry for the lack of identing, it doesnt seem to allow idents or spaces.
I am using Maya 8.5 at college now, and am in need of an SMD importer/exporter. I did find one script but alas it did not seem to work. The reason I am after the SMD importer/exporter is because I am creating a game mod (Mount & Blade) with a few friends as a small project.
Because I could not find the SMD importer/exporter. I decided to try and code my own. Partly as a challenge and a way to learn the MEL I/O.
The problem I am having is with the fopen command. It seems to not open the file for reading at all. Every file I have tried has failed. The fileID number that is assigned when you open a file, just returns 0 each time.
Here is the code.
proc importSMD ()
{
//declair variables
string $filePath;
int $fileID;
string $header;
//open a file dialog for the user to find the file
$filePath = `fileDialog -directoryMask "*.smd"`;
print ("Path: " + $filePath + "\n");
//check to see if filePath contains something
if ($filePath != "")
{//file path contains something
if (!`filetest -f $filePath`)
{
error ($filePath + " was not found, or could not be accessed.\n");
}
$fildID = `fopen $filePath "r"`;
if ($fileID == 0)
{
print "Does not work";
} else
{
print "working";
}
fclose $fileID;
} else //file path contains something
{//file path contains nothing
error "No file path has been specified, exiting script.\n";
}//file path contains nothing
}
Any help is much appriciated! Thank you
Isia
Edit:: sorry for the lack of identing, it doesnt seem to allow idents or spaces.
