Home Technical Talk

MAXScript: Multi OBJ Tool v1.3!

1
MoP
polycounter lvl 18
Offline / Send Message
MoP polycounter lvl 18
I put this in my DomWar thread, but I figure it might get more exposure here. It was just a quick thing I threw together this afternoon, so let me know if it has any major flaws... ;)

mopMultiImport 1.3
  • Floating window which lists files in a folder of your choice.
  • Select multiple objects and click "Import" to get them all in the scene.
  • Double-click on a file in the list to import it directly.
  • Choose to replace objects in the scene if they already exist on import.
  • Export selected objects to multiple OBJ files!
  • NEW: Text filter for the file list, nicer to deal with large amounts of objects
  • NEW: Choose to import/export FBX or OBJ format!
  • NEW: Move objects to 0,0,0 in world space for exporting (they'll get put back afterwards)
  • Bug fix: Objects which had keyframes on rotation/scale and are being replaced on import will now work correctly.
mopMultiImport.ms
Download here!


Installation instructions:
  1. Run the script in Max. You only need to do this once, since it creates a macroScript.
  2. Look in the Customize User Interface menu, find the "MoP's Tools" category, it should contain the entry for "Multi OBJ Tool".
  3. You can then put this as a toolbar button, hotkey, or my recommended method of putting it in the default viewport Quad menu for fast access at all times.
  4. Make sure you have already set your OBJ and FBX import/export options, since this script gives no import prompt. It will use whatever settings you last used. In most cases this will be fine since you probably just imported something with the correct settings recently anyway.
  5. This script will always prefer the GuruWare OBJ plugins if you have them installed. I think it's generally better and faster than Max's default one.

Let me know if you have any troubles with it! :)

