Jump to content

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


Recommended Posts

  • 1 month later...

Quick note before I start: After using this addon for so many years, I have to say it's been invaluable and I literally wouldn't be able to create the stuff I do now without it. 

 

There are a few bugs with the addon, most of which can be solved fairly easily - AirplanePlus cockpits have the monoprop resource commented out incorrectly, and the importer throws an error; to fix it, simply comment out all of that bit of code, and it imports fine. Some parts, like certain landing gear (or the BDA ej200, which is a scaled jet engine) don't import correctly. Honestly, for those issues, having the importer just import what's left and skipping the offending part, rather than just throwing an error.

However the one mod I know of that absolutely refuses to import correctly, or sometimes at all, is pwings. Procedural wings import as the default blocks, and procedural panels, for whatever reason, flat-out refuse to import at all. Having functionality where pwings could be scaled correctly, and procpanels imported correctly, would be a massive boon for competitions like runway project, where pwings are a small part; or FJRT, where pwings are basically integral to the competition. In combination with @Halban's ksp -> blender vessel tracer, we could recreate a dogfight in blender to get those sweet, sweet cinematic camera angles.

Tl;DR: feature request for @taniwha: have the importer skip offending parts on import, rather than throwing an error and refusing to import it at all; and possibly add support for pwing scaling, so complicated builds, such as gigantic ships, don't have to be re-built in blender?

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
10 hours ago, kspbutitscursed said:

its not working in blender 4.1?

Pretty sure it hasn't been updated since back when blender 3 came out. So any fundamental change in 4.1 might break it.

Link to comment
Share on other sites

14 hours ago, ColdJ said:

Pretty sure it hasn't been updated since back when blender 3 came out. So any fundamental change in 4.1 might break it.

yeah its fixed now 

i downgraded to 3.9 and its now fixed lol

Link to comment
Share on other sites

When I try to import a craft file I get this error

Blender 2.83.20 windows x64

Traceback (most recent call last):
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\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\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 44, in import_craft
    gamedata = GameData(Preferences().GameData)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 146, in __init__
    self.create_db()
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 129, in create_db
    recurse_tree(self.root, self.build_db)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 36, in recurse_tree
    recurse_tree(p, func)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 36, in recurse_tree
    recurse_tree(p, func)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 36, in recurse_tree
    recurse_tree(p, func)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 38, in recurse_tree
    func(p)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 102, in build_db
    self.process_cfg(path)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 97, in process_cfg
    self.process_cfgnode(gdpath, node)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 73, in process_cfgnode
    internal = Internal(path, node)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\part.py", line 58, in __init__
    self.scale = parse_float(cfg.GetValue("scale"))
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\cfgnode\parser.py", line 121, in parse_float
    return float(string)
ValueError: could not convert string to float: '1,1,1'

location: <unknown location>:-1

bpy.ops.import_object.ksp_craft(filepath="C:\\BlenderStuff\\Blender\\abcde.craft")

Link to comment
Share on other sites

  • 1 month later...
On 4/22/2024 at 4:49 AM, Keko said:

When I try to import a craft file I get this error

Blender 2.83.20 windows x64

Traceback (most recent call last):
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\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\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 44, in import_craft
    gamedata = GameData(Preferences().GameData)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 146, in __init__
    self.create_db()
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 129, in create_db
    recurse_tree(self.root, self.build_db)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 36, in recurse_tree
    recurse_tree(p, func)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 36, in recurse_tree
    recurse_tree(p, func)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 36, in recurse_tree
    recurse_tree(p, func)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 38, in recurse_tree
    func(p)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 102, in build_db
    self.process_cfg(path)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 97, in process_cfg
    self.process_cfgnode(gdpath, node)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 73, in process_cfgnode
    internal = Internal(path, node)
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\import_craft\part.py", line 58, in __init__
    self.scale = parse_float(cfg.GetValue("scale"))
  File "C:\Users\bienc\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_object_mu-master\cfgnode\parser.py", line 121, in parse_float
    return float(string)
ValueError: could not convert string to float: '1,1,1'

location: <unknown location>:-1

bpy.ops.import_object.ksp_craft(filepath="C:\\BlenderStuff\\Blender\\abcde.craft")

Same problem here. I can't import .mu files. (Blender 4.1)

Link to comment
Share on other sites

1 hour ago, NippyFlippers said:

Same problem here. I can't import .mu files. (Blender 4.1)

