Jump to content

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


Recommended Posts

The message and colliders/nodes being the only things in your model are unrelated.

First the message: your mesh as N-gons. There are two recommended fixes for this:

  1. Find the N-gons and convert to quads or triangles (depends on edge count)
  2. Add a Triangulate modifier to the offending mesh object (name is in the message, so Body)

1 is generally better modeling, but if it's something like a cylinder end cap, or you've done a lot of non-destructive modeling, 2 is far more convenient and more importantly preserves any non-destructive workflow.

As for the contents of your model: make sure you have the root object selected when you export: the export button/menu option uses the currently selected object as the root of your model and exports that and all child objects. It does not go up the hierarchy to find the actual root. This is by design as it gives more flexibility. If you want a little more convenience, take a look at mass-export.py in the addon's directory (instructions are in the file).

Link to comment
Share on other sites

  • 2 weeks later...
On 11/25/2020 at 2:03 AM, taniwha said:

Why would you do that? StandardShader has Principled inside it (select it and hit tab).

However, if any of the materials are not to your liking, it's quite possible to create your own: simply create the material node setup, export it (there's a button in the mu material properties), then put your new material (a cfg file) into io_object_mu/shader. in combination with setting up a preset, it's possible to support custom shaders.

I must be missing some instruction somewhere, but...

Iyy3Kvj.png

nsPLpfx.png

I've been taking part in Scott Manley's Runway project and I'm using your tools for KSP renders, and the only way I could get it to properly display materials was with the above method

Edited by Concodroid
Link to comment
Share on other sites

4 hours ago, Concodroid said:

I must be missing some instruction somewhere, but...

The only thing you're missing is all the preceding posts saying that's the current solution (without going in and editing the ahader cfg files).

Link to comment
Share on other sites

  • 2 weeks later...
On 12/29/2020 at 10:47 AM, Frostydog1793 said:

I cant seem to export it as an STL file. When I do it just becomes a pile of non-connected parts clipping inside of each other. Image here: My Best KSP Rocket Yet! - Imgur

I imported the craft, hit "make instances real", deleted whatever parts were too fiddly, and highlighted the entire craft and exported it as an stl.

Link to comment
Share on other sites

  • 2 weeks later...

Please can someone help me?

I have ksp blender and this addon and whenever I try to import a craft I get a FileNotDoundError: [WinError3] The system cannot find the path specified: ' '

I've been looking for hours on how to fix it but I can't seem to getit to work

Link to comment
Share on other sites

@UltraGeekIt's mentioned several times throughout this thread but your problem is most likely that you have not set your KSP GameData path in blender via the options panel where you enabled the addon (you'll have to open the panel as it is collapsed by default).

Link to comment
Share on other sites

On 1/12/2021 at 2:13 AM, taniwha said:

@UltraGeekIt's mentioned several times throughout this thread but your problem is most likely that you have not set your KSP GameData path in blender via the options panel where you enabled the addon (you'll have to open the panel as it is collapsed by default).

thx now I feel kinda embaraced for missing that, btw great job with the addon

Edit: now I'm getting this error

Python: Traceback (most recent call last):
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 106, in execute
    return import_craft_op(self, context, **keywords)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 60, in import_craft
    part = gamedata.parts[pname].get_model()
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu-master\import_craft\part.py", line 64, in get_model
    self.cfg, loaded_parts_collection())
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu-master\model\model.py", line 49, in compile_model
    obj = mdl.instantiate(f"{name}:submodel", position, rotation, scale)
AttributeError: 'NoneType' object has no attribute 'instantiate'

location: <unknown location>:-1

Edited by UltraGeek
Link to comment
Share on other sites

@UltraGeek Unfortunately, there aren't any clues in there to help find the problem part (not your fault, python's),

After looking at the code in the area suggested by the exception and doing a quick test on my system, I suspect that either the model referenced by the MODEL node is missing, or it has the wrong case: while windows is case-insensitive, linux (what I use all the time) is not, and nor is the database.

Link to comment
Share on other sites

