View Full Version : save as variable via text requester
02-16-2005, 04:53 PM
Quick request. I am using maya 5.0 in XP btw.
I am looking to streamline the process of saving 100's of files from imported fbx data, and any mouse clicks I can save would be a godsend.
Heres a brief overview of what I am looking to do:
1. I import my fbx file onto my skeleton (done)
2. I run a script that preps the model in the way that it needs to be set up (done)
3. I save the file using a save as included in the scrpt mentioned in 2. (need help with this part.)
So...what I am looking to add, is the functionality of a text requester, that plugs whatever value I enter into the file name part of the save as function. The text requester ideally would pop up after the main part of the processing is complete. I hope to be able to add this code directly into the end of step 2.
Thanks in advance for any help. I am quite a novice at mel scripting so any assistence is greatly appreciated.
02-16-2005, 07:35 PM
Take a look at the fileBrowserDialog command in the MEL help, as I think it is just what you are looking for.
02-16-2005, 08:49 PM
Or alternatively you can pop a "promptDialog" for the input of the file name, then rename the current scene using "file -rename", and then use "file -save -type" to tell Maya to save the file to the type you want.
02-16-2005, 09:24 PM
Cool. I will check both options out. Thanks for the advice.
02-16-2005, 09:48 PM
ok got the save as to function properly. New question. I am trying to combine my import function into my script.
I have the following:
fileBrowserDialog -m 0 -fc "import" -ft "fbx" -an "Import_fbx" -om "Import";
and I get this error:
// Error: Cannot find procedure "import". //
I get the requester, I load the fbx file in. It then gives me the error. I believe it jsut dosent know what to do with the file once its selected to be loaded.
any ideas anyone?
02-17-2005, 03:26 PM
I wrote a tool to do something along the same lines. What it did was read a folder structure, and load in the appropriate characters for the shot, and then loaded the appropriate fbx file, and so on and so on.
The big problem I encountered was that the fbx importer was waiting for input from the user in its' interface (clicking the OK button) but the script wasn't waiting for the plugin to finish its' job. Subsequently the script was going through and loading all the characters in before the first character was finished.
I ended up splitting the procs so the user had to click on a button to load in each character individually. Once a character was chose for import, the fbx was loaded on and all the other setup stuff was finished for the character. Then the user clicked the next character in the list and it started all over again.
I don't know if this helps you any, but it might at least alert you to some potential roadblocks further down the line.
02-18-2005, 04:04 PM
Cool info. I was assuming based upon my tests with the save as function, that if I could actually get the file requester to work with Maya the right way, that it would work the way it should. So if what youre saying is correct, then what I was thinking wouldnt work. So would setting up some sort of 15 second pause in the script work? Is there any way to do that in mel? If there is a way to do that, would inserting that also pause the fbx importing? Either way, 2 button presses as opposed to one is not really a huge problem. With all the rest of the functions that this script covered it drastically cuts down on prep time. Also, about my iniital question, the save as function. I was mistaken, I am actualy unable to get it working. I am guessing that I have a simple error in my line. Heres what the script editor is telling me:
This is my line of script:
fileBrowserDialog -m 1 -fc "SaveAs" -ft "mayaBinary" -an "SaveAs" -om "SaveAs";
SaveAs "C:/Documents and Settings/****/Desktop/empty.mb" "mayaBinary";
// Error: Cannot find procedure "SaveAs". //
I have nobody here at work that I can ask about this issue. I know this seems like an extremely simple question, but anyone have any idea which part of my script is generating the error? The script actually gives me the save as dialogue box, it asks for a file name, then it attempts to save. The dialogue box closes and the error part pops up in the script editor. I assume the script part gets to either the -an or the -om flag and fails there.
Again, any assistence is appreciated. Also, the ***** part is just blanking out my company info that I dont wish to broadcast all over the internet. My best guess is that one of the SaveAs functions is supposed to be something else or just not supposed to be there at all. If nothing else I'd like an idea of where I went wrong. All I am trying to do is tie a basic save as function into the end of my script.
02-18-2005, 09:59 PM
There is no function "SaveAs". Instead use file -s to save files. And instead of using a pause, use evalDeferred() and put whatever you want to run in the parenthasis. Maya will wait until it is idle to execute the commands.
02-18-2006, 10:00 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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.