Jump to content

[1.2-1.7] Blender (2.83+) .mu import/export addon


Recommended Posts

@panarchist: indeed there is. You will need to have python3 installed (in theory, 2 should work, but it seems to have trouble with some things). You can then get a full object hierarchy of the model by using "python hierarchy.py model.mu" (hierarchy.py is in the io_object_mu directory, along with a few other tools).

However, as that error is in mu.py, you will get the same exception :/.

I grabbed the mod and sure enough, same error, but I also found the cause: the animation path name is longer than 127 bytes and that caused my string reader to barf. I'm working on a fix.

Link to comment
Share on other sites

1 hour ago, taniwha said:

@panarchist: indeed there is. You will need to have python3 installed (in theory, 2 should work, but it seems to have trouble with some things). You can then get a full object hierarchy of the model by using "python hierarchy.py model.mu" (hierarchy.py is in the io_object_mu directory, along with a few other tools).

However, as that error is in mu.py, you will get the same exception :/.

I grabbed the mod and sure enough, same error, but I also found the cause: the animation path name is longer than 127 bytes and that caused my string reader to barf. I'm working on a fix.

Oh, awesome - and thanks for the info, that's super helpful.

Link to comment
Share on other sites

  • 3 weeks later...

@taniwha - I've got a problem with your im/exporter. I have updated old version (probably 1.0.0) to GIT version, but some models which old version had import fine, new throw errors, leaving model half-imported. To be honest, one error exists in both cases:

Spoiler

vFRFlGJ.jpg

 

but model hierarchy (stock small landing gear) with old importer looks fine:

Spoiler

oWVLpJY.jpg

but new version fails:
 

Spoiler

xdiP4zx.jpg

xgNT4t6.jpg

No animation, some parts missing.

 

Link to comment
Share on other sites

  • 4 weeks later...

I am unfamiliar with blender, only rarely have to use it to import/export.  just installed 2.79 and cannot tell if the addon is recognized or loading.  mu is not showing up in the import/export categories.

is Blender Foundation\Blender\2.79\scripts\addons\io_object_mu the correct install location?

 

edit:  disregard, but i'll leave here in case anyone else gets befuddled like me. the addon was not automatically enabled in user prefs.  a quick checkmark and is now working perfectly.

Edited by TK421d
Link to comment
Share on other sites

  • 1 month later...

Hi,

I'd like to print some of my rockets, and I just found your addon on blender, but after installing it twice, it doesn't seem to work.

Here is the error:

Lt351cf.png

I'm on Windows 10, with Blender 2.79 (also tried with Blender 2.75a), and with KSP 1.3.1.1891.

I hope I'll find some help around here :wink:

 

Link to comment
Share on other sites

Hi,

Thanks for your reply.

I just saw that your .mu importer works well to import single models. So, I'll hopefully wait for an update of the .craft importer, and in the meantime, I'll build my vessels by hand in blender, reading .craft files created with ksp and importing .mu models. I'll just need to deal with model position and collision boxes :D

 

Link to comment
Share on other sites

  • 1 month later...

A little heads-up on a new feature (update from git):

The addon now supports shader presets, and comes with default settings for the KSP shaders I know of. You do have to install the presets (open the addon's panel in user preferences and you will see an "Install KSP Shader Presets" button; click that) in order to use them, but you will then have access to those presets in the "Mu Shader" panel of the materials tab.

Also, you can set up a shader the way you like and save it as a new preset by clicking the + beside the "Shaders" dropdown. You will be prompted for a name which will be used to identify the preset. The - button deletes the selected preset (this may be a misfeature due to the way it works: feedback please).

While it is still a little tedious to set up a material for export, this should ease things greatly as all the required properties will be present with reasonable defaults: select the appropriate shader and set the properties. Previewing in blender is still rather a pain, though.

Link to comment
Share on other sites

  • 3 weeks later...
On 11/15/2017 at 6:38 PM, taniwha said:

@TK421d: ah, glad you got it working, and thank you for leaving that in (I wish more people would).

Perhaps it would be helpful to add "installation instructions" either in the README.md on the github repo, or in the OP of this thread, or both?

Took me an hour of head-scratching and googling until I got the pieces together, to wit:

  1. Clone the github repo
  2. Copy the entire folder (io_object_mu) into Blender's scripts/addons folder
  3. Start Blender
  4. Go to File ->  User Preferences... -> Add-ons tab -> Import-Export category
  5. Find "Import-Export: Mu model format (KSP)" in the list
  6. Check the checkbox next to it
  7. Click "Save User Settings"
  8. If you go to the File -> Import menu, it now has "KSP Mu" and "KSP Craft" in the list.

Seems like it would be good to surface such instructions in easy-to-find places.  :)

 

Link to comment
Share on other sites

2 hours ago, Snark said:

Seems like it would be good to surface such instructions in easy-to-find places.  :)

Thanks! Seems like people expect everyone to know this steps. This has to be in the OP.

I just want to duplicate a part and assign a new texture to it, keeping the model.

But I'm dealing with a .mu file that seems to have included the directory for it's texture. In the .cfg there are just "model = Gamedata/.../part.mu". If I include "Texture =...", nothing happens (tried only the name of the archive and full directory from Gamedata/...). If I change the folder of the .mu file, putting in the new folder the new texture with the same name, the part don't get loaded.

This program can help me with that?

Link to comment
Share on other sites

I just got import and export working for animations of most shader properties (not texture) and some light properties (intensity and color). Also, I added @Snark's instructions to the OP.

Edited by taniwha
Forgot to mention that the import/export was for animations.
Link to comment
Share on other sites

  • 2 weeks later...
7 hours ago, taniwha said:

Yes, it works for 1.4, and no, no need for Unity.

Awesome, last question. How do I specify a texture file to use for the mu export? I have got my part functioning correctly in KSP but the texture and bump map won't function. 

I have tried both dds and PNG files, I think I may not be getting an object or material reference that points at the file?

Will continue to hack away but if someone can enlighten me I would appreciate it

Link to comment
Share on other sites

@Dewar: dds or png doesn't matter: they both work.

Make sure your mesh has a material. In the materials tab down at the bottom, you'll see a "Mu Shader" panel. Select the shader in the Shaders dropdown then fill in the appropriate info in the boxes (boxes with fields you can set will have a dot in the right corner). You will probably want to name your material (especially if using TEXTURE variants).

For example, KSP/Bumped Specular will tick Textures, Colors and Float3 (reasons for the names, but both Float2 and Float3 have the same effect in KSP,). In Textures, you will find _MainTex and _BumpMap. Set the field with "gray" (_MainTex) or "bump" (_BumpMap) to the name of your texture file (without extension), and be sure to tick the box for the bump map. Colors will have _Color and _SpecColor, you probably don't need to play with those. Float3 has _Shininess.

Note that color, vector and float properties can be animated (key them as you would anything in blender, then bake your action down to an NLA strip, name your strip something appropriate). This goes for lights and loc/rot/scale as well.

Link to comment
Share on other sites

@Dewar: I had forgotten you need to install the presets. Go to blender's user preferences, addon, and find the panel for Import-Export: Mu model format (KSP) (ie, this addon's panel). Then open it at you will see an "Install KSP Shader Presets" button: click that.

Link to comment
Share on other sites

43 minutes ago, taniwha said:

@Dewar: I had forgotten you need to install the presets. Go to blender's user preferences, addon, and find the panel for Import-Export: Mu model format (KSP) (ie, this addon's panel). Then open it at you will see an "Install KSP Shader Presets" button: click that.

That may be the reason that my parts all looked patchy? 

Will experiment with that.

Thanks again for the help!

amazing addon

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...