BZW exporter for blender, Released, complete!

Discussion, updates, modifications, etc for the various map editors...
User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

BZW exporter for blender, Released, complete!

Post by Teppic » Thu Nov 17, 2005 7:06 am

I made one.
Well hacked apart someone else's old code for a different exporter.
In short it replaces exporting from blender to .obj, and then running modeltool on the obj file.

It will:
1) export selected meshes with local vertex positions so you can add them to an object group
2) export all scene meshes with global vertex postions so the make a whole map
3) export all used untextured materials (specular emit deffuse ans shiny incl alpha, colours basically)
4) Allow individual face material definitions
5) export face images at textures
6) assign texcoords and index them in the mesh definition
7) define both bzw faces if the blender face is set to twoside (for hollow objects you drive into/through)

There isn't an importer and *I* won't be writing one.(edit, unless i get bored)

Any rotation transforms on objects have to be done in edit mode cos' it's to much (i'm to lazy) to impliment it in object mode, dx dy dz transforms are fine though (for scene export)

Textures have to be applied in the uv editor window NOT AS MATERIAL TEX

Materials must have unique names (not mat.001 mat.002 ma1.0030, or the routine for not exporting the same material twice can get confused (I'm not gonna change it, to costly to impliment, see above comment)

Here's a screenie of a simple world exhibiting most of the features of the exporter.


Notes:
Please don't turn this thread in to a blender tutorial, there are plenty of those allready
This is a python script for blender, find your blah/blah/blender/scripts folder and stick it in there, you'll get an option to export to bzw in the file/export menu.
Before someone asks it won't work in wings, there is one for that allready.
AFAIK it will work with windoze but I'll have to check the import and exit protocols first
Before you run the script, open it up in an editor and change http://www.teppic.homelinux.net/ for the host you use for textures.

TODO:
If I can be bothered, maybe some implimentation of shootthrough and drivethrough for faces
Use specific objects (not meshes) to define other world classes (ground texture, server variables, world weapons, bases, teleporters and links, physics drivers etc)




I think that about covers it. :wink:

EDIT:This post is old, read the README for instructions. Exporter and tools
Updated see below (the last edited thingy).
Last edited by Teppic on Sat Dec 24, 2005 9:26 am, edited 7 times in total.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Thu Nov 17, 2005 1:37 pm

Been doing some slightly more rigorous testing. Image

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Thu Nov 17, 2005 6:56 pm

I am a busy boy, the link above is now to version 1.1beta.
Extra funtions include

Setting a mesh as a parent to an empty object(s) will export said mesh as a group definition, then all the child empty objects as group implimentaions with the empty object(s) postion and z axis rotaion.

No longer exits on faces with no assigned texture, just warns.

After the main header, it will insert a blender text object named prefix if it exists, so general map parameters can be set, i.e. options groundtexture definitions, or even a 'base' bzw map with existing bzw objects.

As above, if a text object named suffix exists this will be appended to the file. Useful for world weapon definition, bases, basically all the stuff that isn't implemented yet.

DON'T have empty lines in the pre/suffix texts for now.

Oh, the extra code for windows is

Code: Select all

import sys
under the import math line (49)and

Code: Select all

sys.stdout.flush()
on line 138 under the 'print Finished BZWXport BLAH BLAH' line.
Last edited by Teppic on Thu Nov 17, 2005 9:26 pm, edited 1 time in total.

User avatar
Spazzy McGee
Sergeant Major
Sergeant Major
Posts: 1403
Joined: Mon Mar 21, 2005 4:59 pm
Location: Planet MoFo, Sheffield Division; United Kingdom
Contact:

Post by Spazzy McGee » Thu Nov 17, 2005 7:26 pm

is blender more advanced than wings then? i have never tried blender.
"Life is what happens to you while you're busy making other plans." - John Lennon

User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post by RPG » Thu Nov 17, 2005 9:30 pm

Spazzy Mcgee wrote:is blender more advanced than wings then? i have never tried blender.
I would say Blender is more advanced, and it has the capability of doing animations, but it comes at a great price: an easy user interface.

You'd need to spend hours with the Blender UI to figure out how to do the simplist of things.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Thu Nov 17, 2005 9:32 pm

Yes blender is much more advanced.
Also another update to the script, objects that are present in the second layer will have the shootthrough attribute set, objects that are present in the third layer will have the drivethrough attribute set. Obviously objects in both will have both attributes set.

Next, world weapons........
RPG wrote: I would say Blender is more advanced, and it has the capability of doing animations, but it comes at a great price: an easy user interface.

You'd need to spend hours with the Blender UI to figure out how to do the simplist of things.
Just do a couple of those video tutorials, once you know the interface it is very quick to use.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Sun Nov 20, 2005 1:09 am

I finished implementing export of bases, world weapons, transporters, links and zones today.

The GUI for setting the properties of objects is currently about 1/3 done, dealing with bases and w/weapons so far. I feel the whole project should be working completely by next weekend. If there are any beta testers who would like to try and break it let me know. I've coded about 2000 lines of working code in 4 days, and can't stop thinking python, goToBed(self.me,now).
:wink:

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Mon Nov 21, 2005 11:01 pm

All done. This is a fully featured .bzw file exporter for blender.
Try it out, read the README and off you go...

EDITED: use the link at the bottom of the first post.
Last edited by Teppic on Sat Dec 24, 2005 9:22 am, edited 1 time in total.

User avatar
Saturos
Art Master General
Art Master General
Posts: 1111
Joined: Mon Apr 19, 2004 2:48 pm
Location: Berlin/Germany
Contact:

Post by Saturos » Tue Nov 22, 2005 8:26 am

Everytime I try to export my scene via bzwexporter I get a "python script error"... I have blender 2.37.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Tue Nov 22, 2005 11:58 am

Post the error, line no. and OS, it may be something simple.
If not post the blend file too.

Make sure the default scrpits path (python dir) in the user setup is correct.


EDIT:
Sorry, run blender from a terminal with the -window switch, then set the terminal to ontop, that way you can read all the error outputs.

User avatar
Saturos
Art Master General
Art Master General
Posts: 1111
Joined: Mon Apr 19, 2004 2:48 pm
Location: Berlin/Germany
Contact:

Post by Saturos » Tue Nov 22, 2005 2:06 pm

Seems to be a problem with my blender...
Saturos@linux:~> /home/Saturos/Desktop/Saturos/blender-2.37/blender -window
Using Python version 2.3
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.
Traceback (most recent call last):
File "<string>", line 85, in ?
ImportError: No module named math
Saved session recovery to /tmp/quit.blend

Blender quit
Saturos@linux:~>
OS is SuSE 9.3 with Linux 2.6.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Tue Nov 22, 2005 4:17 pm

OK, math is the only non blender module imported, and pi is the only variable called from it, so in bzwXport.py change

Code: Select all

import math
to

Code: Select all

math_pi=3.14159265359
Then do a find and replace on any 'math.pi' to change it to 'math_pi'
That should sort it out.

If it works tell me and I'll change it in the next beta release.
All this said just installing python should do the trick too, what happens if you type python on a command line?

User avatar
Saturos
Art Master General
Art Master General
Posts: 1111
Joined: Mon Apr 19, 2004 2:48 pm
Location: Berlin/Germany
Contact:

Post by Saturos » Wed Nov 23, 2005 10:26 am

Yes, it works... thank you! :)

Everything seems to be a little small though. And half-stuck in the ground. Maybe I just have to get used to it. :)

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Wed Nov 23, 2005 1:05 pm

Blenders x-y plane is the ground in bzflag, make sure no vertices are below z=0. I didn't make the exporter do any scaling either so if you add a cube a 0,0,0 it will be one unit in each direction, then if you move the bottom vertices so there z=0, the exported cube will be the eqivalent to a

Code: Select all

box
position 0 0 0
size 1 1 1
rotation 0
end
While your getting used to the scale, press shift:c, 7, add a plane, scale in edit mode to 400, and that will represent the worlds floor.

I'm gonna add the routines to allow scaling in object mode for the next beta release, along with loosing the use of the python math library, and a 'filp normals on export' function to bzwtoolkit.
I'm also going to include a sample .blend file creating a simple ctf world with a couple of tele's etc.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5143
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Post by JeffM » Wed Nov 23, 2005 4:33 pm

actualy if it REALY is one unit in each dir ( + and - ) then it would be

Code: Select all

size 1 1 2
in bzflag ( totaling 2 units wide in each axis ).

Z is handled difrent from X and Y in bzflag. Z is distance from bottom to top, X and Y are distance from center to each +- edge, so to make a cube the Z value needs to be 2x the X and Y.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Wed Nov 23, 2005 9:25 pm

JeffM2501 wrote:actualy if it REALY is one unit in each dir ( + and - ) then it would be

Code: Select all

size 1 1 2
in bzflag ( totaling 2 units wide in each axis ).

Z is handled difrent from X and Y in bzflag. Z is distance from bottom to top, X and Y are distance from center to each +- edge, so to make a cube the Z value needs to be 2x the X and Y.
Teppic was right wrote:move the bottom vertices so there z=0

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5143
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Post by JeffM » Wed Nov 23, 2005 11:00 pm

ahh so it would not be a cube, it woudl only be 1/2 high :) I was thinking you were moving ALL the verts up :)

