Page 1 of 1

Obj2DAt python script

Posted: Mon Jan 15, 2007 6:13 pm
by Killer Wolf
Sorry, i may be completely dense here, but how do i run this? I installed Python 2.5, i've put the script in teh same folder as my OBJs (in My Documents) but i'll be buggered if i can get the command line thingy to work. someone said type "obj2dattex.py (obj name) (dat name)" so i did, w/ a full address name, and it just says invalid syntax etc.

Posted: Mon Jan 15, 2007 6:46 pm
by Charlie
'had much the same prob - python? still don't care...

How I do it ( there is probably a better way )

1 ) The folowing assumes ActivePython installed as that's what I use...
2 ) Put Obj2DatTex.py into the same directory as your .obj/.mtl files
3 ) I suspect it helps if your .png is there too.
4 ) Run Pythonwin IDE
5 ) Click on the folder icon & navigate to: Obj2DatTex.py & run that.
6 ) Click on the running-man icon.
7 ) Type the full name of your .obj ( inc extension ) into the Arguments field & click ok.
( don't touch the other fields! )
8 ) Quick grind later ( with luck no errors ) & you have a new .dat file. :)
.
not done yet!
.
9 ) Open the .dat file in a text editor:
10 ) Check that all the instances of your .png file are like: pngname.png & NOT c:\models\stuff\mypoo\pngname.png. ( this won't work )
11 ) Make sure all the chars in pngname.png are the same case as those for your .png file.
( or you'll get complaints form people using PickyOS(tm) ) :wink:

'hope this helps.

Posted: Tue Jan 16, 2007 7:25 am
by Killer Wolf
Cheers again Charlie. as for "Active Python"?? Er, i dunno! far as i know it's just "python 2.5" - there's billions of variants out there, i went to one site that, after a long trawl, told me i needed PyWin blahdeblah summat, so i d/l'd it. installed, said "needs python 2.6, not found on your system" - and according to another place, 2/5 is the latest not 2.6 >:-/
i was running from the command line/DOS thingy, there's a GUI as well apparently, i'll see if i have any more luck w/ that.

Posted: Tue Jan 16, 2007 12:34 pm
by Twisted
Dont know abou python but a lot of cmd line utils dont like spaces (as in 'My documents'). I'd try running it from elsewhere.

Posted: Tue Jan 16, 2007 1:29 pm
by Charlie
Active Python is just one of many, many versions...

I plumped for that one simply because it had a front end that insulates me from most of the command-line stuff. :)

Posted: Tue Jan 16, 2007 6:22 pm
by Killer Wolf
i got active, i've followed what you say, but when i type my file name it just says Name Error, name is not defined. I've tried capital extensions, full path names and allsorts :-/

scratch that, got that bit sorted w/ a reload of the .py, but now it just says

Traceback (most recent call last):
File "C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "G:\finals\Obj2DatTex.py", line 121, in ?
v3 = int(bits[0]) - 1
ValueError: invalid literal for int():


all of which means bugger all to me.
Help! :-(

Posted: Tue Jan 16, 2007 7:28 pm
by Charlie
Odd!

I'll have another look & see what I'm doing that I forgot to mention...

Just checking:
I'm using 'doze, are you?

What are you using to output your .obj files?
( So far I've only found Wings, MS3D, & 3D-converter produce .obj's that the .py script will accept )

Me:
3DS-Max->UU3D->MS3D->ActivePython->.dat file ( which often needs further editing... :x )

Posted: Wed Jan 17, 2007 7:14 am
by Killer Wolf
using XP. i *think* my OBJ was the one output from Ultimate Unwrap. i was trying to make sense of the Python code and the "v3" seems to refer in part to the third verice that makes up a face, but beyond that i'm lost. prob is, i dunno where on the model it looks so i dunno what to check! I'm *assuming* that i haven't got any loose verts around or MS or UU would have blebbed. i *did* end up w/ one odd face in between all my exporting tricks - i was checking textures in MS and for no reason at all when i opened it after tweaking i had a face on my ship's rear duped and included in part of the cockpit group - no idea what happened there but fortunately i could kill it easily.

i could try exporting from MS, see what happens...or mebbes i should just create a cube or summat simple first, might be an indicator as to if it's a prob w/ the utility or my model. hope it's not the model, it's not even left dry dock yet and it's fricking jinxed :-(
it also just twigged w/ me that i saw the bit on MS for textures saying "bitmap" so i've been saving them as bitmaps - have to go and resave them all as pngs. not that that'll be related to my prob, i just thought i'd mention it, heh.

Posted: Wed Jan 17, 2007 1:17 pm
by Charlie
It's a pain isn't it?

My best suggestion is whatever you use to model, if at all posible load into MS3D -> select all -> weld verts ( two seperate menus on the top bar ), then export as a .obj & put that through the .py script.
( don't touch with another proggie after )

MS3D will have had its way with your model.
Two benifits:
1) I've never had the .py script choke on a .obj from MS3D
2) It's weld function seems quite efficient ( compared with the alternates ) & for Oolite the fewer verts the better. :)

I'm not in a position to complain loudly, ( couldn't develop my own 3D package ) but maybe one day an author will manage the trick of User-friendliness / features / compatible output for all aspects of modeling...

In the meantime I'll stick to my current ( if very inefficient ) practice.

Posted: Wed Jan 17, 2007 2:09 pm
by Killer Wolf
well, looking on the bright side at least my next ship will be easier! >koff! koff!<

frick, i've not even started the plist bits yet!

ta for the help. out seeing Steven Seagal tonight, but i'll have mega plays when i get a chance, running all types of model variants through.

has anyone uploaded a one-face ship> it could be a new trader from a race of sentient 2-dimensional characters... :-|

Posted: Wed Jan 17, 2007 5:59 pm
by Charlie
TBH my first ship ( & first attempt @ modeling ) was the falcon.oxp - still probably the best ship I've done, though actually quite easy compared to my later ones as I knew exactly what I was aiming @.

So I know all about in @ the deep end! :roll:

Best of luck - if 'all' you are doing is making a ship the rest of the .oxp is easy:
Find someone else's ship that has similar stats & substitute your model/name entries for yours, change the stats to what you want & there you go.

It starts to get hard when you want to make .oxp's that do weird / unexpected stuff that the wonderful creator of Oolite never enviseged.
( My problem with several .oxp's that I have in the pipelie that I REALY want to release, but can't get to work ATM )

\o/

Posted: Fri Jan 19, 2007 8:14 am
by Killer Wolf
booted up last night w/ that "right you ba$tard, you're NOT gonna get the better of me" attitude. MS : Weld : run. DAT file output, just like that :-) no errors, nowt.

cheers Charlie, i'm indebted to your help.

Posted: Fri Jan 19, 2007 8:49 pm
by Killer Wolf
...and i'm sitting here w/ a big daft grin on my face cos i've just seen my baby in-game :-)

needs tweaking for details like the exhaust flares, but i'm one happy wolf :-)

cheers again Charlie and all others who've helped. i'll upload the OXP when i've given her a bit polish.
[/img]

Posted: Sat Jan 20, 2007 3:23 pm
by Charlie
yr wellcome