Blender Export Script for Scorched3d models!

Post new topic Reply to topic  [ 121 posts ]  Go to page 1, 2, 3, 4, 5 ... 9  Next
Author Message
 Post subject: Blender Export Script for Scorched3d models!
PostPosted: Tue Aug 17, 2004 10:33 pm 
User avatar
Desintigrated

Current Scorched3D Rank: Unranked






Joined: Sat Jun 12, 2004 12:53 am
Posts: 2884
Location: _____________________________ Current Scorched3d Rank: 1 _____________________________ *clink*
Update, Sept. 7, 2004: New version.
Fixed perspective problem - "top view" is now the top, side is side, etc.
Added error checking for incorrect number of verts per face
Some code cleanup


Update, Jan. 8, 2005: New version.
Major speed improvement
UV coordinates working correctly


Update: Mar. 12, 2006: New Version (1.0)
Fixed flipped normals problem (finally)
Some performance boosts


Update, Oct 4, 2006: New Version.
- Updated for Blender 2.4x - Thanks Berem!
- Now uses vertex normals instead of face normals (Now has smooth looking surfaces when you use "Set Smooth") - Thanks to Bobirov for bringing this to my attention and helping me find the problem!
- The files once again open in Milkshape without crashing it (Again, thanks to Bobirov for the comments and testing)


Update, Nov 5, 2006: New Version.
- Emitted light is now handled properly
- Texture images are no longer manditory

Update, Jan. 29, 2007: - New version, 1.5
- Added (simple) GUI interface
- Fixed a few compatibility problems for Blender 2.42a
- Tests for existing file before overwriting (finally)
- Ability to disable progress bar (from GUI) for HUGE speed increase

Update, Sept. 30, 2007: New revision, 1.5.1
- Fixed compatibility issue for Blender 2.45

Update, Oct. 28, 2007: New revision, 1.5.2
- Added support for smoothing groups


Get the script from the Scorched3d-mods page on SourceForge

Check the Wiki here for a brief tutorial on tank modelling with Blender.

TODO: (updated May 17, 2006)
-Add animations
-Change it so the "CTRL-A" is not required
-Have script automatically convert faces that are not triangles to tris (it maybe should ask first, as it would likely be slow)
-Allow for meshes with no texture image - Done
-Milkshape import - Done
-The manner in which the script extracts vertices results in having duplicate vertices (ie: the verts that are shared by two faces are duplicated). This is a change from the older versions of the script, and is a result of the code changesI made to fix the UV coords. The only fixes I have come up with thus far would complicate (and slow down) the script too much.
-Need to add a test to see if the export file exists - Done


Basic installation and usage instructions:
Extract the scorched3d_export.zip (Windows) or ms3d_ascii_export.py.bz2 (everyone else), and save the ms3d_ascii_export.py file to your blender scripts directory. (Mine, in Linux, is under my home directory, ie /home/cbx/.blender/scripts),in Windows the directory is something like "Documents_and_Settings\user_profile\Application_Data\Blender_Foundation\Blender\.Blender\scripts"

Fire up blender, and model the tank as per the instructions in Cambo's post on "Modelling for Scorched3d with Milkshape3d", http://www.scorched3d.co.uk/phpBB2/viewtopic.php?t=552

A few things that are different (at least for now):

1. Ensure that the "centres" for each mesh are located at the centre of the bottom of the tank's "base". ie: In Blender, when the "gun" mesh is selected, placethe 3d cursor at the centre of the base, and click "centre cursor" in the edit buttons (F9 to get to edit buttons)