got it.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Thu Nov 24, 2005 12:43 am

Beta 4 now ready.

Added:
Option to flip face normals on export
Different twosided method
Physics drivers and linking
Material export upgrades
Option to export face vertex normals(for nice lighting)
Removed the indentation in the bzw file(saves d/l time for clients)
Smoothbounce method
sample.blend and textures added to the archive
Updated README


Well that about does it...

EDITED: use link at bottom of first post.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Sat Dec 24, 2005 9:33 am

Bump.
1 month later
Beta 5 now up for download, see the top post.

User avatar
Catz
Private First Class
Private First Class
Posts: 7
Joined: Tue Dec 06, 2005 2:22 am
Location: Cat Food Heaven

Post by Catz » Wed Feb 15, 2006 4:04 am

Can't find download link.


-Thanks Catz :(

User avatar
Catz
Private First Class
Private First Class
Posts: 7
Joined: Tue Dec 06, 2005 2:22 am
Location: Cat Food Heaven

Post by Catz » Wed Feb 15, 2006 4:32 am

I looked around the forums and did find the download link for BZW .



thanks catz :)

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Wed Feb 15, 2006 5:00 am

It's been rebuilt since this thread, try http://www.teppic.homelinux.net/BZWTools

raytek2
Private First Class
Private First Class
Posts: 34
Joined: Thu Jan 05, 2006 11:05 pm

