taniwha Posted July 30, 2013 Share Posted July 30, 2013 (edited) Hello, I have been working on an addon for Blender to import and export .mu files. It is still very incomplete, but I have released it under the GNU General Public License (version 2), and it is available from github , with documentation here. NOTE: The addon is now targeted for Blender 2.83. Those requiring 2.79 support should checkout the blender2.79 branch. NOTE 2: (for Windows) Blender must not be installed in Program Files. Due to file access permissions, installing blender in Program Files messes with addons resulting in weird errors. NOTE 3: Blender won't load the plugin if the directory name has periods in it, so if the resulting directory has periods in it, you will need to rename it. NOTE 4: I haven't done an actual release for a long time, nor do I have plans to do so any time soon, so ignore the release section on github and just clone the repository. I do update the code whenever something comes up. For help with Blender in general, #blender on irc.freenode.net is generally full of experts. However, thanks to @Snark, here are some installation instructions: Clone the github repo Copy the entire folder (io_object_mu) into Blender's scripts/addons folder Start Blender Go to Edit -> Preferences... -> Add-ons. Find "Import-Export: Mu model format (KSP)" in the list Check the checkbox next to it. Clicking on the little triangle to the left will open the configuration panel for the addon. You can... Set the KSP GameData directory (point it at GameData itself, not just the KSP root directory). Required for craft import Install shader presets. Optional. These make it easier to set up materials for exported models. Install config templates (only one right now). Optional and rather advances (ask for details). Install some color palette presets. Optional for texture painting etc. Click "Save User Settings" If you go to the File -> Import menu, it now has "KSP Mu" and "KSP Craft" in the list. Working features Import .mu into blender. Meshes, materials, textures (including .mbm) and colliders supported. Many animation properties are supported (transform, light, material (not texture)) Export from blender to .mu. Same as features and limitations as import, however .mbm is not written. Unity colliders can be added via the Add menu. Updating the collider via the tool panel or the object panel works as expected (ie, visual updates). Note that other than mesh colliders, editing the mesh of the collider will have no effect. Create mesh colliders from multiple selected mesh objects. Optionally (default) "convert" the mesh to a convex hull as Unity (and thus KSP) requires part mesh colliders to be convex. Convex hull creation can be used separately as a modeling tool. KSP shaders can be created by selecting the shader type in the materials panel. The material will be built automatically any time something is changed (a little inefficient, but it works (actually, it doesn't right now)). The material setup is really just a best-effort WYSIWYG thing. Standalone (still requires python to run) command line script that lets you view and edit wheel collider parameters. Skins (bones) working for both import and export. v4 materials for import, possibly for export (not fully tested). Plans (no particular order): More animations. Bones and skins (WIP). Better IVA support (WIP?) Export is simple: select the root object, then File->Export->KSP Mu. The active object and all of its children (of supported types) will be exported to the one .mu file. Edited July 25, 2020 by taniwha Quote Link to comment Share on other sites More sharing options...
MacTee Posted July 30, 2013 Share Posted July 30, 2013 Even if I don't modeling, this is a great thing!A Im-/Exporter for blender should make things very easy for model creators! Quote Link to comment Share on other sites More sharing options...
The Deep Space Kraken Posted August 3, 2013 Share Posted August 3, 2013 How do you use this? Quote Link to comment Share on other sites More sharing options...
taniwha Posted August 3, 2013 Author Share Posted August 3, 2013 For the blender addon, you just copy the entire directory into your addons directory, enable it like any other addon (there are tuts for this on places like blendercookie.com), and then File->Import->KSP Mu. Export is not working yet.For using mu.py for creating utilities, it would probably be best to study the code and import.py.I'm sorry I can't be of more help just now. This is very much a work in progress (I announced it now only because I used it to help fix the Extraplanetary Launchpads auger), and I'm a bit busy trying to help fix bugs in the mod. Quote Link to comment Share on other sites More sharing options...
Chant778 Posted August 4, 2013 Share Posted August 4, 2013 Awesome! Works perfectly so far with the import.Have you got any plans for adapting the script for 3Ds Max/Maya? Quote Link to comment Share on other sites More sharing options...
taniwha Posted August 4, 2013 Author Share Posted August 4, 2013 No, as I use/know neither. However, as I've released the code under the GPL, you're free to do so (or find someone who can).Just as a note: I'm aware that my scripts do not read version 3 .mu files (eg, current LV-909). I'll look into that soon. Quote Link to comment Share on other sites More sharing options...
dudecon Posted August 29, 2013 Share Posted August 29, 2013 Just as a note: I'm aware that my scripts do not read version 3 .mu files (eg, current LV-909). I'll look into that soon.It seems that nearly all of the models have been "upgraded" to version 3. The only one I've been able to import is the Mk2 fuselage (I tried quite a few, but not all of them). This is such a great tool, but it doesn't seem to work for most of the KSP models... help?Here's an error that pops up when I try to import the latest "Parts\Engine\microEngine\model.mu" or "Parts\Aero\rocketNoseCone\model.mu"Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\__init__.py", line 63, in execute return import_mu.import_mu(self, context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\import_mu.py", line 167, in import_mu if not mu.read(filepath): File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 970, in read self.obj = MuObject().read(self) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 791, in read self.children.append(MuObject().read(mu)) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 809, in read self.renderer = MuRenderer().read(mu) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 552, in read self.materials = mu.read_int(num_mat, True) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 869, in read_int raise EOFErrorEOFErrorand here's another slightly different one when I try "Parts\FuelTank\mk3Fuselage\model.mu"Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\__init__.py", line 63, in execute return import_mu.import_mu(self, context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\import_mu.py", line 167, in import_mu if not mu.read(filepath): File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 970, in read self.obj = MuObject().read(self) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 791, in read self.children.append(MuObject().read(mu)) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 791, in read self.children.append(MuObject().read(mu)) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 805, in read self.collider = MuCollider(entry_type).read(mu) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 601, in read self.mesh = MuMesh().read(mu) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_object_mu-master\mu.py", line 446, in read raiseRuntimeError: No active exception to reraiseWhen I try to open "Parts\Electrical\batteryBankLarge\model.mu" it just saysUnrecognized format: 76543 3So, looks like more than one problem involved here. Looking forward to any progress, as I'd love to have use of this tool back.Thanks! Quote Link to comment Share on other sites More sharing options...
sirkut Posted August 29, 2013 Share Posted August 29, 2013 batteryBankLarge import worked for me. Make sure you update your version of blender. It wouldn't work for me when I had 2.66a but when I upgraded to 2.68a I was able to import the batteryBankLarge.This also worked for the microEngine and the rocketNoseCone.Only one that didn't work out of your set was the mk3Fuselage. Quote Link to comment Share on other sites More sharing options...
taniwha Posted August 29, 2013 Author Share Posted August 29, 2013 Those errors are actually from bones and bone related information in the .mu, not v3 stuff. I've recently pushed fixes for that (which might be why sirkut had no trouble).As for v3 .mu: as far as I can tell, that's all particles related. I haven't started working on that yet as I've been concentrating on getting import and export working for v2. Quote Link to comment Share on other sites More sharing options...
sirkut Posted August 29, 2013 Share Posted August 29, 2013 Those errors are actually from bones and bone related information in the .mu, not v3 stuff. I've recently pushed fixes for that (which might be why sirkut had no trouble).As for v3 .mu: as far as I can tell, that's all particles related. I haven't started working on that yet as I've been concentrating on getting import and export working for v2.So far you are doing a splendid job. You actually saved my butt one time when I had a hard drive crash and lost a part I was working on and all I had was a beta part mu.Odd thing is I've had a few times where I couldn't open one of my Infernal Robotics parts but later on it will work just fine. Weird! Quote Link to comment Share on other sites More sharing options...
taniwha Posted August 29, 2013 Author Share Posted August 29, 2013 That is rather weird.I'm glad my code has been of use Quote Link to comment Share on other sites More sharing options...
sirkut Posted August 30, 2013 Share Posted August 30, 2013 That is rather weird.I'm glad my code has been of use Immensely. It helps to get some dimensions correct with outside parts. If you ever need anyone to test anything I'll be more than happy to help. Quote Link to comment Share on other sites More sharing options...
Naten Posted August 30, 2013 Share Posted August 30, 2013 Have you given us access to the source code? Quote Link to comment Share on other sites More sharing options...
sirkut Posted August 30, 2013 Share Posted August 30, 2013 Have you given us access to the source code? While his original post has no inkling what the license could be, it is on his github:https://github.com/taniwha-qf/io_object_mu/blob/master/COPYING Quote Link to comment Share on other sites More sharing options...
taniwha Posted August 30, 2013 Author Share Posted August 30, 2013 Eh? It's right there in the first paragraph (for those who know what it means, I guess). Quote Link to comment Share on other sites More sharing options...
sirkut Posted August 30, 2013 Share Posted August 30, 2013 Funny. I didn't bother reading that part of your post, I immediately jumped to github to try this out when I first saw mu import. There I saw the copying file Quote Link to comment Share on other sites More sharing options...
taniwha Posted August 30, 2013 Author Share Posted August 30, 2013 heh. Too excited to read the (not so) fine print, eh? Quote Link to comment Share on other sites More sharing options...
taniwha Posted September 2, 2013 Author Share Posted September 2, 2013 Ok, a little bit of an update.I have colliders mostly working. You get nice little wire meshes showing the shapes, and a panel to configure them (wheels not fully implemented due to laziness). I've also added a sub-menu to add the various collider types, and the size/shape params can be adjusted, but currently only immediately after adding (via the usual blender method). The fields can be updated in the panel, but they don't have any visible effect.KSP shader support is mostly done: you can create and configure KSP shaders in the material panel, and it will automatically create the material nodes in an attempt to give WYSIWYG in GLSL mode (bump maps are a bit broken, I need to look into that).Exporting is getting close. Just need to transfer the shader info from blender to my internal mu object, and then I can write that to disk.After that, lots of testing and bug fixing. Massaging blender mesh data into something suitable for .mu is a slightly complicated process, so I expect some initial breakage. Quote Link to comment Share on other sites More sharing options...
sirkut Posted September 3, 2013 Share Posted September 3, 2013 Ok, a little bit of an update.I have colliders mostly working. You get nice little wire meshes showing the shapes, and a panel to configure them (wheels not fully implemented due to laziness). I've also added a sub-menu to add the various collider types, and the size/shape params can be adjusted, but currently only immediately after adding (via the usual blender method). The fields can be updated in the panel, but they don't have any visible effect.KSP shader support is mostly done: you can create and configure KSP shaders in the material panel, and it will automatically create the material nodes in an attempt to give WYSIWYG in GLSL mode (bump maps are a bit broken, I need to look into that).Exporting is getting close. Just need to transfer the shader info from blender to my internal mu object, and then I can write that to disk.After that, lots of testing and bug fixing. Massaging blender mesh data into something suitable for .mu is a slightly complicated process, so I expect some initial breakage.Oh hell yes. Thanks for updating! Quote Link to comment Share on other sites More sharing options...
skykooler Posted September 3, 2013 Share Posted September 3, 2013 Excellent work! Quote Link to comment Share on other sites More sharing options...
sumghai Posted September 3, 2013 Share Posted September 3, 2013 Way, way too cool taniwha.I've managed to import the Mk1-2 Pod into Blender 2.68a, textures and all - it has been exceptionally handy in making sure my upcoming accessories would mesh perfectly with it.As soon as the the forums' AJAX features get fixed, expect a +1 rep from me Quote Link to comment Share on other sites More sharing options...
taniwha Posted September 3, 2013 Author Share Posted September 3, 2013 I've pushed exporting (animations not supported). uv2 is not written at this stage (not sure what it's for, even: mk1pod has identical uv and uv2 maps), but re-importing the exported .mu worked . Quote Link to comment Share on other sites More sharing options...
taniwha Posted September 4, 2013 Author Share Posted September 4, 2013 I've updated the first post with the current status. I'm 30 bytes away from a re-export of the mk1 command pod being near-perfect (I expect that exact vertex order will always be a mess, but I have an idea for that, and normals and tangets... who knows?) Quote Link to comment Share on other sites More sharing options...
tajampi Posted September 14, 2013 Share Posted September 14, 2013 Amazing Takes a lot to import anything, but works! Quote Link to comment Share on other sites More sharing options...
Zeblote Posted September 14, 2013 Share Posted September 14, 2013 Now give us a tool that opens .mu files in unity to give exactly what was previously exported back! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.