2. FIXED ("Make Sticky problem)

3. Each mesh (including gunpivots/turretpivots!) must be converted to triangles: Select the mesh, go to Edit mode (tab), ensure all vertices are selected (hit "a" a couple times to make them all yellow), and press CTRL-T. Viola, they'll all be triangles now. (Likely a good idea to then hit CTRL-N to have it recalculate the normals)

4. (this problem has been fixed)

5. This is fixed. Gunpivot and turretpivot must be textured at this time. Don't ask why. ;) They won't be displayed anyway, so just pick a random texture for them.

6. Additional note: If a mesh shows up in the wrong position or wrong orientation, select it and hit "CTRL-A" to do an "Apply Size and Rotation" (generally a good idea to do this after moving/rotating a mesh). I have yet to decide it this is a bug or a feature.

Once you have that all done, (don't forget to save your work! The script won't import back from the .txt format yet!), just go to File->Export->MS3D ASCII and save the .txt!

I find it easiest (as Cam mentioned in the above article, please read it!) to save everything in it's own folder under data/tanks.

Tested with Blender 2.42a and Python 2.4.3 under Gentoo Linux. It also should work on OSX, Solaris, and Windows, with Blender 2.40+ and Python 2.3+.

Comments, criticisms, and cash are welcome.
Have fun,

cbx

References:
http://www.blender3d.org
http://www.python.org
http://www.elysiun.com <- THE place for Blender info
To be honest, I don't fully understand that page, but it sounds like it provides the answers you need. - Deathstryker

She doesn't stimulate me mentally or physically... I need at least one of those - Anonymous

Who wrote this crap? - G. Camp


Last edited by cbx550f on Mon Oct 29, 2007 3:52 am, edited 11 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 29, 2004 8:02 pm 
User avatar
Desintigrated

Current Scorched3D Rank: Unranked






Joined: Sat Jun 12, 2004 12:53 am
Posts: 2884
Location: _____________________________ Current Scorched3d Rank: 1 _____________________________ *clink*
A few people have noted to me in games that when they try to open my models in Milkshape it (Milkshape) crashes horribly. Unfortunately, I don't have access to a Windows machine, so I really can't test it properly.

Could someone provide me with any info you may have on the crash?

Also, I'll attach a very simple "tank" here to try.

Any info greatly appreciated! I'd really like to get this fixed up properly. :)


Attachments:
File comment: Sample (simple!) tank
blacktank.zip [1.13 KiB]
Downloaded 179 times
To be honest, I don't fully understand that page, but it sounds like it provides the answers you need. - Deathstryker

She doesn't stimulate me mentally or physically... I need at least one of those - Anonymous

Who wrote this crap? - G. Camp
Top
 Profile  
 
 Post subject: Trouble finding export filter
PostPosted: Thu Dec 16, 2004 7:35 am 
I'm a blender user and got excited when I saw there is an export script for scorched models... but I can't find the link to download it. Can anyone help me here?


Top
  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 7:46 am 
User avatar
Charred
Not Signed Up For Stats

Joined: Sun Sep 12, 2004 8:09 pm
Posts: 223
Create a free login account and you will find links to some very good downloads posted by users.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 6:11 pm 
User avatar
Desintigrated

Current Scorched3D Rank: Unranked






Joined: Sat Jun 12, 2004 12:53 am
Posts: 2884
Location: _____________________________ Current Scorched3d Rank: 1 _____________________________ *clink*
I've actually updated the export script quite alot since last time I updated it here - I'll try to post an update version in the next couple days. :)

cbx
To be honest, I don't fully understand that page, but it sounds like it provides the answers you need. - Deathstryker

She doesn't stimulate me mentally or physically... I need at least one of those - Anonymous

Who wrote this crap? - G. Camp


Top
 Profile  
 
 Post subject: Problem running script
PostPosted: Fri Dec 17, 2004 5:17 am 
Singed
Not Signed Up For Stats

Joined: Thu Dec 16, 2004 7:33 am
Posts: 9
I am getting various errors when I try to run the export script. I seem to get different errors with different versions of Python. I'm running Win XP (unfortunately) with Py 2.4 (tried 2.2 as well) using blender 2.35. I suppose I could try it in Linux... but I was wondering what versions of Py and Blender you are running.

