Page 1 of 2

Help! I'm new at this!

Posted: Mon Jun 23, 2014 8:15 pm
by RebelRunner
So, I'm looking to import some preexisting assets into an OXP. What I have is this:
-.obj files
-.dds textures
Along with Blender, Wings3d, and a couple random conversion tools I used to get to this point. I'm basically trying to figure out how to merge the textures with my .obj files, and convert the whole shabang into .dat files that can then be compiled into part of an OXP. I have done some poking around, and have not yet figured out how to get any of the Python conversion utilities to work.

Any suggestions?

Re: Help! I'm new at this!

Posted: Mon Jun 23, 2014 11:10 pm
by Norby
Hi RebelRunner, welcome on this board (which seems to be the firendliest this side of Riedquat ;)) !

If you are lucky then simply convert all .dds to .png (for example with the free irfanview), run Obj2DatTex.py and replace all .dds extension to .png in the .dat file.

Check the [wiki]OXP_howto[/wiki] and [wiki]OXP_howto_model[/wiki] pages in the wiki, look into other ship OXPs and feel free to ask as many times as you want until you will be done, there are very helpful folks here.

Re: Help! I'm new at this!

Posted: Mon Jun 23, 2014 11:36 pm
by RebelRunner
How and where would I run the Python script? I had originally tried to set it up as a Blender plugin, but this was either incorrect or I did it wrong.

Thanks for the quick and friendly response :D :D

Re: Help! I'm new at this!

Posted: Mon Jun 23, 2014 11:41 pm
by maik
Hi RebelRunner, and welcome.

You need to run the Python script from your command line. If you're on Linux or Mac OS X, then your system should already come with a Python interpreter, on Windows you would need to install one first.

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 2:50 am
by Diziet Sma
G'day, RebelRunner, and welcome aboard! 8)
maik wrote:
You need to run the Python script from your command line. If you're on Linux or Mac OS X, then your system should already come with a Python interpreter, on Windows you would need to install one first.
Note also that the script requires Python 2.6 or greater, but will not work with Python 3.x. This is possibly the problem when you tried using the script as a Blender plugin, since Blender uses Python 3.3. It is possible to force a script to use Python 2 on a computer which has both 2 & 3 installed. Simply change the first line of each script from:

Code: Select all

#!/usr/bin/python
To:

Code: Select all

#!/usr/bin/python2
(To be honest, all the mesh-conversion scripts should be updated to include this small detail.. or better yet, be re-written to run on Python 3.x)

(I've also just updated the download link on the mesh-converters Wiki-page to point to GitHub, instead of BerliOS)

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 4:48 pm
by RebelRunner
Thanks. I've got the conversion scripts you mentioned. I also figured out how to open up the Python interpreter, but am unable to figure out just how to run the scripts. If the script is located at C:\...\Obj2DatTex.py, what would the command be to run it? Additionally, when/where would I point the script to the .obj I'm trying to convert?

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 5:03 pm
by Diziet Sma
Well, to quickly steal borrow the answer from another thread:
Mauiby de Fug wrote:
Okay, it's been a while since I last did this, and I haven't got it set up on my computer yet, but I believe that you first of all need to have the Obj2DatTex.py file in the same folder as the file you want to convert. Then, open a normal terminal, and cd into the folder. Then, try running something like python Obj2DatTex.py ModelToConvert.obj and see if that does something...
On Windows, you'd say "Command prompt" instead of "terminal", but otherwise, the procedure is identical.

(oh yeah.. and you don't need to go near the Python interpreter at all.. all the scripts are run from a Command prompt in the same manner as the above)

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 7:36 pm
by Griff
This is specific to windows but make sure you run the script from the windows command prompt and not the 'Python (command line)' shortcut that gets installed alongside python
edit: sorry, should have read Dizzy's post above he's already got this covered :oops:

If you're on WIndows 7 you can quickly open a command prompt at the folder where you've put your ship .obj files and the Obj2DatTex.py script by holding down the shift key then right clicking on your folder in explorer, there'll be a new option "open command window here" on the pop-up menu

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 11:19 pm
by RebelRunner
Okay, this is promising...now what is this 'cd' the thread Dizzy directed me to? A way to point Python to the proper folder? How would I use it?

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 11:21 pm
by Cody
Hmm... if my memory serves, cd as a typed command means 'call directory'.

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 11:28 pm
by Norby
http://www.google.com/#q=change+directory

If you do not want to type your commands again and again then open a text file, type into and save as something.bat (if I guess right and you use windows) then double click on this file. https://www.google.hu/#q=Batch+file - the wikihow page contain nice screenshots.

Re: Help! I'm new at this!

Posted: Tue Jun 24, 2014 11:44 pm
by RebelRunner
Okay, so I changed the working directory as appropriate, entered python Obj2DatTex.py modelname.obj, and got the error message IOError: [Errno 2] No such file or directory: 'modelname.obj'.

The file and script are in the same directory/folder as they should be. I'm really starting to get confused here.

Re: Help! I'm new at this!

Posted: Wed Jun 25, 2014 12:05 am
by Norby
Try to give the whole path of .obj file like "c:\windows\modelname.obj" , and use the quotation marks if there is a space in the name.

Re: Help! I'm new at this!

Posted: Wed Jun 25, 2014 6:31 am
by Thargoid
And without wishing to state the obvious, modelname.obj should of course be replaced by the actual filename of your model's obj file. Also when you installed python it should have put itself onto your command line path (again presuming you're in Windows) and associated itself with .py files.

When I do this kind of thing, I usually just copy the script file into the same folder as the obj/mtl/png files and type obj2dattex.py myWhizzyShip.obj in a normal DOS command line prompt, where myWhizzyShip.obj is the name of the relevant obj file. I guess explicitly adding python to the start won't hurt, but if you have proper association set up (type path at a DOS prompt and it should show your search path, if that includes the location that the python executable is in then your machine will see it wherever you type obj2dattex.py).

Re: Help! I'm new at this!

Posted: Wed Jun 25, 2014 2:20 pm
by spud42
you can right click on the py script and then select "open with" if python isnt in the list then use the browse button...