Jump to content

KSPBlender - Blender Addon for importing .craft files (now with complete mod support!)


Dasoccerguy

Recommended Posts

I think I know what I'm going to be doing in my free time this weekend...if I have enough free time lol. Now we just need full color models of Kerbin, and the rest. Well...the Mun shouldn't be too hard lol.

Link to comment
Share on other sites

Alright, so I decided to give this a try. I am so new to blender that I could probably accidentally blow up the planet before I actually created anything with this thing. That being said, I followed the instructions and was greeted with (upon the first "run script" stage) an error that the script had failed. It says to look at the console for more information, but I can see no console anywhere. Fail?
Go to Window > Toggle System Console. There are actually two consoles... sorry. Let me know what it says!

I'm not exactly new to Blender, but I am having the same problem. Though I am running on linux, so thought it might be a folder issue, but changed all the \\ to // with out any luck. In linux to get the console you have to run blender from the command line. In the terminal, change to the folder your blender is in and then run ./blender (worked for me anyway). Below is the error it is giving (removed the folders that show my username/home folder from the error list below):

Traceback (most recent call last):

File "kspblender-master/demo/kspblenderdemo.blend/ksparser.py", line 1477, in <module>

File "kspblender-master/demo/kspblenderdemo.blend/ksparser.py", line 1446, in main

File "kspblender-master/demo/kspblenderdemo.blend/ksparser.py", line 367, in __init__

File "kspblender-master/demo/kspblenderdemo.blend/ksparser.py", line 380, in parse_file

FileNotFoundError: [Errno 2] No such file or directory: 'MunBase1.craft'

Error: Python script fail, look in the console for now...

Link to comment
Share on other sites

Alright, so I decided to give this a try. I am so new to blender that I could probably accidentally blow up the planet before I actually created anything with this thing. That being said, I followed the instructions and was greeted with (upon the first "run script" stage) an error that the script had failed. It says to look at the console for more information, but I can see no console anywhere. Fail?

Did you put the craft file into the right folder?

Link to comment
Share on other sites

Right yes, forgot to mention, I did the craft file in the same folder with the kspblenderdemo.blend also changed the file name to all lower case with the same result. It may be something pretty obvious, that I'll go "oh, duuh". :)

Link to comment
Share on other sites

Right yes, forgot to mention, I did the craft file in the same folder with the kspblenderdemo.blend also changed the file name to all lower case with the same result. It may be something pretty obvious, that I'll go "oh, duuh". :)

Dose the craft have mods? Also is it exactly the same in the script as on the file? Also does it end in .craft?

Link to comment
Share on other sites

Hmmm, not sure on the mod part, I'll have to look. I did make sure to have the exact file name in the script, including matching case.

Update: Tried with Kerbal X.craft and it also says file not found.

Edited by Sma
Link to comment
Share on other sites

I was just getting ready to post some more errors I was getting, when it dawned on me...After restarting Blender, the addon settings were reverted. After re-enabling it, everything seems to be fine. :D

To get it to work, for linux you have to change the \\ to /, although I did make one of them double //. Here are some examples (your mileage may differ):

kspexedirectory = "/home/userfolder/Desktop/Untitled Folder/Link to Kerbal Space Program" #Wherever KSP is

os.chdir(bpy.path.abspath("//"))

partdir['mk1pod'] = ["/GameData/Squad/Parts/Command/mk1pod/model.mu","pod"] #repeat this for all the other parts in the dictionary

That last one, or all of it really, I used find/replace to replace them all, then just changed the kspexedirectory one to single's, and fixed the ascii rocket at the very bottom of the script.

Here is a render of a random craft I made. The only thing missing is the kethane drills. They successfully imported, but were REALLY big, even though I added a "right_scale" for it. Still it's pretty cool. I have yet to try to deploy anything though.

munbase1.png

I tried a craft that was made by me, which has mods, and causes an error, but I'm going to try adding definitions for those parts and see how it goes.

Edited by Sma
Added image
Link to comment
Share on other sites

So how do you get the animations to work?

Brian, do you mean 'work' as in play the animation, or toggle the position of the parts? Hopefully the second script I put in the Blender file (the K menu) should handle toggling the parts. As for playing it, it gets a bit messy, but you'll have to play with the NLA stuff and keyframing. The internet will do a better job of explaining that stuff than I can :D

Link to comment
Share on other sites

So, Im trying to add parts from a mod to the importer, and its getting hung up on one part... is there a log I can post to get help with this?

This is what I added to mine to get it to work:

    # Kethane
partdir['kethane.smallDrill'] = ["/GameData/Kethane/Parts/kethane_smallDrill/model.mu","utility"]
partdir['kethane.1m.converter'] = ["/GameData/Kethane/Parts/kethane_1m_converter/model.mu","utility"]
partdir['kethane.tank2mSmall'] = ["/GameData/Kethane/Parts/kethane_tank2mSmall/model.mu","utility"]

I just used the name of the "error" thing to find the part name to reference.

Though, as I mentioned above the smallDrill imports REALLY big, even after I added:

right_scale['kethane.smallDrill'] = mathutils.Vector((1.25,1.25,1.25))
right_scale['kethane.1m.converter'] = mathutils.Vector((1.25,1.25,1.25))
right_scale['kethane.tank2mSmall'] = mathutils.Vector((1.25,1.25,1.25))

Haven't looked through the code for other size things yet.

