Reply
Reply
 
Thread Tools Display Modes
tuxmask75's Avatar
Old (#1)
Hey guys, I have around 600 or so .model files.
I already have a .model importer script for max.
it only opens files 1 at a time, and does not auto save.

what I'm trying to do is open multiple files within a directory and auto save them all in another format.

Anyone have a good max script that i could use to integrate within my other script.

((looking for something like Photo shop's batch function.))
Open
Save as: *file type*
Than open next file and repeat above.

Last edited by tuxmask75; 07-05-2011 at 05:14 AM..
Offline , line, 79 Posts, Join Date Jan 2011, Location Florida, USA  
   Reply With Quote

haiddasalami's Avatar
Old (#2)
Would help to know what file type. Will help people to point you to a script or possibly someone scripting it/tweaking a script to suit your needs.
Offline , dedicated polycounter, 1,855 Posts, Join Date Nov 2009, Location Toronto  
   Reply With Quote

Warheart's Avatar
Old (#3)
Should be simple to do. Especially if all your files to be processed are in one directory then it's really easy.

Code:
files = getFiles "c:\\foo\\*.max"
for f in files do 
(
    loadMAXFile f; -- this would load each max file found in turn
    
    -- so you would do something like:
    -- call load function
    -- save file
    -- etc.
)
Obviously just changing the path to point to your folder and ".max" to be whatever extension you're looking for. If you want the script to handle subdirectories then it can get a little more complicated (e.g. if you want to mirror the directory structure within another root path or something like that). It's not that hard though and I'm sure myself or someone else here could help with that if it was needed.

If you search the maxScript help for "External File Methods" then there's more info about this type of stuff there.

Last edited by Warheart; 06-27-2011 at 05:32 PM..
Offline , spline, 155 Posts, Join Date May 2006, Location Scotland  
   Reply With Quote

tuxmask75's Avatar
Old (#4)
Quote:
Originally Posted by Warheart View Post
Should be simple to do. Especially if all your files to be processed are in one directory then it's really easy.

Code:
files = getFiles "c:\\foo\\*.max"
for f in files do 
(
    loadMAXFile f; -- this would load each max file found in turn
 
    -- so you would do something like:
    -- call load function
    -- save file
    -- etc.
)
Obviously just changing the path to point to your folder and ".max" to be whatever extension you're looking for. If you want the script to handle subdirectories then it can get a little more complicated (e.g. if you want to mirror the directory structure within another root path or something like that). It's not that hard though and I'm sure myself or someone else here could help with that if it was needed.

If you search the maxScript help for "External File Methods" then there's more info about this type of stuff there.
Yeah something like that,
and loadMAXFile f; would need to load a .model so I'm guessing this needs to be changed?

Quote:
Originally Posted by haiddasalami View Post
Would help to know what file type. Will help people to point you to a script or possibly someone scripting it/tweaking a script to suit your needs.
.fbx .dae .obj .3ds .max are the export formats I'm interested in,
and .model is import.
Offline , line, 79 Posts, Join Date Jan 2011, Location Florida, USA  
   Reply With Quote

r_fletch_r's Avatar
Old (#5)
Code:
inFormat = ".model" --put your in format here
outFormat = ".dae" -- put your out format here

files = getFiles "c:\\foo\\*."+ inFormat


for f in files do 
(
    importFile f #noPrompt
	newFilename = (filterString f ".")[1] + outFormat
	exportFile newFilename #noPrompt
	
)
this should do it. havent tested it but is not exactly complex.. I dont know whether all formats support the #noPrompt flag so you may be clicking through UI's a bit. but thats not avoidable.
Offline , veteran polycounter, 2,970 Posts, Join Date Feb 2010, Location Ireland  
   Reply With Quote

Warheart's Avatar
Old (#6)
Ah ok, sorry I didn't explain that in much detail because I was assuming you were reasonably familiar with the scripting stuff.

Yea, like you said you need to replace that loadMAXFile function call with your import function. e.g. "importModelFile f" (assuming it's got a load function that accepts the path to a file as an argument).

Is it your import script? If not and you're not sure how it works then it might be worth posting it or a link to where you got it from and we can help modify/wrap it to do this.


Edit:
Just saw r_fletch_r's post. Yea, that should work assuming your .model reader is a plugin and not a script.

Last edited by Warheart; 06-28-2011 at 12:24 PM..
Offline , spline, 155 Posts, Join Date May 2006, Location Scotland  
   Reply With Quote

tuxmask75's Avatar
Old (#7)
Quote:
Originally Posted by Warheart View Post
Ah OK, sorry I didn't explain that in much detail because I was assuming you were reasonably familiar with the scripting stuff.

Yea, like you said you need to replace that loadMAXFile function call with your import function. e.g. "importModelFile f" (assuming it's got a load function that accepts the path to a file as an argument).

Is it your import script? If not and you're not sure how it works then it might be worth posting it or a link to where you got it from and we can help modify/wrap it to do this.


Edit:
Just saw r_fletch_r's post. Yea, that should work assuming your .model reader is a plugin and not a script.
Yeah the .model reader is a script.

Last edited by tuxmask75; 07-05-2011 at 05:15 AM..
Offline , line, 79 Posts, Join Date Jan 2011, Location Florida, USA  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch