Details of converting ship.obj to ship.dat using python 2.6

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Normally with python installed, simplest way is to put everything you need (model .obj and .mtl files, texture .png file nad script .py file) into one directory.

Then open said DOS prompt (NOT a Python prompt), cd to that directory and then type:

obj2dat.py <filename>.obj

where <filename> is replaced by the name of you file. It should then go off and do it's thang and leave you with a .dat file of the same filename.

This does presume that you've not changed any filenames or anything like that, for example renaming the texture file since you created the .obj file. If you have done that then the .obj file will need to be editted first to reflect that (it's just a text file).

PS I can't see any images at all in any post in this thread so far, just placeholder icons. I can only see your images by quoting your posts and extracting the links by c&p.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

You could try uploading the pics to Photobucket instead, much less hassle..
http://photobucket.com/
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

DaddyHoggy wrote:
@parazaine - I just get little red dots instead of your images... :?
Am I colour blind? I only see blue squares, no dots.

And just curious: Does there not exist a "drop" shell script for windows like for Mac? There we have a file when the file is dropped on, it executes the script on that file. You can even replace the internal scripts by your own. I did this because not for all actions there was a mac drop program. (I know, I am to lazy to type in those commands every time) For non programmers this is an easy method and I can't imagine something like that does not exist for windows.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2481
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

:lol: @ the first page of this thread, I can't see the pictures either, even the one DH can see.
there's lots of tips on converting ship models using the scripts in here
https://bb.oolite.space/viewtopic.php?t=4676
IIRC, make sure you use the obj2dattex.py script as the obj2dat.py script doesn't support textures
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Griff wrote:
:lol: @ the first page of this thread, I can't see the pictures either, even the one DH can see.
there's lots of tips on converting ship models using the scripts in here
https://bb.oolite.space/viewtopic.php?t=4676
IIRC, make sure you use the obj2dattex.py script as the obj2dat.py script doesn't support textures
I can't see even my relinked image any more either (now at work) - perhaps they were just cached on my local machine when I did the relink...

"Photobucket is your friend..."
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
parazaine
Dangerous
Dangerous
Posts: 91
Joined: Sun Jul 05, 2009 1:28 am
Location: London

Post by parazaine »

I have posted all pics on photobucket and redone links - hopefully shouldnt have any more problems - please let me know if anyone has any more problems viewing them - thanx
'Either this wallpaper goes, or I do'

Oscar Wilde's last words
parazaine
Dangerous
Dangerous
Posts: 91
Joined: Sun Jul 05, 2009 1:28 am
Location: London

Post by parazaine »

as i explained before, im a computer dunce - how do i open a dos cd (current dir?) to the dir the files are in?
'Either this wallpaper goes, or I do'

Oscar Wilde's last words
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

To minimise typing and for your first attempt I would suggest in normal "Windows" create a new folder on the C: drive at the top level - i.e. directly under the "C:" and call it something sensible like "oolite_test_ship" (without the quotes!)

Copy all the files you need into this directory

in the cmd window type:

Code: Select all

cd c:\oolite_test_ship
this will move your current directory (wherever you are) to c:\oolite_test_ship (cd basically shorthand for Change Directory)

To confirm in the cmd window type

Code: Select all

dir
and you should see that you are indeed in the correct directory and all the necessary files are present and correct.

Then do what Thargoid said in his earlier posting...
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
parazaine
Dangerous
Dangerous
Posts: 91
Joined: Sun Jul 05, 2009 1:28 am
Location: London

Post by parazaine »

made some progress lol - managed to run obj2dattex.py (obj2dat.py didnt work?) but got the following error message

converting...
['copperhead.obj']
copperhead.obj->copperhead.dat
traceback <most recent call last>
File "obj2dattex.py", line 31, in <module>
input file = open < input filename, "r" >
IOError : no such file or directory : 'copperhead.obj'

you also mentioned a NAD script file? dont have one of those, what is it?
'Either this wallpaper goes, or I do'

Oscar Wilde's last words
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

It should be obj2dat.py that you're using - when you say it "didn't work", what exactly do you mean?

Your dump-out above indicates that it can't find copperhead.obj, have you actually exported your ship out of Wings3D as a .obj file? That is the file you need to be working on (not a .wings3d file or anything else), you can do it through the file>export menu entry. That will output the obj file, you should save it to the work folder where you've put the obj2dat.py file (the one you go to in the DOS prompt, "c:\oolite_test_ship" or whatever you've called it).
parazaine
Dangerous
Dangerous
Posts: 91
Joined: Sun Jul 05, 2009 1:28 am
Location: London

Post by parazaine »

Thanks for your patience, i finally managed to generate the .dat file (had to delete PNG and OBJ files and re-export them to get it to work (i might have renamed texture file, like you suggested) anyway, thanks to everyone for your help - i now have to figure out the last stage lol, may take me a while
'Either this wallpaper goes, or I do'

Oscar Wilde's last words
Post Reply