legomoe Posted July 31, 2012 Share Posted July 31, 2012 (edited) In light of the recent discoveries on how to read LEGO Island 2's .msh model format, I thought that I would go ahead and update my old .msh to .obj converter tool. I must admit, I got a little carried away. I completely rewrote the msh2obj tool, and I've written a brand new tool for converting .obj files back into .msh format. To tools can't handle models that have animation data (SVWL and AVW2 sections), but I think they should be able to convert anything else. I haven't had a chance to test anything beyond just moving vertices around, but feel free to experiment on your own and post what you find out in this topic. Here are links to both programs: Mediafire: http://www.mediafire.com/file/z75aulkkxk4waps/LI2_Msh_Tools_v1.0.zip RRU Files Database: https://www.rockraidersunited.com/files/dl-r434/ NOTE: The .obj format can't handle the matrix transformation data in the .msh files for buildings with dynamic elements like doors that open, so the msh2obj tool will dump this data into a .matrix file with the same name as the .obj file when it does a conversion. Don't forget that the obj2msh tool will need that .matrix file passed in as a third parameter when you go to convert the .obj back to .msh format. Edited December 31, 2021 by Slimy Slug Updated download links lol username, Fluffy Cupcake and le717 3 Link to comment Share on other sites More sharing options...
lol username Posted July 31, 2012 Share Posted July 31, 2012 Awesome. I'll certainly be doing some stuff with this. Thanks! Link to comment Share on other sites More sharing options...
lu9 Posted December 13, 2012 Share Posted December 13, 2012 one question: I extracted the BOD and BOB of the idjarandomcharactersIforgotLGI, all the models are there, though, where are the minifig Body and legs? I only find Minifig's hat, hands, head, and some weird shape that looks like a camera... Link to comment Share on other sites More sharing options...
legomoe Posted December 13, 2012 Author Share Posted December 13, 2012 one question: I extracted the BOD and BOB of the idjarandomcharactersIforgotLGI, all the models are there, though, where are the minifig Body and legs? I only find Minifig's hat, hands, head, and some weird shape that looks like a camera... I'm not exactly sure. The model data for each minifigure should be in with all the other models, but I think their 3D data might be distorted, since they're supposed to be paired with animations. So they may not be recognizable, even if you find them. Link to comment Share on other sites More sharing options...
le717 Posted January 20, 2013 Share Posted January 20, 2013 Is it possible to convert all MSH files to OBJ in one command, like V2 of your BODBOB tool? The2Banned2One's converter is built for the old converter... Link to comment Share on other sites More sharing options...
legomoe Posted January 21, 2013 Author Share Posted January 21, 2013 Is it possible to convert all MSH files to OBJ in one command, like V2 of your BODBOB tool? The2Banned2One's converter is built for the old converter... No, but you can do it with a batch script. @ECHO OFF setlocal EnableDelayedExpansion call :recurse PAUSE goto :eof :recurse SET mfile FOR /f "usebackq delims=|" %%f IN (`dir /b "*.msh"`) DO ( SET mfile=%%f ECHO Converting file %%f... msh2obj.exe %%f !mfile:.msh=.obj! ) ECHO Finished Here a link th the file as well: http://www.mediafire.com/file/v7ymf9mq9eup3nu/Msh2ObjAll.Bat Just put this batch file, along with msh2obj.exe, in the same folder as all the .msh files you want to convert and double click the batch file. Tell me if it gives you any problems! lol username, le717 and Fluffy Cupcake 3 Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted April 21, 2016 Share Posted April 21, 2016 Hate to necro, but can someone tell me what to add to the batch script above to make the files convert into a folder name "converted" relative to where the .bat file was run? I assume something on the "msh2obj.exe %%f !mfile:.msh=.obj!" part is what I need to change, but otherwise I don't know. Link to comment Share on other sites More sharing options...
grappigegovert Posted April 21, 2016 Share Posted April 21, 2016 I think it'll work if you change msh2obj.exe %%f !mfile:.msh=.obj! into msh2obj.exe %%f Converted\!mfile:.msh=.obj! Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted April 21, 2016 Share Posted April 21, 2016 Ah nope. "Cannot open X file "converted/model.obj for writing" Creating the folder manually beforehand removed the error. This should be okay, but just in case, there isn't an easy way to make it so it creates the folder beforehand itself is there? Something like this? (Not working) mkdir %~dp0\Converted\ Link to comment Share on other sites More sharing options...
RobExplorien Posted April 22, 2016 Share Posted April 22, 2016 Can't you work around it with saying msh2obj.exe %%f !mfile:.msh=.obj! mkdir _yourdir_ mv _location/file_ _yourdir_ so you just move it into the new folder after creation. Fluffy Cupcake 1 Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted April 22, 2016 Share Posted April 22, 2016 Oh, so that's how you do it. Putting just mkdir Converted on line two with nothing more or nothing less solved the problem. I think I was trying to over-complicate the folder creation process, also why is this line in a scroll bar now, ahhhhh. I suppose you COULD move it afterwards, but why not just do it on creation? It's one less step. Here is my final product code with your guy's help. I took the mkdir line to the next step and added something in so it won't say "this folder already exists!" if it does already. @ECHO OFF if not exist Converted mkdir Converted setlocal EnableDelayedExpansion call :recurse PAUSE goto :eof :recurse SET mfile FOR /f "usebackq delims=|" %%f IN (`dir /b "*.msh"`) DO ( SET mfile=%%f ECHO Converting file %%f... msh2obj.exe %%f Converted\!mfile:.msh=.obj! ) ECHO Finished Also, I was noticing something, both in this and the original code legomoe posted. At the very start when you run the batch script it says "environment variable mfile not found". Link to comment Share on other sites More sharing options...
RobExplorien Posted April 22, 2016 Share Posted April 22, 2016 1 hour ago, Xiron said: I suppose you COULD move it afterwards, but why not just do it on creation? It's one less step. I thought with 'not working' you meant that it refused to place the file in any other directory on creation, hence I gave this workaround. Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted April 22, 2016 Share Posted April 22, 2016 Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah. It all makes sense now, thanks anyway! Link to comment Share on other sites More sharing options...
grappigegovert Posted November 8, 2016 Share Posted November 8, 2016 On 22-4-2016 at 8:53 AM, Xiron said: Also, I was noticing something, both in this and the original code legomoe posted. At the very start when you run the batch script it says "environment variable mfile not found". A little late, but since you reposted this code in another thread, It might be worthwhile to say that the 'environment variable mfile not found' is caused by the 'set mfile' line. There is also some unnecessary code included in your snippet. I think it can be condensed to: @ECHO OFF if not exist Converted mkdir Converted FOR /f "delims=" %%f IN ('dir /b *.msh') DO ( ECHO Converting file %%f... msh2obj.exe %%f Converted\%%~nf.obj ) ECHO Finished pause Fluffy Cupcake 1 Link to comment Share on other sites More sharing options...
Recommended Posts