The .mu plugin only works from Blender 3 to blender 3.9 in it's current state. There is no likely update unless the creator feels like putting in the effort.

So if you want to use it you will need to  go back to one of the Blenders in that range.

Link to comment
Share on other sites

Posted (edited)
13 hours ago, ColdJ said:

The .mu plugin only works from Blender 3 to blender 3.9 in it's current state. There is no likely update unless the creator feels like putting in the effort.

Gee... I'm still using 2.79c 2.93.9... :0.0:

(what? me, lost in time?)

Edited by Lisias
I decided to upgrade!! :P
Link to comment
Share on other sites

  • 3 weeks later...
1 hour ago, NippyFlippers said:

Is there a maximum number of colliders that KSP supports on a single part? I am trying to build a cargo bay, using 28 colliders, but 12 of them are missing and I cannot for the life of me figure out why.

There shouldn't be, colliders are generally simpler than meshes as they only define a border that other models shouldn't pass through. Most likely you accidentally did something but didn't realise at the time. I would just recreate the colliders, export the model while not closing it down, import it back in and compare to see if your exported one matches everything that is in the one you still have up. Also make sure after importing a .mu that you plan to edit, to highlight all it's meshes, go into Edit Mode and use Merge by Distance to remove the excess vertices that get created for unity on export. Failure to do that can end up with bloated meshes.

I find that most times things go wrong, I have missed some very small detail, that is easily fixed once you realise what you missed.

Link to comment
Share on other sites

8 hours ago, ColdJ said:

There shouldn't be, colliders are generally simpler than meshes as they only define a border that other models shouldn't pass through. Most likely you accidentally did something but didn't realise at the time. I would just recreate the colliders, export the model while not closing it down, import it back in and compare to see if your exported one matches everything that is in the one you still have up. Also make sure after importing a .mu that you plan to edit, to highlight all it's meshes, go into Edit Mode and use Merge by Distance to remove the excess vertices that get created for unity on export. Failure to do that can end up with bloated meshes.

I find that most times things go wrong, I have missed some very small detail, that is easily fixed once you realise what you missed.

Thanks, the reimport is a great tip.

Also, I found the problem. It was not with the colliders at all.

It seems that KSP is loading cached Data when being closed down and restarted. Somewhow it did not load the newly exported model with updated colliders.

Is there a way to force KSP to flush the cashe before restarting?

Link to comment
Share on other sites

2 hours ago, NippyFlippers said:

Is there a way to force KSP to flush the cashe before restarting?

It shouldn't be holding on to cached data except for saved craft files that have the setup stored in a text file for next time. Just loading from the craft save from the last time you tested will mean settings you have changed aren't applied. Always build fresh from the parts list when you are changing models and then loading to test.

Part of the reason KSP takes so long to load is because it is going through every part and config in the GameData folder and storing them fresh in RAM.

Link to comment
Share on other sites

1 hour ago, ColdJ said:

It shouldn't be holding on to cached data except for saved craft files that have the setup stored in a text file for next time. Just loading from the craft save from the last time you tested will mean settings you have changed aren't applied. Always build fresh from the parts list when you are changing models and then loading to test.

Part of the reason KSP takes so long to load is because it is going through every part and config in the GameData folder and storing them fresh in RAM.

I don't know, but the first boot up of my KSP always takes longer than successive ones. I allways assumed it is suposed to work that way.

Link to comment
Share on other sites

54 minutes ago, NippyFlippers said:

I don't know, but the first boot up of my KSP always takes longer than successive ones. I allways assumed it is suposed to work that way

No, it loads everything into RAM fresh each time. It is one of the things that annoy users with lots of mods that hate to wait 10 minutes for it to load.

Link to comment
Share on other sites

19 hours ago, NippyFlippers said:

I don't know, but the first boot up of my KSP always takes longer than successive ones. I allways assumed it is suposed to work that way.

KSP RAM management is terrible, especially the garbage collection part. Nothing is supposed to stay in the RAM as you close KSP.  But sometimes it does. Some glitches are impossible to get rid of without rebooting the PC and usually these glitches appear after you restart KSP several times.

Link to comment
Share on other sites

10 hours ago, Manul said:

Nothing is supposed to stay in the RAM as you close KSP.  But sometimes it does. Some glitches are impossible to get rid of without rebooting the PC and usually these glitches appear after you restart KSP several times.

This is not KSP fault. This is a O.S. and perhaps graphics drivers (or both) fault.

On older versions of MacOS even browsers used to screw up the VRAM usage leading the system to a crash (absolutely pathetic).

