Jump to content

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


Recommended Posts

  • 2 weeks later...
  • 2 weeks later...

@Send help(to Ryan) visual flipping should be handled automatically. Actual flipping should be done using an external tool.

As for the vertex colors: go into io_object_mu/shader and you'll find a bunch of cfg files (same format as KSP's cfg files). Several of them have a ShaderNodeVertexColor node.  You can remove that, but you don't need to. What you do need to remove, however, is any link nodes that mention "Vertex Group" (all in the "from_node" values). Then reinstall your shaders.

Link to comment
Share on other sites

Sorry, I can't see that image: imgur has been flaky for me lately.

Anyway, look for nodes like this:

                link {
                    from_node = Vertex Color
                    to_node = AmbientBoost
                    from_socket = 0
                    to_socket = 2
                    is_hidden = False
                }

Note that the to_node will vary, as may the to_socket (the from_socket should be consistent). Just delete those 7 lines (in one or two places in each file that has some)

Link to comment
Share on other sites

I'm trying to get this mod:

To work in 1.10.1. When loaded into KSP the game hangs on generating drag cubes for Sputnik 1 and also for Vostok.bottom.TDU.  After asking @linuxgurugamer for his sage advice, he suggests the animation name of ModuleDeployableAntenna is wrong for Sputnik 1. He suggested I look at it in blender and directed me towards your plugin to try and fix it.

 

I downloaded Blender 2.90 and your plugin and had no problem importing the model into blender, however I could not for the life of me find where the KSP modules are tied to the models. I see where it says "KSP Modules" on the right, but it doesn't list any as installed, and the add box is empty.

 

I then tried reverting Blender back to 2.83LTS to see if maybe your plugin wasn't compatible with the updated version of blender. Now when I try to add your add-on into blender I get the following error:

crQHEuP.png

 

My questions are:

1. Should I be using 2.83LTS or 2.90?

2. What exactly am I missing to see what modules are attached to a module?

Link to comment
Share on other sites

That's a strange error. It implies something has changed since I last updated blender because it works here (or things went wrong with your install).

I guess the first thing to do is ensure you have a mu.py in your G:\Blender\2.83\scripts\addons\io_object_mu directory.

However, for your task (finding animation information), you don't actually need blender: there's a tool in the io_object_mu directory that dumps the animation information: animprop.py. Get to the command line, change directory to your io_object_mu directory and run the following:

python animprop.py model.mu

(might need python3 instead of python, and specify the path to the actual model file instead of model.mu)

Example (note, I use Linux, so things are a little different, eg / instead of \, I need to use python3...)

$ python3 animprop.py ~/ksp/KSP_linux/GameData/SurveyTransponder/Parts/Transponder/Transponder.mu 
/home/bill/ksp/KSP_linux/GameData/SurveyTransponder/Parts/Transponder/Transponder.mu
m_LocalRotation.w
m_LocalRotation.x
m_LocalRotation.y
m_LocalRotation.z
Transponder/Body
    Stabilizer_Deploy
        Stabilizer_1
            Stabilizer_1
... (lots more data)

That "Stabilizer_Deploy" is the animation name.

Link to comment
Share on other sites

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

@Concodroid I need the stack trace, not just the error message.

Traceback (most recent call last): File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\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\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 80, in import_craft_op obj = import_craft(filepath) File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\import_craft\import_craft.py", line 44, in import_craft gamedata = GameData(Preferences().GameData) File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\import_craft\gamedata.py", line 140, in init self.models = Model.Preloaded() File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\model\model.py", line 95, in Preloaded preloaded = Model(None, url) File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\model\model.py", line 106, in init obj, mu = import_mu(model, path, False, False) File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\import_mu\import_mu.py", line 199, in import_mu if not mu.read(filepath): File "C:\Users\conco\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\io_object_mu-master\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

@taniwha

Link to comment
Share on other sites

@Concodroid Hmm, first, you've definitely hit a bug, but in some code that's normally not used. It seems you have some collections whose name starts with "model:" in your blend file (maybe in your startup blend file). Cleaning those out should fix your side of the problem.

Link to comment
Share on other sites

@taniwhaYes, that's what it was!

Turns out that for whatever reason I hadn't cleared out all the little stick-y bits in whatever I was trying to import into. Looks like I skipped it, and it almost doomed me for this round of Runway Project.

Is there any way for it to automatically connect MainTex and Emission to Principled, rather than StandardShader or whatever? Would save a bit of time overall IMO.

Link to comment
Share on other sites

Hey all, first of all thanks to @taniwha for the addon, and to @nodrogj for doing a great job of summarizing the instructions in this thread!

I have one observation (maybe it's a bug?) then a few related questions:

First, when importing craft files (From KSP 1.3.1) some parts get painted with some sort of chrome-environment-mapping type shader.

Secondly, I've read some posts about "editing the materials" etc. but the Blender tutorials on editing materials in Blender do not seem to help me find the materials that are used by these parts.

Similar with the animations.  Is it possible to have some parts at one end of the animation sequence and others at the "other end" so-to-speak?  I don't even know how to search for instructions on how to figure this out!

So my final question: Does anyone have a link to somewhere that I can find a conceptual overview of how to work with Blender objects arranged in collections and instanced like this?  How to use the Blender UI to find/navigate to the "real" parts that can be properly edited, etc.?  Or a tutorial that covers such things?

Thanks so much for adding a fascinating new element to KSP!

0f5uSRS.jpg

Link to comment
Share on other sites

11 hours ago, Concodroid said:

Is there any way for it to automatically connect MainTex and Emission to Principled, rather than StandardShader or whatever? Would save a bit of time overall IMO.

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.

9 hours ago, grisby_2133 said:

First, when importing craft files (From KSP 1.3.1) some parts get painted with some sort of chrome-environment-mapping type shader.

This is the "vertex color" bug mentioned earlier in the thread.  I've more or less come up with an approach to deal with it, but haven't had time to do the work yet.

When it comes to working with objects in collections, you need to find the collections themselves. You'll find them in the mu_utils scene, so just check the blender docs for details on working with scenes (hint, top-right corner, second from the right).

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