Perhaps it's my model. Would anyone have .blend file I could test the script with?
If you step on a cookie, the crumbs are just as good as long as your feet are clean.

Top
 Profile  
 
 Post subject: Ok... figured out my problem...
PostPosted: Fri Dec 17, 2004 6:54 am 
Singed
Not Signed Up For Stats

Joined: Thu Dec 16, 2004 7:33 am
Posts: 9
Alirght, so the blender console is telling me there is no "mod_flags" module. I looked in the directory... and sure enough... that one doesn't seem to exist. Any suggestions? Or does someone happen to have a copy of mod_flags.py I could borrow?
If you step on a cookie, the crumbs are just as good as long as your feet are clean.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 18, 2004 11:13 pm 
Uncooked
Not Signed Up For Stats

Joined: Sun Dec 12, 2004 11:04 pm
Posts: 4
Just posting to show my support for this script :D. I use Blender for other projects and I would love to use it for this game. Can't wait till you put up the newer version of the exporter.

And as a final thought... could you make an importer too, or would that be too much?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 20, 2004 11:05 pm 
User avatar
Desintigrated

Current Scorched3D Rank: Unranked






Joined: Sat Jun 12, 2004 12:53 am
Posts: 2884
Location: _____________________________ Current Scorched3d Rank: 1 _____________________________ *clink*
Quote:
Alirght, so the blender console is telling me there is no "mod_flags" module. I looked in the directory... and sure enough... that one doesn't seem to exist. Any suggestions? Or does someone happen to have a copy of mod_flags.py I could borrow?


Boy, that sounds *awfully* familiar... hmmm. I'm at work now (no net at home presently) - I'll try to have a look around on my PC at home for that, see if I get any ideas.

Did you have a look in the Elysiun forums for that module? ( http://www.elysiun.com That error sounds familiar, perhaps you could find some info there.

Quote:
Just posting to show my support for this script . I use Blender for other projects and I would love to use it for this game. Can't wait till you put up the newer version of the exporter.


Thanks! Good to know that someone appreciates it. :) I'll try (really hard) to get a new one up - PC at home has no floppy drive, no net, and the cd burner died the other day. lol Maybe I'll take a laptop home to copy it over so I can post it. ;)


[quote]And as a final thought... could you make an importer too, or would that be too much?{/quote]

I *really* should do this... wouldn't be too hard, I just have too many projects on the go. If you search around there is an MS3d importer around, it *kinda* works (Seems to me it was hard to find too). One of the nights I'll get the ambition to do the importer!

Cheers!
To be honest, I don't fully understand that page, but it sounds like it provides the answers you need. - Deathstryker

She doesn't stimulate me mentally or physically... I need at least one of those - Anonymous

Who wrote this crap? - G. Camp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 7:40 am 
Singed
Not Signed Up For Stats

Joined: Thu Dec 16, 2004 7:33 am
Posts: 9
Well, I've been searching... haven't found anything. I tried in Linux as well, but the only thing that happened differently was my cat's tail caught on fire and my wife threatened to leave me... Well... ok... so the last two things didn't happen...
I tried simply commenting out mod_flags. A similar issue was resolved that way... but I get a different error when I do that, so, I don't know. Guess I'll keep doin' it the tedious way. Model in blender, export to an OBJ, import into milkshape, tweak, blah blah blah... :cry:
If you step on a cookie, the crumbs are just as good as long as your feet are clean.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 5:17 am 
User avatar
Desintigrated

Current Scorched3D Rank: Unranked






Joined: Sat Jun 12, 2004 12:53 am
Posts: 2884
Location: _____________________________ Current Scorched3d Rank: 1 _____________________________ *clink*
Sorry for taking so long, Reralaxis, but here's the scoop:

I finally have it resolved (I installed Blender and the script on another machine, and got the same problem as you). It turns out that my script was quite outdated for today's Blender (I likely did something before on my main machine to get old scripts working in the past). Anyway, to fix the script, just change every occurrence of mod_flags to mod_meshtools.

