Forum Thread
  Posts  
Blender3D HL2 SMD Export script (Forums : Coding & Scripting : Blender3D HL2 SMD Export script) Locked
Thread Options 1 2 3 4 5 6 7 8 9
Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 19 2005 Anchor

there are two reasons i am making now this topic here and now.

the first is to let you all know that i have not dropped this export script for hl2 and i will not drop it. i tough had and still have to priorize work as real-life does not take a break just because you would like to have it right now. fortunatly my own export script for my engine needs this 'edge creasing' support too that is one of the things that makes exporting from blender for people that interesting. the script to calculate the needed normals for such hard edges is approaching completness and once it works with my engine will be copy-pasted into this hl2 smd export script to support the same cause.

the second reason is to make it clear for people where to look for this export script. i know it is inside the blender3d topic but prolly who looks there to find a hl2 export script in the first turn. that is why i make this topic to collect all the informations and release concerning this script.

now have a good time and i'm looking forward to the next test release of the script supporting creasing.


Features
- Exporting Static Meshes including Skeleton and Bone Weighting ( Normals to be fixed soon )
- Exporting Animation Sequences
- Bulk exporting Animation Sequences


Download
Here you will find the newest version of the script. The zip/tarball contains besides some detailed usage description also a test model you can fiddle around with.

HL2 Export Alpha 0.3 ( .tar.bz2 )
HL2 Export Alpha 0.3 ( .zip )

This is Alpha version after all. It should work without problems but you never know. You are welcome to give me the feedback.

Important
This version of the script requires Blender3D Version 2.44 to run. Lower version will not work as new features have been introduced as well as the API changed a lot.

Edited by (in order): Dragonlord, Dragonlord, Dragonlord, Dragonlord, Dragonlord, Dragonlord, Dragonlord

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 20 2005 Anchor

edge creasing code seems to work in the script (at last my test debug output showed the correct informations :D). i'll test the code out in my engine and if it works i'll plug it into my SMD exporter.

up to now i did only provide a test smd file i obtained from my script. i'll change this to allow others to poke their nose into the matter. once i have the code snipped merged i will put here the script to download and test.

Edited by: Dragonlord

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 20 2005 Anchor

test passed, the edge-creasing code works splendid on mani-fold meshes and open meshes (with edges having only one face, not two). i'll go implement the code into the smd exporter most probably tomorrow.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 23 2005 Anchor

Keep up this good work I am eagerly awaiting being able to export to HL2 from blender.

--

User Posted Image

Sep 23 2005 Anchor

as am I :)

thanks a lot, this will really help the blender users! :)

i'm willing to help test, but i might not have enough modelling knowledge to do so.

what features does it hv so far?

Edited by (in order): -hp-, -hp-

--

|_( hp )¯| p00nst3r

Stuffie
Stuffie Mod DB Star * !
Sep 24 2005 Anchor

I dunno if itll be as good as dragons but theres already one out.

Asrc.pjohnsen.com

--

Stuffie
User Posted Image

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 24 2005 Anchor

Stuffie wrote: I dunno if itll be as good as dragons but theres already one out.

Asrc.pjohnsen.com

this exporter only exports a simple prop without sceleton or animation data.

here a list of what my script can and will can.

can do:

  • export mesh with respect to creased edges. uses blenders 'edge creasing' value to calculate the correct normals for edgy objects.
  • exports sceleton from an attached 'armature object'. some issues with angle transformation to sort out

will can:

  • export animation sequences using 'actions' from blender. will use a modified version from my game engine export script. you will be able to export one 'action' at the time which is easier than all together and guessing filenames.

this is what i know about the SMD format to be able to carry as informations. if you know about more that can be put into those files you can tell me and i look into it. as said i develop this script 'blindly', which means, without documentations or a working HL2 SDK to test it out, hence i need the input from others in this one.

had to help out in a pal's shop building up the store from after the flood and the last two days went into rebuilding his computer which got a bit 'wet' in all this. i'll get to the smd script today if nothing else gets in the way (which should hopefully not on the weekend *grin*)

Edited by: Dragonlord

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 24 2005 Anchor

i cooked up a version which should export meshes together with their parented armatured into a .smd file as static mesh. exported are the mesh with the sceleton and bone weighting but not creasing (i wait until i know the math works out). the zip contains a test model that i would like you to use if you want to give me feedback.

major problem is that i don't know the coordinate system of HL2 and hence this version is a test version to see if i got the orientation right. if you do a test export please post a render thus i can check out what went wrong if something went wrong.

if it turns out to work i will add the creasing and sequence export, which are more or less ready to be plugged in, just sitting on the player-bench until the lead is there ^_^.

hl2 export script - alpha 0.1

NOTE: this is ALPHA version, hence don't whine into my ears if it does not work. you are welcome though to give me the feedback i need to repair things.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 24 2005 Anchor

I tried to export Static and Animation but blender returned an error:
couldnt copy and paste and dint want to write it out so here it is
User Posted Image

Edited by: -hp-

--

|_( hp )¯| p00nst3r

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 24 2005 Anchor

you have an incomplete installation of python. you are missing the RE module, which provides pattern matching (regular expression matching). as far as i see it the script has no need yet for pattern matching but in the future it might. to fix this you can replace line 68 with:

import struct, os, cStringIO, time

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 24 2005 Anchor

same error

--

|_( hp )¯| p00nst3r

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 24 2005 Anchor