Link to comment
Share on other sites

This is what I added to mine to get it to work:

    # Kethane
partdir['kethane.smallDrill'] = ["/GameData/Kethane/Parts/kethane_smallDrill/model.mu","utility"]
partdir['kethane.1m.converter'] = ["/GameData/Kethane/Parts/kethane_1m_converter/model.mu","utility"]
partdir['kethane.tank2mSmall'] = ["/GameData/Kethane/Parts/kethane_tank2mSmall/model.mu","utility"]

Ive done that, but its erroring out on actually importing the part. And it seems like quite a longish error... but I cant find where (if at all) Blender outputs its console log...

Link to comment
Share on other sites

This is what I added to mine to get it to work:

    # Kethane
partdir['kethane.smallDrill'] = ["/GameData/Kethane/Parts/kethane_smallDrill/model.mu","utility"]
partdir['kethane.1m.converter'] = ["/GameData/Kethane/Parts/kethane_1m_converter/model.mu","utility"]
partdir['kethane.tank2mSmall'] = ["/GameData/Kethane/Parts/kethane_tank2mSmall/model.mu","utility"]

I just used the name of the "error" thing to find the part name to reference.

Though, as I mentioned above the smallDrill imports REALLY big, even after I added:

right_scale['kethane.smallDrill'] = mathutils.Vector((1.25,1.25,1.25))
right_scale['kethane.1m.converter'] = mathutils.Vector((1.25,1.25,1.25))
right_scale['kethane.tank2mSmall'] = mathutils.Vector((1.25,1.25,1.25))

Haven't looked through the code for other size things yet.

Awesome! If it's too big, then what you did with the right_scale would make it worse. Those are relative scale, not absolute. You probably need to do like .1,.1,.1 rather than 1.25. That part exists because some of the parts from earlier in the game import too small.

If you get it all to work, could you send me the #Kethane part you've done so I can incorporate it into the master addon?

Link to comment
Share on other sites

Dang it, Keep getting Python Script fail, look in the console window. Followed all the steps using a stock Kerbal X craft. any help?

Go to Window -> Toggle System Console and tell me what it says. That's the secret console that actually shows useful stuff. :cool:

Link to comment
Share on other sites

Thanks, just read earlier in the forum how to do that: Edit: BTW, only messed around in Blender for small stuff in the past- What you are trying/doing- you are Now a God, so Ray, if someone asks if you are a God,

you have your answer now kind sir! Edit 2: here's the rest of the error

hT5pv6J.jpg

C3jsohE.jpg

Edited by j-tk
Link to comment
Share on other sites

Awesome! If it's too big, then what you did with the right_scale would make it worse. Those are relative scale, not absolute. You probably need to do like .1,.1,.1 rather than 1.25. That part exists because some of the parts from earlier in the game import too small.

If you get it all to work, could you send me the #Kethane part you've done so I can incorporate it into the master addon?

Sure, not a problem, if someone doesn't beat me to it lol. So far I've only got those three parts added, as they are the ones I had in that one craft file. I might also do some of the other mods I have as well.

One issue (I guess), I had the 1x6 solar panels on my craft, and the panels seemed to be positioned outside of the main solar panel model, plus there appear to be only two panels. Maybe the others are hidden inside I guess, I'll have to check that.

- - - Updated - - -

So, i'm very comfused with blender :P I'm trying to figure out how to make my shuttle one part, but i have no idea what i'm doing. I need to boolean join the parts, but there's 1200 of them and i have no idea how to just mass-select all of them, let alone make the boolean join occur. Also, to make a model i would need to turn the hollow shuttle into a solid piece, but it's made out of wing parts and i don't know how a 3d printer would handle this.

Sorry for derailing the thread a bit but I really love your program, I want to take it to the end of the logical path I'm on :)

I don't know if this has been answered yet (just going through page by page and responding as i find something I can "help" with. What you can do is, in blender push the B key, which lets you draw a rectangle around the needed parts, then group all the parts. I don't remember how you do that off hand (it's been a while since I've used blender unfortunatly), but google/youtube is your friend. :)

Link to comment
Share on other sites

I don't know if this has been answered yet (just going through page by page and responding as i find something I can "help" with. What you can do is, in blender push the B key, which lets you draw a rectangle around the needed parts, then group all the parts. I don't remember how you do that off hand (it's been a while since I've used blender unfortunatly), but google/youtube is your friend. :)

Yeah, i found it :D thanks tho.

Link to comment
Share on other sites

Awesome! If it's too big, then what you did with the right_scale would make it worse. Those are relative scale, not absolute. You probably need to do like .1,.1,.1 rather than 1.25. That part exists because some of the parts from earlier in the game import too small.

If you get it all to work, could you send me the #Kethane part you've done so I can incorporate it into the master addon?

I've managed to get most of the parts to load into blender, at what seems to be the correct scale, but for some reason the large drill, and the 1m convertor do not appear. It shows that they are being imported in the console though. Also the heatsink for the 2m converter appear below where everything else is imported, and usually much bigger than the part its self. Here is a render of what I have so far. Also some of the orgins appear to be off. YOu can sort of see that the largest tank there is sort of hovering above the truss.

blender_KethaneParts1.png

I'll post the part dictionary for these later if you need. For the scale I've been using what is in each parts cfg and that seems to work, at least for the radial drill, and the highgain (the smaller) sensor.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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