Home Technical Talk

Multi OBJ Tools for Maya!

MoP
polycounter lvl 18
Offline / Send Message
MoP polycounter lvl 18
Hey folks,

So after a good reception for my Batch OBJ Tools for 3ds Max, I sat down today and wrote one for Maya too.

I'm happy to present mopMultiObjTool script for Maya!

You can download mopMultiObjTool.mel here, or by right-clicking on the screenshot and choosing "Save Link As":

mopMultiObjTool.png

This one has a slightly different feature set to the Max version due to some differences between the programs. The main core is the same though.

Feature list:
  • Import large amounts of OBJ files in one click!
  • Double-click an OBJ file in the list to import it directly.
  • Filter the file list with a simple string (for example I always prefix my meshes as "high" or "low" so I can sort the list of files easily).
  • Export selected objects to a highlighted OBJ file in the list.
  • Export multiple separate meshes from your scene to multiple OBJs in one click (it creates one OBJ per mesh, using the mesh name as the file name)!
  • Delete files directly from the list, or right-click to browse to the containing folder in Windows Explorer.
  • Choose to display folders in the file list for direct navigation.

This script has literally been written today, and I've tested it fairly extensively with a number of different scenes, OBJs and settings. I think I've got error handling in for all obvious cases, it should be a pretty smooth experience.

It's tested on Maya 2008 but should be fairly backwards and forwards compatible. Please let me know if you find any bugs or if you think of any extra features that would make this a more useful application.

Installation:
  1. Download the .mel file from the above link (right-click and Save Link As).
  2. Place it in your My Documents/maya/scripts folder.
  3. Re-start Maya and type mopMultiObjTool; in the MEL command line to launch the tool.
  4. I recommend you make a shelf button with this command for easy access.
Enjoy! :)

