Hello All!
As I have a background from an art school, and therefore enjoy the abuse of critiques, I thought I would throw this little bit of script I’ve been working on and ask for suggestions to make it better/faster/cooler.
I’m kinda new to a lot of maxscript, so it seems to take me days to learn the really easy stuff, and when I do it usually is slapped together to meet some deadline, so I apologize if this is something the majority of you know. I had a difficult enough time with it that I thought I’d save other newer folks the headache.
Anyway, I needed a way to batch through our animations to save them onto a new rig, then export them in the proper format. The problem were that there were multiple sub-folders in the source directory, and I had to save them all to appropriate sub-folders in the destination directory, plus the Source and Dest directories would have to be user definable
Of course, max provides a good recursive script in the MXS reference, but I couldn’t find anything on how to save to sub-folders in a different directory.
After trying a whole slew of different things (including parsing the paths and rebuilding them, trying the configpath function, and ripping apart other batch scripts online) I hit upon the relatively simple idea of using the substituteString function, and with a bit more fiddling around, this is what I came up with:
sourceDir = "C:\\project\\art\\Char\\anims\\Source"
destDir = "C:\\project\\art\\Char\\anims\\Dest\\"
dir_Array = getdirectories ( sourceDir)
for d in dir_array do
join dir_Array (getdirectories (d+"\\*"))
files = #()
for f in dir_array do
join files (getfiles (f+"*.max"))
For f in files do
( loadmaxfile f quiet:true
fileName = getfilenamefile f
oldPath = getfilenamepath f
newPath = substitutestring oldpath sourceDir destDir
makeDir newPath
savemaxfile (newpath + filename + ".max")
)
the source and dest variables would end up being defined by text fields in the UI, plus the option to run other scripts/operations when the file opens.
Like I said before, I know this script’s been done to death, and every studio is bound to have some solution, but it’s the first time I’ve done it. What do you guys think?