Also, I'm posting a newer version of the script. The new version handles UV coordinates correctly, is much faster, and does some better error checking. The only caveat (that I know of) is that it dumps alot of duplicate veterices (not really a problem AFAIK, except for the wasted space).

It still doesn't check to see if the file you are creating already exists, so be careful.

Anyway, see the top post for the new file and updated information.
Any comments are greatly appreciated!

Cheers!
To be honest, I don't fully understand that page, but it sounds like it provides the answers you need. - Deathstryker

She doesn't stimulate me mentally or physically... I need at least one of those - Anonymous

Who wrote this crap? - G. Camp


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Mon Jan 10, 2005 3:41 pm 
Singed
Not Signed Up For Stats

Joined: Thu Dec 16, 2004 7:33 am
Posts: 9
Rock on... I haven't had time to test the script yet, but thanks for the reply. I haven't had much time to worry about it, so no worries 'bout the late reply. The programmer in me told me to change it to mod_meshtools, but I thought to myself "self, that won't work." Guess I should have gone with that instinct!
If you step on a cookie, the crumbs are just as good as long as your feet are clean.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 12, 2005 9:49 pm 
User avatar
Desintigrated

Current Scorched3D Rank: Unranked






Joined: Sat Jun 12, 2004 12:53 am
Posts: 2884
Location: _____________________________ Current Scorched3d Rank: 1 _____________________________ *clink*
Just a note on the latest script: Coordinates may be mirrored on the X axis (This just occurred to me, I really cannot remember if I fixed this yet or not, and I can't test it at the moment, as I'm at work)

While I'm at it, a couple more TODOs:

- Change the requirement for objects to have a texture to a warning (ie: no need for gunpivot to have a texture)
- Stop duplicating materials (ie: if two objects have the same material, it shows up in the .txt file as two separate materials)
- Check to see if file exists before exporting (yes, I've overwritten a couple mistakenly ;)

If anyone has anything to add to this list, feel free. :) Also, I have no idea it it works in Windows (it should, I would think), so please share any experiences you have (good or bad).

Also a note: If your export is taking a long time, you can disable the progress bar by changing "show_progress" from 1 to 0 near the top of the script. I changed the script so it doesn't update the progress bar quit as often which made it run quite a bit faster, but for really large meshes you may want to shut it right off.

Cheers!
To be honest, I don't fully understand that page, but it sounds like it provides the answers you need. - Deathstryker

She doesn't stimulate me mentally or physically... I need at least one of those - Anonymous

Who wrote this crap? - G. Camp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 14, 2005 1:37 am 
Singed
Not Signed Up For Stats

Joined: Thu Dec 16, 2004 7:33 am
Posts: 9
I'm still having a problem in windows. I think I'll try a different version of Python. I've seen similar posts in other places for other things. The message I get in the blender console is:

File "<string>", line 35, in ?
File "C:\PYTHON24\LIB\os.py", line 133
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,

SyntaxError: invalid syntax
If you step on a cookie, the crumbs are just as good as long as your feet are clean.

Top
 Profile  
 
 Post subject: Python
PostPosted: Fri Jan 14, 2005 4:08 am 
Singed
Not Signed Up For Stats

Joined: Thu Dec 16, 2004 7:33 am
Posts: 9
Alright, I tried it with Python 2.3 and it exported just fine. Windows losers... I mean, users (yup, i'm one of them, sometimes): DON'T USE PYTHON 2.4! IT DOESN'T WORK! :shock:

I'll include a couple tanks I made.


Attachments:
File comment: Two tanks. The xml is included in tanks.txt
tanks.zip [92.83 KiB]
Downloaded 160 times
If you step on a cookie, the crumbs are just as good as long as your feet are clean.
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 121 posts ]  Go to page 1, 2, 3, 4, 5 ... 9  Next


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group