Replies

  • tacit math
    Offline / Send Message
    tacit math polycounter lvl 17
    awesome MoP. thanks heaps
  • claydough
    Offline / Send Message
    claydough polycounter lvl 10
    awesome! Thanks.
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    great job mop, thanks
  • Frump
    Offline / Send Message
    Frump polycounter lvl 12
    Wow. I actually just saw the Max version of this yesterday and started crying on the inside that it wasn't available for Maya because I had to do a ton of exporting.

    This should make a lot of things a lot faster and simpler; thanks MoP!
  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    Awesome idea mop.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    it is such a pain that a company like autodesk can't come up with something essential like this. Such a broken company lately :(
  • BeatKitano
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Freakin'awesome !

    Simple, effective and super quick, :)

    Real time saver for accessorizing characters in zbrush :)

    edit: unfortunately it doesn't keep the size ratio, so its kinda useless for the subtool purpose.
  • walter
    Offline / Send Message
    walter polycounter lvl 15
    Thanx ! very useful tool.
    There is a similar tool called RD Browser, with thumbnails for previewing the .obj,
    http://tools3d.com/news.php

    I also discover that in ZBrush 3.5 we can import .ma objects file, but not very well integrated. No polygroups for exemple.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Cheers guys, good to know there are people out there who will find this useful :)

    I still need to add support for the Maya OBJ settings, so you can turn off the "import multiple objects" thing, and so it will take the default settings when exporting. I'll try to get a version with that support up tonight.

    BeatKitano: What do you mean by "size ratio"? I've tried importing/exporting several OBJs that have been through ZBrush and Max, and they were always in the correct size and position for me. Can you give me an example of how it doesn't work for subtools?

    walter: Ah yeah, Rich Diamant's stuff - I'd forgotten about that! He does some nice tools.
  • Bal
    Offline / Send Message
    Bal polycounter lvl 17
    Great! I use this all the time in Max, definitely saves me alot of time. Don't use Maya so much these days, but it's still nice to know I have this around if I need it.
  • BeatKitano
    Offline / Send Message
    BeatKitano polycounter lvl 16
    @MoP: i don't know what i do wrong, but this happen with every subtool i add to zbrush with your script:
    Screen548-1258893508700_s.jpgMaya

    Screen1037-1258893731596_s.pngZbrush

    I've the feeling its related to the units in maya, but i don't remember changing anything, what's weird is thet zbrush export the obj in the correct size/position...
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Hmm, how are you appending the cube in ZBrush?
    Are you appending a PolyMesh3D to the main tool, then importing the OBJ onto the PolyMesh3D? I find this method always gives the correct scale.
  • BeatKitano
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Clone current subtool>delete levels>import obj>append obj to main tool.

    And this does exactly what is on those screens.
  • BeatKitano
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Ok, got it working, looks lie zbrush messed up with the size of one subtool, and it changes everything if you import a new obj in term of size ratio against all subtools...

    Sorry to have bothered you, works perfectly fine, thanks a lot :)
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Cool, good to know :)
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Update: I have uploaded a new version which includes support for choosing OBJ import/export settings (they're in the right-click menu over the file list). Link in the first post.

    I'm storing these settings separately to Maya's OBJ settings just so they don't conflict or get confusing, you will probably want to set them up how you like before doing any importing/exporting.

    The update also includes a fix for not showing the progress bar when exporting multiple OBJs.
  • tacit math
    Offline / Send Message
    tacit math polycounter lvl 17
    fucken rulz MoP. cheers
  • throttlekitty
    Offline / Send Message
    throttlekitty ngon master
    Cool stuff MoP, thanks a bunch!
  • onionhead_o
    Offline / Send Message
    onionhead_o polycounter lvl 16
    this might come in handy for my short film im working on with my friends. thanks MoP.
  • East
    Offline / Send Message
    East polycounter lvl 14
    Bloody good job, MoP. Much appreciated!
  • bowplane
    can this be used on mac or PC?
  • eof
    Offline / Send Message
    eof polycounter lvl 16
  • Sirtet
    I've enjoyed working with this tool. Though I would like to ask if there is any chance it could be expanded to allow for the importation of each obj file in a sequence [mesh_001.obj - mesh_005.obj] to keyed for visibility on each frame that corresponds to the file number?

    mesh_001.obj visible on frame 1
    mesh_002.obj visible on frame 2

    so on and so forth.

    I can't really do this manually for 20 sec animation.
  • Toast
    Offline / Send Message
    Toast polycounter lvl 11
    Nice Tool.

    BTW you don't need to restart Maya when adding scripts.

    Just type in Rehash in the MEL command line. ;)
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Toast: Yeah, I know, I just like telling people to restart Maya :)

    sirtet: Interesting idea, I could look into it. It'd have to be a checkbox option though, since otherwise it could have unpredictable results on meshes numbered for other reasons.
  • Sirtet
    Good point MoP.

    The reason why I'm interested in bringing in an obj sequence on a frame to frame basis is to create a workaround RealFlows' requirement in Maya to have a plugin in order to read the .sd files RealFlow outputs dynamics.

    At the school I attend we can get the RF plugin installed on the PCs but the PCs are limited in resources, processing and memeory, because of their 32-bit environment. Plus we can't utilize our RenderFarm because of the plugin. I am working to getting the RF plugin installed on the Macs but until then a workaround RF's plugin will give the production team options in rendering down the line.
  • Sirtet
    Well I have an idea about 10 minuets ago that solved my problem.

    Using your plugin I exported the RealFlow sequence out to objs (300 files), imported that obj sequence into Houdini then exported the sequence as a FBX file and finally imported the FBX file into Maya, producing a RealFlow workaround. lol

    I'm still interested in the suggestion I proposed for plugin extension.

    Not sure if anyone here uses RealFlow but if they do and want to break away from its .sd file structure this is the way to go.
  • Bal
    Offline / Send Message
    Bal polycounter lvl 17
    Ok I'm back to using Maya these days, so I'm bringing this thread back from the dead, sorry! Dunno if you still have the courage to work on this MoP, but here are some two requests/ideas.

    - Same as I asked for the Max version, the "center to scene" before export checkbox, and fbx support.

    - Something new, a bit trickier maybe, I'd love it if when I had a group selected instead of an object, it would combine all the objects in that group and export them as one file (with the group name as file name), would be super useful for many cases where I don't want to combine my stuff to keep it easy to work on.

    Thanks again for the scripts! I use these all the time (this one and the Max version).
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Hmm, yep Bal, all that stuff sounds like a good idea and probably not difficult to implement.

    I might take a look at it this weekend if I find the time! :)
  • Bal
    Offline / Send Message
    Bal polycounter lvl 17
    Ok came across another idea, tell me when I should shut up and start learning mel MoP.
    Would be great if the exporter could check if a model is in smooth preview, and if that's the case, actually sub divide it (with proper settings) before export, really annoying to have to do it manually.
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Bal wrote: »
    Ok came across another idea, tell me when I should shut up and start learning mel MoP.
    Would be great if the exporter could check if a model is in smooth preview, and if that's the case, actually sub divide it (with proper settings) before export, really annoying to have to do it manually.

    should be pretty easy (thats what i always think then ram my head into a wall lol). Got a snow day today so might tinker around with MoP's code. Hope he doesnt hate me. :(

    EDIT: Got it working though not yet in MoP's. Gonna have to browse through his script. Didnt even know I could query that haha.

    global proc convertToSub() {
        string $sel[] =`ls -sl`;  
        for ($thisObj in $sel){ 
            //For some reason it needs to be an array but only one number is put 
            int $displaylevel[] = `displaySmoothness -query -polygonObject $thisObj`;
            print $displaylevel; 
            if ($displaylevel[0] == 3) 
            {
                //put code to convert
                
            }
        }
    }
    
  • rebb
    Offline / Send Message
    rebb polycounter lvl 17
    It seems that "CreatePolyFromPreview" does this check by default, so it should just be a matter of selecting everything, and issueing this Command :)
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    rebb wrote: »
    It seems that "CreatePolyFromPreview" does this check by default, so it should just be a matter of selecting everything, and issueing this Command :)

    hey rebb. Is that just a pymel command? Was trying to find if there was something like that for mel.
  • rebb
    Offline / Send Message
    rebb polycounter lvl 17
    It's the default Mel-Command that runs from the "Convert->Smooth Mesh Preview to Polygons" menu.
    ( It's actually a runtime-command referencing "performSmoothMeshPreviewToPolygon()" )
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Bal wrote: »
    Ok came across another idea, tell me when I should shut up and start learning mel MoP.
    Would be great if the exporter could check if a model is in smooth preview, and if that's the case, actually sub divide it (with proper settings) before export, really annoying to have to do it manually.

    Heh yep, I wrote this script for our exporter at work too.
    Basically it just queries the mesh sub-d preview settings, applies those as a polySmooth, exports the mesh, then deletes the polySmooth node and turns the sub-d preview back on.

    I'm still amazed that Maya is so backwards in this regard. At least Turbosmooth in Max exports at the sub-dlevel you set it to.
  • nadvass
    Hello MoP and all- this looks like a great script, just what I was looking for. Unfortunately I'm either doing something terribly wrong, or it does not seem to be working for me. The versions of Maya I tried it on are 2012 x64 Windows and Mac both, and 2011 x64 Mac.

    When running the script, it loads the file dialog, lets me select the obj files and hit import, after which it outputs " p, li { white-space: pre-wrap; }
    Successfully imported 1(or however many) OBJ files
    
    But- no new objects appear in the viewport, or the outliner.
    It does output two errors before that:
    p, li { white-space: pre-wrap; }
    // Warning: Command fileBrowserDialog has been deprecated.  Use fileDialog2 instead. // 
     // Warning: line 0: Option "Use legacy vertex order" will only take effect when option "Multiple Objects" is enabled. // 
    

    Any clues or fixes will be much appreciated, this could really be a life saver for a current project...
    Nadav
  • gilesruscoe
    Offline / Send Message
    gilesruscoe polycounter lvl 10
    Download links not working :( is your site down?
    Would love to get my hands on this!
  • TeZzy
    Offline / Send Message
    TeZzy polycounter lvl 12
    Hi guys,

    My MEL is real basic, only recently got into learning it...fun times!

    Anyway, I have written a basic script that allows you to import multiple objs (no exporting unfortunately, atleast not right now). It's not much compared to what MoP's script does. But maybe it's useful to someone?

    Let me know if you are interested.
  • Mikael P.
    Offline / Send Message
    Mikael P. polycounter lvl 14
    Paul, your link is no longer active and I couldn't find a script section on your site. Any chance of a new link?
  • Roepetoepa
    Offline / Send Message
    Roepetoepa polycounter lvl 12
    Mikael you can find the script written out here:
    http://www.polycount.com/forum/showthread.php?t=120645

    Just make a text file paste all the text in it and overwrite the filename from
    blabla.txt to mopMultiObjTool.mel

    cheers
  • Olninyo
    Offline / Send Message
    Olninyo polycounter lvl 10
    this tool has sped up my workflow so much.

    cheers!
  • bob3636
    Offline / Send Message
    bob3636 polycounter lvl 11
    does anyone still have this tool? :smile:

  • oglu
    Offline / Send Message
    oglu polycount lvl 666
    just in case the script is gone...
    you could drag and drop multiple objs from the windows explorer into the maya viewport to import them...
Sign In or Register to comment.