Post by raytek2 » Sat May 27, 2006 8:59 pm

I've been having some problems with this (forgive me if I sound ignorant)

I am very familiar with Blender and I can model fairly well.

Scale is my problem.

I have the latest with the importer. If I import a map just to test, it appears so large compared to the typical scale of thing in Blender, that it is unrealistic to try to model a map sucessfully.

Is there either
1. A feature in Blender to change modelling scale.
2. A setting on the exporter to scale things up a bit.
or
1. Am I just doing something extremely dumb?


-Raytek2

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Post by trepan » Sat May 27, 2006 9:40 pm

In blender, try increasing: View -> View Properties -> Clip End.

Unfortunately they've got it limited to 1000 (at least in blender 2.41).
There might be a way to get around that limit via config files, but I
haven't found it (or really looked for it, as I prefer wings3d for doing
most of my modelling, using blender only when necessary).

It would also be nice for the plugin to provide import/export scales.

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Sat May 27, 2006 10:06 pm

If you have trouble navigating around a large scene in blender you have two choices
1:- mess with the settings (camera lens size and end clipping) and learn the shortcuts for re-center etc
2:- Be aware that the exporter works on a 1 to 1 scale, build everything to 1/10, center the cursor, scale around it by 10 ( . a Shift-c c s 10 ent )

Blenders base grid (in free rotation) is about 30x30, this doesn't equate to any sensible factor for import/export scaling, and would just complicate simple arithmetic when working out object placement, hence the decision to keep the scale as 1 to 1.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests