Jump to content

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


Dasoccerguy

Recommended Posts

So how exactly can we 3D print them or put those up on Sketchfab? I save an .obj file and upload it, but it only shows the mesh without textures. Can you please give some insight on this?

Getting them into sketchfab can be a little tricky from what I recall. I've only put a few small things up on Sketchfab with a free account. There were a few good tutorials on how to do it that I found on google, but it's been a while so I don't have the links handy.

As for 3d printing....https://eucl3d.com/ksp/ they will do it for you, though it costs a bit.

Edited by Sma
Link to comment
Share on other sites

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

Was looking for both, but mostly the first.

Link to comment
Share on other sites

Hey i have a question - if I put a ship in, can i run the program again in the same save and load another differnt ship in too? I just realized I can finally do my three-dreks next to each other picture in blender :D

Link to comment
Share on other sites

Hey i have a question - if I put a ship in, can i run the program again in the same save and load another differnt ship in too? I just realized I can finally do my three-dreks next to each other picture in blender :D

Yeah, I did that a few times, not on purpose. Though, you might want to move the first ship out of the way first, as they all import to the same origin I believe.

Link to comment
Share on other sites

Yeah, I did that a few times, not on purpose. Though, you might want to move the first ship out of the way first, as they all import to the same origin I believe.

Ok that's great! Will do.

Link to comment
Share on other sites

It's probably my fault but when I click the upper run script it says the script had failed and to check the console.

EDIT:

PTV-Broadsword ready for takeoff

98 parts found...

----------------------------------------------------

Importing probeStackSmall as probeStackSmall_4294715156
Traceback (most recent call last):
File "C:\Users\kylew_000\Downloads\kspblender-master\demo\kspblenderdemo.blen
\custommenu.py", line 1, in <module>
File "C:\Users\kylew_000\Downloads\kspblender-master\demo\kspblenderdemo.blen
\ksparser.py", line 1477, in <module>
File "C:\Users\kylew_000\Downloads\kspblender-master\demo\kspblenderdemo.blen
\ksparser.py", line 1468, in main
File "C:\Users\kylew_000\Downloads\kspblender-master\demo\kspblenderdemo.blen
\ksparser.py", line 661, in import_parts
File "C:\Program Files\Blender Foundation\Blender\2.72\scripts\modules\bpy\op
.py", line 188, in __call__
ret = op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.import_object.ksp_mu" error, could no
be found
Error: Python script fail, look in the console for now...

It looks to me like you didn't get the .mu importer where it needs to be, or maybe you did and didn't activate it within the User Preferences. I can elaborate more if you need it.

Link to comment
Share on other sites

I managed to get the kethane heavyDrill imported, but what I did was set the drill to open in the VAB and saved it like that, and imported the craft file like normal, except when it gets imported it's closed and not opened. Also, I'm not sure how to deploy anything. I checked in the user settings and I don't have an option listed for the custom menu. Maybe because I'm on linux, that or I missed a step (or maybe i should check to see i have the newest script....hmmm).

heavyDrill.png

Oh, also tried putting the 1m converter in again but it doesn't show up still.

Link to comment
Share on other sites

I managed to get the kethane heavyDrill imported, but what I did was set the drill to open in the VAB and saved it like that, and imported the craft file like normal, except when it gets imported it's closed and not opened. Also, I'm not sure how to deploy anything. I checked in the user settings and I don't have an option listed for the custom menu. Maybe because I'm on linux, that or I missed a step (or maybe i should check to see i have the newest script....hmmm).

http://bowencustomcreations.com/kspPics/heavyDrill.png

Oh, also tried putting the 1m converter in again but it doesn't show up still.

I'll give the kethane stuff a shot sometime soon. It's about time I start adding mod parts in...

Also, I'm releasing a big update literally right now, so look for a new post and try it out.

Link to comment
Share on other sites

Update 2: Being as that I'm on linux, I had to change this

kspdirfile = open(dir+'\\kspdir.txt')

to this

kspdirfile = open(dir+'/kspdir.txt')

which introduced new errors


Kerbal 2 ready for takeoff


17 parts found...
Failed to load Mark1-2Pod... Probably an unsupported mod. Let me know what part it was!


Traceback (most recent call last):
File "/home/sma/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/addons/io_kspblender-master/__init__.py", line 59, in execute
return import_craft.import_craft(self,context,**keywords)
File "/home/sma/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/addons/io_kspblender-master/import_craft.py", line 58, in import_craft
craft = import_parts(filepath)
File "/home/sma/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/addons/io_kspblender-master/import_craft.py", line 248, in import_parts
scn.objects.active = bpy.data.objects[part.part]
KeyError: 'bpy_prop_collection[key]: key "Mark1-2Pod_4293084140" not found'


location: <unknown location>:-1


location: <unknown location>:-1

Similar to errors I was getting when I first started with the 2month old version...the other day lol

Old reply below this

Just noticed the version of the importer i was using was about 2 months old. lol. downloaded the new one (it said 2 hours ago at the original time of this post) but trying to figure it out since it's different :) I was getting use to the manually editing code thing now I gotta figure out how to load my craft file, after i figure out the "connect failed: No such file or directory" after starting blender.

Update: Duh....look in the file menu under import AFTER enabling the new addon. :) Though I am getting this set of errors now (I'm guessing maybe because of the connect failed when starting blender):

Traceback (most recent call last):  File "/home/sma/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/addons/io_kspblender-master/__init__.py", line 59, in execute
return import_craft.import_craft(self,context,**keywords)
File "/home/sma/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/addons/io_kspblender-master/import_craft.py", line 55, in import_craft
rightscale = right_scale.make()
File "/home/sma/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/addons/io_kspblender-master/right_scale.py", line 51, in make
right_scale['kethane.tank1mStandard'] = mathutils.Vector((0.0125,0.0125,0.0125))
NameError: name 'mathutils' is not defined


location: <unknown location>:-1


location: <unknown location>:-1

Edited by Sma
Added new traceback info
Link to comment
Share on other sites

This just keeps getting better and better..... I mean seriously! I'm having waaaay to much fun with your Blender addon. Thanks a metric ton for your work on this one! If anything this is spurring me to learn more about Blender. Next comes digging out that animation information I see in the animated objects so I'm not having to manually key frame everything.

Also a big thanks to you all who are getting those mods added to this addon.

Link to comment
Share on other sites

I really want to try this out, but I think the problem is something with the directory naming? I'm using Mac OSX so, does this even work for my operating system.

Here's the message I get when I try to import a craft:

fNzocRO.png

Please help. I really want to try this out. I installed the mu thing, and your addon. Enabled both, the only place I messed up is in the kspdir.txt naming

Link to comment
Share on other sites

I really want to try this out, but I think the problem is something with the directory naming? I'm using Mac OSX so, does this even work for my operating system.

Here's the message I get when I try to import a craft:

http://i.imgur.com/fNzocRO.png

Please help. I really want to try this out. I installed the mu thing, and your addon. Enabled both, the only place I messed up is in the kspdir.txt naming

Check out what I mentioned above. Mac and linux file systems are similar. It's mainly just changing tHe slashes from \\ to / (double not really needed with Linux apparently, as the double slash is used for es ape purposes I believe).

Edited by Sma
Link to comment
Share on other sites

Firstly, great plugin! Here is my most detailed render yet:

Fs132bG.png

For some reason the Mk1 cockpit ladders aren't rendering, or is it just retractable ladder remains that cause issues ?

Also, how do you export the model together with textures so it shows up properly on Sketchfab?

All i get is a model without textures, can you provide a detailed tutorial and what Blender settings we need?

Also, where can we get good hdri's for backgrounds? Do you know any good repositories?

Link to comment
Share on other sites

Also, how do you export the model together with textures so it shows up properly on Sketchfab?

All i get is a model without textures, can you provide a detailed tutorial and what Blender settings we need?

I was going to look into this, but I hadn't noticed that apparently my blender files that I've done so far from KSP are over 100mb, one is almost 500mb, and I can't upload that much with a free account LOL

Also, where can we get good hdri's for backgrounds? Do you know any good repositories?

Not entirely sure, but you can check out blender guru (on facebook and online). He might have a few HDRI's from some of the classes he does online. Usually you have to sign up to get them, but every now and then he releases some for free.

Also for those of you having trouble using blender, you may want to check out the blender guru youtube channel. There are a lot of good tutorials there with a lot of neat tips and ideas.

Oh, also for those that want their flags here is a little graphic I put together real quick that might help:

flagfix1.png

  1. Right click on the flag until it is highlighted.
  2. Make sure you are on the texture tab.
  3. Expand the Surface menu if Necessary.
  4. Click the open file button and navigate to where your flag image is stored. Your flag should now be loaded.

Edited by Sma
Link to comment
Share on other sites

Ok, I've retried this. I renamed some files and changed some text, and ended up with this:

http://i.imgur.com/cV3PTJg.png

Sorry about the Mar/Linux support! It's hard to develop for an OS I don't have ;.;.

It looks to me like there's still something wrong with the 'dir' variable in there. If you're using forward slashes, it only needs to be single slashes. Perhaps there's a trailing slash on 'dir' that screws things up because there's already one in '/kspdir.txt.' I need to figure out a better way to make this cross-platform...

Link to comment
Share on other sites

Doing a little bit of debugging (assuming I was doing it right), I found the folder path that it's trying to use in my case, is

/home/sma/Desktop/Untitled Folder/Link to Kerbal Space Program

/GameData/Squad/Parts/Command/Mk1-2Pod/model.mu


It seems it's inserting a carriage return (\n) or space maybe. Although when I pasted it in here, it was right, but pasting it in a text editor, the KSP directory is on one line, and the gamedata is on another, and if i paste it to the address bar in my browser it puts a space between the two.

This is what i used to get the value of the variable it is using. This is for my error that says it can't find the Mark1-2Pod

print(ksp+partdir[part.partName][0])

- - - Updated - - -

Sorry about the Mar/Linux support! It's hard to develop for an OS I don't have ;.;.

It looks to me like there's still something wrong with the 'dir' variable in there. If you're using forward slashes, it only needs to be single slashes. Perhaps there's a trailing slash on 'dir' that screws things up because there's already one in '/kspdir.txt.' I need to figure out a better way to make this cross-platform...

Lol, yeah I think you are right, though so far I haven't been able to crack it on this version. I was able to make it work on the 2 month old version though. It can be pretty tough I imagine. I'll have to play around with it a bit more later.

Thought I'd share the error in screenshot form...

Screenshot%20from%202015-03-01%2016:29:52.png

And a section of code I'm using to get that debug info:

def import_parts(filepath):    dir = os.path.dirname(__file__)
partdir = part_dir.make()
rightscale = right_scale.make()
kspdirfile = open(dir+'/kspdir.txt')
ksp = kspdirfile.read()
[B] print ("test")[/B]
[B] print (dir)
print ("Test1.5")
print (kspdirfile)
print ("test2")
print (ksp)[/B]
[B] print ("test2")[/B]

for obj in bpy.context.scene.objects:
obj.select = False


craft = kspcraft(filepath)


print(craft.ship + ' ready for takeoff\n')
print(str(craft.num_parts()) + ' parts found...')

partslist = craft.partslist

doneparts = {} # keep track of parts that have already been imported so I can save time
doneobj = set(bpy.data.objects) # know which objects have gone through the cleaning process
scn = bpy.context.scene # the active scene
#cursor_loc = get_cursor_location()


#to_ground = partslist[0].pos[2]

for part in partslist:
[B] print("test3")[/B]
[B]print(ksp+partdir[part.partName][0])[/B]

Edited by Sma
reasons
Link to comment
Share on other sites

Doing a little bit of debugging (assuming I was doing it right), I found the folder path that it's trying to use in my case, is
/home/sma/Desktop/Untitled Folder/Link to Kerbal Space Program

/GameData/Squad/Parts/Command/Mk1-2Pod/model.mu

That's really where you have KSP installed? /home/Desktop/Untitled Folder/Link to Kerbal Space Program? You probably need to give it the folder of where that link is pointing.

Also thanks for the debugging stuff. I'll look into a different way of getting the directory.

Link to comment
Share on other sites

That's really where you have KSP installed? /home/Desktop/Untitled Folder/Link to Kerbal Space Program? You probably need to give it the folder of where that link is pointing.

Also thanks for the debugging stuff. I'll look into a different way of getting the directory.

Lol, yeh....copied it from the steam folder and just threw it there. Meant to move it to a specific folder but never got around to it....oh right I see what you mean, because of the symbolic link thing...yeh I'll look into that next time I'm messing with it. yeh...i did not actually copy it from the steam folder lol guess ill try that and see if it helps.

Update: Same error, but makes it much easier to read now lol /home/sma/ksp090 ;) much easier than the other one I had

Edited by Sma
Link to comment
Share on other sites

Lol, yeh....copied it from the steam folder and just threw it there. Meant to move it to a specific folder but never got around to it....oh right I see what you mean, because of the symbolic link thing...yeh I'll look into that next time I'm messing with it. yeh...i did not actually copy it from the steam folder lol guess ill try that and see if it helps.

Update: Same error, but makes it much easier to read now lol /home/sma/ksp090 ;) much easier than the other one I had

I made some minor updates to try to help you out. Redownload the addon and see if they make a difference. Sorry this is such a struggle.

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