KSP have a lot of problems, but not everything it's its fault.

Edited by Lisias
Kraken damned auto-correctors!
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Working now great with BforArtists 4.1+

With Blender 4.2 also

I was made new branch so importing all parts working great.

We have a one bug still - some parts don't load correctly animations becouse of missing armatore and armature_obj, o was add just exception to load a model anyway but still some animations are broken.

If someone know how to fix that it will be a great help

Link to comment
Share on other sites

Trying to import .craft files with Blender 3.0.1 and have run into an error I can't seem to figure out.

I get this error:

Spoiler

Python: Traceback (most recent call last):
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\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\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\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\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_craft\part.py", line 63, in get_model
    self.model = compile_model(self.db, self.path, "part", self.name,
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\model\model.py", line 48, in compile_model
    mdl = db.model(submodelname)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 158, in model
    self.models = Model(path, url)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\model\model.py", line 106, in __init__
    obj, mu = import_mu(model, path, False, False)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 206, in import_mu
    return process_mu(mu, os.path.dirname(filepath)), mu
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 193, in process_mu
    return create_object(mu, mu.obj, None)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 159, in create_object
    create_object(mu, child, obj)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 159, in create_object
    create_object(mu, child, obj)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 92, in create_object
    data = type_handlers[type(component)](mu, muobj, component, xform.name)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\mesh.py", line 93, in create_mesh_component
    mesh = create_mesh (mu, mumesh, name)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\mesh.py", line 79, in create_mesh
    create_colors(mu, mumesh.colors, mesh)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\mesh.py", line 56, in create_colors
    if not mesh.color_attributes:
AttributeError: 'Mesh' object has no attribute 'color_attributes'

location: <unknown location>:-1

 

Had the same error in a previous version of blender (I don't remember the version number though)

Edited by Lifeonhaumea
Removed a random link that looped back to the forum... not sure how that got there
Link to comment
Share on other sites

On 8/1/2024 at 7:35 PM, Lifeonhaumea said:

Trying to import .craft files with Blender 3.0.1 and have run into an error I can't seem to figure out.

I get this error:

  Hide contents

Python: Traceback (most recent call last):
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\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\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 80, in import_craft_op
    obj = import_craft(filepath)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\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\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_craft\part.py", line 63, in get_model
    self.model = compile_model(self.db, self.path, "part", self.name,
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\model\model.py", line 48, in compile_model
    mdl = db.model(submodelname)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 158, in model
    self.models = Model(path, url)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\model\model.py", line 106, in __init__
    obj, mu = import_mu(model, path, False, False)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 206, in import_mu
    return process_mu(mu, os.path.dirname(filepath)), mu
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 193, in process_mu
    return create_object(mu, mu.obj, None)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 159, in create_object
    create_object(mu, child, obj)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 159, in create_object
    create_object(mu, child, obj)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 92, in create_object
    data = type_handlers[type(component)](mu, muobj, component, xform.name)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\mesh.py", line 93, in create_mesh_component
    mesh = create_mesh (mu, mumesh, name)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\mesh.py", line 79, in create_mesh
    create_colors(mu, mumesh.colors, mesh)
  File "C:\Users\Rankine\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\io_object_mu-master\import_mu\mesh.py", line 56, in create_colors
    if not mesh.color_attributes:
AttributeError: 'Mesh' object has no attribute 'color_attributes'

location: <unknown location>:-1

 

Had the same error in a previous version of blender (I don't remember the version number though)

I'm having the same issue on mac

Link to comment
Share on other sites

On 8/2/2024 at 3:35 AM, Lifeonhaumea said:

I get this error:

 

55 minutes ago, Pauver said:

I'm having the same issue on mac

Generally the very last line gives you the best clue.

At a guess, if you are using the latest version of the plugin with a blender lower than 3.5 then it is not truly compatible. The update that allows the texture to be seen without the trick of detatching the Vertex colour first seems to not work with earlier versions. I generally work in BforArtists 3.13 using a version of the plugin from 2022. When I downloaded the latest I had to get a newer version (3.58) to have it work, I also have a 4.1 that it works in also. I have all 3 versions and only really use the newer ones so I can get prop co-ordinates in a log that I can copy across. The new version also doesn't seem to let prop textures to show up..

So anyway your last line says:  AttributeError: 'Mesh' object has no attribute 'color_attributes'

 

Link to comment
Share on other sites

  • 1 month later...

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