Obj2DAt python script
Moderators: winston, another_commander
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Obj2DAt python script
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.
'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) )
'hope this helps.
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) )
'hope this helps.
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
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.
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.
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.
I plumped for that one simply because it had a front end that insulates me from most of the command-line stuff.
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
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!
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!
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... )
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... )
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
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.
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.
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.
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.
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
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...
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...
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!
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 )
So I know all about in @ the deep end!
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 )
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
\o/
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.
cheers Charlie, i'm indebted to your help.
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
yr wellcome
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie
By Appointment to
--- : GalCoop : ---
Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main
Charlie