you might try taking out cStringIO which seems to include the RE module by itself. change line 68 into

import struct, os, time

but prolly you should get yourself a complete python installation as this way most scripts in blender (especially export scripts relying on cStringIO) will kick your but.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 24 2005 Anchor

lol same error, i'll just get me a new install of python. I thot i did already, but i guess not. in my blender console it says i hv it installed.

UPDATE: AFter a reinstall of python 2.4.1, i am still getting the same error.

Suggestion: keep the most recent version of the exporter in the first post so people can easily get to it.

Edited by (in order): -hp-, -hp-

--

|_( hp )¯| p00nst3r

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 25 2005 Anchor

i looked in the documents and thew RE module is part of the built-in modules of python. most probably your installation is for some kind incomplete. try googling for blender-python problems to sort it out. more i can not help.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 25 2005 Anchor

i fixed that problem, i exported a static smd and tried it on the model compiler as a static prop.

the compiling gave me this:

E:\HL2 Compile Toolkit\bin\batch files>set toolkit_dir=E:\HL2 Compile Toolkit
WORKING ON PROP MODEL
CREATING MODEL FOLDERS...
COPYING MODEL FILES...
E:\HL2 Compile Toolkit\model_compiling_files\hl2exportstatic\hl2exportstatic.smd

1 file(s) copied.
1 file(s) copied.
COMPILING MODEL...
c:\program files\valve\steam\steamapps\g_s_g_9@hotmail.com\sourcesdk_content\hl2
mp\modelsrc\, C:\Program Files\Valve\Steam\SteamApps\G_S_G_9@hotmail.com\sources
dk\hl2mp_sample_content\, path hl2exportstatic
Working on "hl2exportstatic.qc"
SMD MODEL hl2exportstatic.smd
ERROR: model has no sequences
ERROR: Aborted Processing on 'hl2exportstatic.mdl'
The filename, directory name, or volume label syntax is incorrect.
MODEL COMPILING COMPLETE
COPYING COMPILED MODEL FILES TO E:\HL2 Compile Toolkit/COMPILED_MODEL_FILES/hl2e
xportstatic...
E:\HL2 Compile Toolkit\bin\temp files\props\models\hl2exportstatic\*
The system cannot find the file specified.
0 file(s) copied.
COPYING COMPILED MODEL FILES TO GAME DIRECTORY...
C:\Program Files\Valve\Steam\SteamApps\G_S_G_9@hotmail.com/half-life 2 Deathmatc
h/hl2mp


in the middle of compile the compiler complains that the model has no sequences

--

|_( hp )¯| p00nst3r

Stuffie
Stuffie Mod DB Star * !
Sep 25 2005 Anchor

You did define a $sequence in your qc before compiling. you NEED a sequence anim. Or it will hate you.

--

Stuffie
User Posted Image

Sep 25 2005 Anchor

ok i changed that heres the compile log:
Hp-p00nst3r.bluewolf72.com
it was able to copy everything but at the end it says "system could not find file specified" other than that, everything looks right

trying in hammer now

UPDATE: Everything looks okay to me
User Posted Image

Edited by (in order): -hp-, -hp-

--

|_( hp )¯| p00nst3r

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 26 2005 Anchor

sorry to miss your update, i looked only for new posts. so far it looks like the coordinate system is ok, but that's only the static mesh. you are missing the texture file to apply there. i'll include it in the zip file that you can use it. otherwise just place a file 'skin.tga' in the same folder with some skin on it.

now what i need more is if the sceleton does work out. somebody here posted once a screenshot with the sceleton drawn. if you can try to get that and try if deforming the mesh with the bones provided works i can put in the rest to make this one complete.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 29 2005 Anchor

i dont think i'd be able to do the 2nd part ur talkinga bout

and whats with the file tht says COPYING in the zip file?

Edited by: -hp-

--

|_( hp )¯| p00nst3r

Sep 29 2005 This post has been deleted.
Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 30 2005 Anchor

auto-weighting is a just a script you do for blender. in fact blender even has an auto-weighting inside. just make no vertex-groups and assign an armature. blender will auto-weight. it's not that good and hand-weighting is still best.

@Hp-P00nst3r: the file COPYING contains the General Public License. this is a requiremenet if you put somethung under GPL.

@All... I still need somebody to test the bones/sceleton export before i can continue.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Sep 30 2005 Anchor

i can export the skeletons but how do u want me to compile the smd file?

ps can u get me a skin

--

|_( hp )¯| p00nst3r

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Sep 30 2005 Anchor

how you do skeletons compilation in HL2SDK i really have no idea. my task here is trying to cook up a HL2 exporter... how to compile this shit afterwards into a engine usable form is none of my beer (especially as i have no HL2SDK and HL2 is something sitting somewhere in a dusty corner of a removable usb hd).

i can make up the rest of the exporter without somebody testing if my exported skeleton is correct, but then i can guarantee for nothing. the only thing i need is a screenshot of the model compiled with the skeleton.

and concerning the texture just use anything you want. it doesn't matter at all what size or content, just something to plug on this baby to see if it works or not.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Oct 1 2005 Anchor

where did u get that wood texture for the skin

--

|_( hp )¯| p00nst3r

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Oct 1 2005 Anchor

from the internet. some free texture i think it has been. but don't ask me from where. just take anything from your pc, or make a screenshot from moddb and use this.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.