Replies

  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    sexy, will give it a shot it will be very usefull for multi export/import zBrush/mudbosxm/ uvLayout stuff.

    what would be cool if one could on the other way around select objects from the scene and batch export them to the folder of that rollout. The object name in max would then be assigned to the file name dot obj and if you import objects thei max name would be the same as the filename without the extention.
  • Psyk0
    Options
    Offline / Send Message
    Psyk0 polycounter lvl 18
    Awesome, after importing a bunch of subtools a few times i thought, why isnt there a batch import option?!...looks like my prayers have been answered :). Thanks.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Ninja edit!

    I've added an option to "overwrite" scene objects if they have the same name as the OBJ file being imported. Basically this just deletes the existing scene object before importing the new one (thus replacing it).

    If you use this option and your existing objects had materials, those materials will be applied to the newly-imported objects that are replacing them. Hooray!

    I've you've already downloaded and installed the script, please re-download if you want the new functionality, and run the new one. Any shortcuts/hotkeys you had should be updated correctly.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Ninja edit #2!

    Added an Export button like renderhjs suggested.
    This one will simply export any selected objects to OBJ files matching their object name in Max, to the "source folder" chosen in the tools.

    Again if you need to update, just re-download the .ms file, run it once, and all should be well.
    Bug reports / suggestions welcome.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    oh I like you :)
    thx alot for this usefull script
  • Rob Galanakis
    Options
    Offline / Send Message
    Add this to the tao script repo so others can run with it!
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    another idea:

    highlight or add a color note to the line of those objects in the list that are already available in the scene (aka the objects to be merged or replaced) so that one quicker can see which objects are already exported or available in your scene from the list.
  • Ben Apuna
    Options
    Offline / Send Message
    Wow! what a time saver, thanks MoP! Export is an awesome addition as well. If I might humbly suggest ASE as a future export type all us environment artists doing UE3 stuff would be very happy.
  • kary
    Options
    Offline / Send Message
    kary polycounter lvl 18
    And now I want this in Silo so badly... many thanks MoP that is an extremely useful script.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    my last suggestion today:

    gui shrinking and multi column dotNet use
    multiObjTool_gui_suggestion.gif
  • Okt
    Options
    Offline / Send Message
    Okt polycounter lvl 19
    Haha, wicked, glad there is a GUI of it now. I had to get sets of 100+ objs into max files earlier this week, wrote a non user friendly version of just this. if only you were a few days earlier. :P
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    This is awesome, so bored of importing all my objs in and out manually. Thanks MoP!
  • GoSsS
    Options
    Offline / Send Message
    GoSsS polycounter lvl 14
    Really cool script. This one will save me a lot of time. Thanks man.
  • ScoobyDoofus
    Options
    Offline / Send Message
    ScoobyDoofus polycounter lvl 19
    How funny and timely is this. I've never used or needed this before until this moment and then I remembered your post from yesterday. So awesome. Thanks Paul!
  • rasmus
    Options
    Offline / Send Message
    Seems kickass, thanks!
  • mat
    Options
    Offline / Send Message
    mat
    very generous of you, just gave it a quick try out then and its super fast and simple to use.
    thanks so much :D
  • Joshua Stubbles
    Options
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    Nice MoP, very helpful!
    Thanks
  • ArtsyFartsy
    Options
    Offline / Send Message
    this rulez hard!
  • mLichy
    Options
    Offline / Send Message
    Ya, if you could do what renderhjs said, that would be sweet. But even still, awesome job :)
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Bumping since I've updated it.

    Not a major overhaul at all, just a little under-the-hood change so that it now saves your settings (the source folder, and the "replace objects" checkbox value) into an INI file and tries to load this on startup, so you shouldn't have to keep re-entering the path between Max sessions.

    Download link is the same as before.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    that's nice, I need to add that to my scrips as well storing last used variables

    I showed this script to some other students here and they got quite fond of it - its a very useful tool when you work a lot with different external tools.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Yeah, it's been invaluable for my DomWar ... I export all my source meshes with 1 click now, and import/update the entire scene or just parts of it in no time at all, was really annoying to have to manually import 10-15 separate OBJ files every time my Zbrush work progressed :)
  • fast1
    Options
    Offline / Send Message
    thanks, excellent script!clear.gif
  • JordanW
    Options
    Offline / Send Message
    JordanW polycounter lvl 19
    not bad mr mop, not bad at all :)
  • Psyk0
    Options
    Offline / Send Message
    Psyk0 polycounter lvl 18
    I just ran into a bit of a problem when exporting...it always exports a triangulated mesh?. Tried both editable mesh and poly, i have guruware installed (i even changed all settings to export as quads), exports fine when using guruware by itself.

    To bypass this problem i changed the import option "tri2quad" in zbrush. Any ideas?
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    it probably is not the script - because (although I am not 100% sure) maxscript allows you only to call a function to export as file and depending on the extension it will use the default settings of your last export out of 3dsmax.
    So like you said changin the default export settings (when doing so manually) to quads should basicly do it.
    Except Mop did things different in his script
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    renderhjs wrote: »
    it probably is not the script - because (although I am not 100% sure) maxscript allows you only to call a function to export as file and depending on the extension it will use the default settings of your last export out of 3dsmax.

    Yep, all I do is call Max's function to the OBJ exporter (Guruware plugin is tried first, if it doesn't exist then I fall back on default Max OBJ exporter) - as far as I know this function should just use the last saved settings you used to export an OBJ.

    It has worked fine for me so far, and I'm not using any voodoo in the script to load/save OBJ exporter settings.
    renderhjs wrote: »
    Except Mop did things different in his script
    Did I? :o
  • BradMyers82
    Options
    Offline / Send Message
    BradMyers82 interpolator
    This is great. I actually just installed a batch obj importer about a month ago because I was looking for something like this. This script is way better than what I installed previously. Thanks a lot man!
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Sorry, another minor update...
    • Dialog now remembers position across sessions so you don't have to keep putting it back in your favourite position.
    • When the "Replace existing objects" checkbox is enabled, object transforms (and simple keyframe data) will be preserved, so if you've moved your OBJ imports in the scene at all, the replacements will remain positioned/animated correctly! Only supports position/rotation/scale keyframes.
    • Some other minor cleanup in the backend, doesn't change anything, just makes the script a bit neater.
    Same download link as before.
  • mikezoo
    Options
    Offline / Send Message
    mikezoo polycounter lvl 14
    Many thanks! Look forward to using it!
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    Sorry to dig this thread up, but I still use this tool everyday (you rock MoP!), how hard would it be to make this work with FBX instead?
    Been working with edited vertex normals alot, which the OBJ max exporter doesn't handle (not sure why, as far as I know the OBJ format supports it), so I've switched to FBX. Would also make it work with the latest version of UDK.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    I created something like that for unity where every object each on its own gets placed at 0,0,0 before exporting to FBX and returned to their former position after it. Thats something I hate about unity and FBX, it reads the file as a scene (object placed at where the pivot is placed in space, instead of having the pivot being the origin) instead of just a object file.
    You might want to consider that with FBX, as it supports more than just a singe object.
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    Renderjhs, yeah I have the same problem, need to keep the objects at 0,0,0 if I want the pivot to be right in UDK.
    Your script available anywhere?
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    not sure if you need to know or not but I fell into a small hole in 3dsmax 2010 as they added maxscript access to the obj export/import settings and my previously fine scripts I use for this sort of thing suddenly began to use default settings when I used them in 2010 - I had to write some extra gubbins to set the relevant export settings to make it go back to how it used to behave :(

    Nice tool! :D
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Bal, sure, I can try updating it for FBX. Maybe this weekend.
    I can also check out the stuff cw mentioned and maybe see about adding some more features like renderhjs suggested.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
  • Mio
    Options
    Offline / Send Message
    Mio polycounter lvl 13
    useful stuff man. awesome :) thanks for share
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    OK, here's the 1.3 update. I've cleaned up some code in the backend (particularly saving/loading the settings, I dunno what I was thinking before but it was stupidly complicated, now it's sensible and standardised).

    I've updated the first post with all the latest info so the thread is up to date.

    Here are the main improvements:
    • Choose to import/export FBX or OBJ format!
    • Text filter for the file list, nicer to deal with large amounts of objects.
    • Move objects to 0,0,0 in world space for exporting (they'll get put back afterwards).
    • Fixed a bug where objects which had keyframes on rotation/scale and were being replaced would give an error.
    mopMultiImport.ms
    mopMultiImport13.jpg

    Download here!



    Let me know if you run into any issues or have any requests for new features.

    Some things I want to bring across from my Maya version of this script is stuff like being able to browse to the output folder in Explorer, and also directly delete OBJ files by right-clicking on the list (and other context-sensitive actions).

    I will also look into adding options to have specific settings for import/export for the tool. Right now it just uses whatever your last OBJ/FBX import/export settings were, so it's much easier for me to deal with in script.

    It will be a fair amount of work to add the options per filetype but I think it might be worth it in the long run.

    You can also find this script on the scripts section of my new website.
  • Yozora
    Options
    Offline / Send Message
    Yozora polycounter lvl 11
    woot, replacing every instance of "obj" with "smd" still works :D
    But the new dropdown box for file type is very handy, I just replaced "fbx" with "smd" instead since I barely ever use fbx.
    I like that it remembers the (last used?) path now.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Yozora: hehe, sneaky :)

    It should have remembered the last used path before too, maybe I inadvertently fixed a bug without noticing? It's probably something to do with how I was storing the settings before, I was using a custom format.

    I somehow totally missed that Maxscript has a direct INI get/set procedure... so I'm now storing the settings in with the main 3dsmax.ini file :)
  • CompanionCube
    Options
    Offline / Send Message
    CompanionCube polycounter lvl 12
    thx so much for the update mop!
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    MoP wrote: »
    I somehow totally missed that Maxscript has a direct INI get/set procedure... so I'm now storing the settings in with the main 3dsmax.ini file :)

    Hey MoP, why do you add information to the 3ds Max ini file? Wouldn't it be better to create your own ini file in the same folder containing the script? Functions for file creation and access are quite straightforward as those for direct ini fields manipulation. Anyway, thank you for the useful script!
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    SyncViewS: Well, I used to be doing what you said, in the previous version of the script - I was creating a custom .ini file in the userScripts folder and writing my data in there. It would be quite trivial to set it back to that, but I figured (judging by how the Maxscript documentation says it, anyway), that those getINISettings and setINISettings are designed to be used in conjunction with the 3dsmax.ini file.

    Is there any reason why I shouldn't write stuff into that file? It seems like the script functions for setting values there are pretty foolproof, so I can't see it damaging anything.
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi MoP, as you said 3dsMax.ini stores Max preferences and can regenerate itself upon deletion, so it is quite safe to work with. There is no particular reason to avoid using it to store information about your script, but as personal taste, I don't like the idea that a script touches other things, when there is no advantage in doing it. I mean, if a user installs and use the script than deletes it, saved info stay in the 3dsMax.ini file. It doesn't hurt anyone, to be very clear, it's just something I don't like, seems like installed and then uninstalled programs that leave traces in Windows register. Just personal taste, please bare with me :)
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Entirely understandable. I may change it again in the next release (whenever that is).
    Until then, it works and shouldn't cause any problems :)
  • CompanionCube
    Options
    Offline / Send Message
    CompanionCube polycounter lvl 12
    MoP i was just wondering, would it be possible in future versions to add a function which automatically places the selected imports into their own layer in max, it wouldn't matter if there wasn't a naming function for the layer, just as long as it placed the imports into their own layer. do you think thats even possible?
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Yep, it's definitely possible - for example the current "replace" function already should put the objects back into the correct layer if they're replacing an object with the same name.

    I could just have it add a new layer with the same name as the object, would that be ok?
  • CompanionCube
    Options
    Offline / Send Message
    CompanionCube polycounter lvl 12
    that would be awesome MoP, you already saved me so much time with this script so eternally greatfull
  • PolyHertz
    Options
    Offline / Send Message
    PolyHertz polycount lvl 666
    Hey I was just watching the trailer for the new Eat3D dvd (lowpoly character one) and looks like they're using/showing off your tool :)
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    Ooh, I asked for the fbx support and then ran off on vacation, so a bit late to reply. Thanks alot MoP, this works great, you rock!
1
Sign In or Register to comment.