Home Technical Talk

Multi-convert Maya-files to 3d max

I've got a lot of simple objects from Maya (mb files), and I would like to convert them into 3d max files. Is it possibble to do it pretty easy and quick way ?

Replies

  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    This would be pretty easy to do through script. Basically you can just get a list of *.mb files in a given folder, and for each file just open it, export to whatever file type you want (I'd recommend FBX) and close the file.

    Something like this (disclaimer, I'm not testing this code, just writing it on the fly, so it may not work 100%):
    // Specify the folder we want to load scenes from. Forward slashes are
    // important here, since backslashes are escape characters in strings.
    string $folder = "C:/path/to/scenes/";
    
    // Get a list of all files matching the .mb extension and place them in
    // a string array called $files.
    string $files[] = `getFileList -folder $folder -filespec "*.mb"`;
    
    // Go through each file in the array.
    for ( $file in $files ) {
        
        // Open this file.
        file -f -open $file;
        
        // Grab the base name of the scene to use as a name for the
        // file we're going to export.
        string $name = basename( $file, ".mb" );
    
        // Export everything in the scene into the same folder, with
        // The name we just got, plus the file type extension.
        file -exportAll ( $folder + $name + ".fbx" );
    }
    
    // Re-initialise the scene. Closes whatever file was open before.
    file -f -new;
    

    If you need to find out more about each command, the MEL Command Reference (look in Maya's Help menu) will list examples of all of these commands, and different flags to call on them.
    Also, you could quite easily improve this script by adding a progress bar (look up the progressWindow command in the help) or outputting the files to a different folder.
    You could make it into a fully-fledged usable script by having a file browser dialog window to allow any user to browse to a folder to export from.

    Hope that helps.
  • Gerbeiter
    Options
    Offline / Send Message
    I will try out it tomorrow, thanks a lot anyway.
Sign In or Register to comment.