PDA

View Full Version : system MEL error??!!


n0$feratu_037
09-19-2005, 12:37 PM
OK here is the problem:

I tried to create a simple mel shelf button that will save my existing maya7 scene to maya 6 via mayaFileConvert.exe prog.
This is the script I thought would work:

string $currentScene='getFileList';
system ("mayaFileConvert -v 6.0 "+$currentScene);

It looks simple enough,but I get an error msg:
cannot convert data type string to string[]
I really don't know what this means. :banghead:
Can anyone help me understand what am I doing wrong?

thanx

Segmoria
09-19-2005, 01:36 PM
I dont think 'getFileList' gives you the name of your scene.
It is used to list all files in your project or get the folder that it is into.
You should use instead `file -q -sceneName`

brubin
09-19-2005, 02:10 PM
quote from the docs:

Commands

getFileList

[...] (http://localhost:4446/Maya6.0/en_US/Commands/getFileList.html)

Return value

string[] an array of file names



which means, your code should probably work with this little modification:

string $currentScene[] ;
$currentScene = 'getFileList' ;
system ("mayaFileConvert -v 6.0 "+$currentScene[0]);

n0$feratu_037
09-19-2005, 04:03 PM
thanx guys,but now I have similar problem regarding the file -q -sceneName command :hmm:

the code goes like this:

string $currentScene[];
$currentScene=`file -q -sceneName`;
system ("mayaFileConvert -v 6.0 "+$currentScene[0]);

and the same error shows up again!!
cannot convert data type string to string[]

How come?!

thanx

brubin
09-19-2005, 04:23 PM
...cause this time you have it wrong the other way around: TAKE A LOOK AT THE ONLINE-MANUALS FIRST!
Commands

file


[...]


Return value

Dependent upon the action or query requested. Most actions return a string which is the name of the specified file.





if you choose to use "file" instead of "getFileList" you can fall back on your initial approach, "getFileList" on the other hand uses an array AT ALL TIMES as a returning value, so you have to query a specific element of that array to give to your system command, which needs a single string only.
just read more carefully, will ya'?

s.

n0$feratu_037
09-19-2005, 04:29 PM
yup I got it
thanx :bounce:

harmless
09-19-2005, 04:32 PM
string $currentScene = `file -q -sceneName` ; //does not return an array
system ("mayaFileConvert -v 6.0 " + $currentScene) ;


It does not sound trivial to make Maya 7 backwards compatible with Maya 6. After all...Alias didn't even do it ;)

CGTalk Moderation
09-19-2005, 04:32 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.