I ran into an other issue(the last one was caused by me not following the install guide and setting the game's folder not the gamedata folder)

 

Python: Traceback (most recent call last):
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\import_craft\import_craft.py", line 106, in execute
    return import_craft_op(self, context, **keywords)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\import_craft\import_craft.py", line 44, in import_craft
    gamedata = GameData(Preferences().GameData)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\import_craft\gamedata.py", line 140, in __init__
    self.models = Model.Preloaded()
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\model\model.py", line 95, in Preloaded
    preloaded = Model(None, url)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\model\model.py", line 106, in __init__
    obj, mu = import_mu(model, path, False, False)
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\import_mu\import_mu.py", line 199, in import_mu
    if not mu.read(filepath):
  File "C:\Users\HunKr\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_object_mu\mu.py", line 1181, in read
    self.file = open(filepath, "rb")
TypeError: expected str, bytes or os.PathLike object, not NoneType

location: <unknown location>:-1

I've seen that someone has had this issue and they've posted what they did to fix it but it's not too clear what they did to fix it.

Edited by UltraGeek
Link to comment
Share on other sites

  • 1 month later...

Hi, I'm trying to use Blender to rotate an imported part, and the rotation doesn't seem to save. When I export the rotated part and import it again, it again gets the initial orientation

UPD:

The issue was with animation, it reset the whole model back. Had to delete it and make a new animation for new orientation

Edited by desert
Link to comment
Share on other sites

Hi. I'm trying to Export a part and I'm getting an error message.  I'm using blender 2.91.

 

Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\operators.py", line 81, in execute
    return export_mu(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\operators.py", line 34, in export_mu
    mu = export.export_object (context.active_object, filepath)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 173, in export_object
    mu.obj = make_obj(mu, obj, "")
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 116, in make_obj
    return make_obj_core(mu, obj, path, muobj)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 105, in make_obj_core
    child = make_obj(mu, o, path)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 116, in make_obj
    return make_obj_core(mu, obj, path, muobj)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 105, in make_obj_core
    child = make_obj(mu, o, path)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 116, in make_obj
    return make_obj_core(mu, obj, path, muobj)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 105, in make_obj_core
    child = make_obj(mu, o, path)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 116, in make_obj
    return make_obj_core(mu, obj, path, muobj)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 105, in make_obj_core
    child = make_obj(mu, o, path)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 116, in make_obj
    return make_obj_core(mu, obj, path, muobj)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\export.py", line 84, in make_obj_core
    muobj = type_handlers[type(obj.data)](obj, muobj, mu)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\mesh.py", line 316, in handle_mesh
    muobj.shared_mesh = make_mesh(mu, obj)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\mesh.py", line 234, in make_mesh
    mumesh = make_mumesh(mesh, submeshes, vertex_data, vertex_map, num_verts)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_object_mu\export_mu\mesh.py", line 204, in make_mumesh
    if tangents[0] != None:
IndexError: list index out of range

location: <unknown location>:-1

Link to comment
Share on other sites

@taniwha

I've been trying to load a craft file into Blender using your plugin.  For tests, I used KerbalX from KSP 1.10.1.  It loads, but is then totally uneditable.  The parachute is there, but it's just one big mass.  I'm trying to see if I can get an STL file from Blender to run through a 3d printer.

Any ideas?

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

I have some trouble using this addon.

I'm running the latest version of Blender, as I just updated it before installing the addon (from github).

Here's what I get when trying to import a .craft file :

bpy.ops.import_object.ksp_craft(filepath="C:\\Users\\Hugo\\Desktop\\_Geost__1.craft")

bpy.ops.outliner.item_activate(extend=False, deselect_all=True)

bpy.ops.outliner.delete(hierarchy=True)

bpy.ops.outliner.item_activate(extend=False, deselect_all=True)


Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_object_mu\import_craft\import_craft.py", line 106, in execute
    return import_craft_op(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_object_mu\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_object_mu\import_craft\import_craft.py", line 44, in import_craft
    gamedata = GameData(Preferences().GameData)
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_object_mu\import_craft\gamedata.py", line 146, in __init__
    self.create_db()
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_object_mu\import_craft\gamedata.py", line 129, in create_db
    recurse_tree(self.root, self.build_db)
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_object_mu\import_craft\gamedata.py", line 29, in recurse_tree
    files = os.listdir(path)
FileNotFoundError: [WinError 3] Le chemin daccès spécifié est introuvable: ''

location: <unknown location>:-1

Thanks in advance for your help.

Hugo.

 

Link to comment
Share on other sites

1 hour ago, Hugo737 said:

I have some trouble using this addon.

I'm running the latest version of Blender, as I just updated it before installing the addon (from github).

Here's what I get when trying to import a .craft file :

Did you specify the GameData directory in the settings for the plugin?

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...