Blender DAE Exporter for HWRM

(Christoph Timmermann) #182

“Fam” is a property for dockpaths. It defines which ship families can use that path.
@DKesserich put these properties in Blender’s custom properties to shorten the node names AFAIK.

(D Kesserich) #183

Right. Like I said in the importer thread there was still some work to do with getting imported DAEs to be exportable again because of all the custom properties the exporter relies on.

I just updated the import script to create all the dock nodes with the custom properties. As it is right now you’ll still have to rename the main dock nodes and the seg nodes to just have the DOCK[DockPathName] and SEG[SegNumber] instead of all the properties in the name, otherwise the properties will get re-appended to the object name and I suspect HODOR won’t like it. I tried to do that in the importer, but it messed up the hierarchy sort step because the object names didn’t match the node names in the DAE anymore.

(D Kesserich) #184

Hey everybody!

So I decided I really didn’t like the Better Collada Exporter base for the exporter, so I’ve re-written the whole thing from scratch.

This brought a host of benefits:

  • I’ve been able to cut down the size of the script significantly. Better Collada Exporter was 2005 lines of python, HWRM Collada Exporter is 545
  • Animations now export 100% correctly. BCE had this weird hack where (originally) it just exported animation data one frame at a time for the entire available animation range. I altered that for the HW Edition one so it only did every frame between the start and end frames of any action. With HWRM CE I’m finally only exporting the keyframes. This also means I’m exporting the Intan and Outtan data, which means animation curves actually work right (I think? The data is there, but Open3DModelViewer doesn’t seem to be respecting it. I haven’t tried opening my tests in DAEnaerys yet)
  • This brings the additional benefit of sped up export times, as well as further reducing the size of the DAEs, especially if they had lots of animations.
  • I was able to remove all the potentially confusing options from the export dialogue. Now you just click Export and choose your file path.

All that said, I’m not 100% sure that everything is working right (the DAEs get exported, HODOR builds hods and mad files, so far so good, but my DAEs aren’t all the complex), so I need some people to put the new exporter through its paces and make sure it’s doing everything it’s supposed to.

It can be downloaded from here

The only thing that’s really changed from a user standpoint is that in the material settings you must set the Specular type to PHONG. I don’t know why, but HODOR will ignore any effects data that is not encased in a ‘phong’ element.

(BitVenom) #185

Post/PM me some alternate examples? Likely it is because I’ve only ever seen phong from the path I used (3DS MAX->DAE) - so supporting others isn’t any major issue… just need examples!

Also, THANK YOU for this work - it is phenomenal!

(Sastrei) #186

@BitVenom I want to say blender uses “cooktorr” as the default specular shader. Just because it’s blender and it wants to be different. :stuck_out_tongue:

@DKesserich I’ll try it out! We’re you able to take a look at setting up the lights parameters for backgrounds to get around string limitations the way navlights do?

(Christoph Timmermann) #187

Thank you very much for the work. :slight_smile:
I tried to export a simple fighter that worked fine before, but it threw an error.


EDIT: This seems to be happening with every other ship I try.

Writing Root
Writing Library Visual Scenes
Writing Library Images
Writing Library Materials
Writing Library Effects
Writing Library Geometries
Writing Library Animations
Writing Node for ROOT_COL
Writing Node for COL[Root]
Writing Node for ROOT_INFO
Writing Node for Class[MultiMesh]_Version[512]
Writing Node for UVSets[1]
Writing Node for ROOT_LOD[0]
Writing Node for JNT[Ter_Rapier]
Writing Node for JNT[EngineNozzle1]
Writing Node for BURN[EngineBurn1]
Writing Node for Flame[0]_Div[0]
Writing Node for Flame[0]_Div[1]
Writing Node for Flame[0]_Div[2]
Writing Node for Flame[0]_Div[3]
Writing Node for Flame[0]_Div[4]
Writing Node for ETSH[EngineShape1]
Writing Node for JNT[EngineNozzle2]
Writing Node for BURN[EngineBurn2]
Writing Node for Flame[0]_Div[0].001
Writing Node for Flame[0]_Div[1].001
Writing Node for Flame[0]_Div[2].001
Writing Node for Flame[0]_Div[3].001
Writing Node for Flame[0]_Div[4].001
Writing Node for ETSH[EngineShape2]
Writing Node for JNT[EngineNozzle3]
Writing Node for BURN[EngineBurn3]
Writing Node for Flame[0]_Div[0].002
Writing Node for Flame[0]_Div[1].002
Writing Node for Flame[0]_Div[2].002
Writing Node for Flame[0]_Div[3].002
Writing Node for Flame[0]_Div[4].002
Writing Node for ETSH[EngineShape3]
Writing Node for JNT[Weapon_EMPlasma_Position]
Writing Node for JNT[Weapon_EMPlasma_Direction]
Writing Node for JNT[Weapon_EMPlasma_Muzzle]
Writing Node for JNT[Weapon_EMPlasma_Rest]
Writing Node for MARK[marker1]
Writing Node for MARK[marker2]
Writing Node for MARK[marker3]
Writing Node for MARK[marker4]
Writing Node for MARK[marker5]
Writing Node for MARK[marker_death]
Writing Node for MULT[Ter_Rapier]_LOD[0]_TAGS[DoScar]
Writing Node for ROOT_LOD[1]
Writing Node for MULT[Ter_Rapier]_LOD[1]_TAGS[DoScar]
Info: Applied modifier was not first, result may not be as expected
Traceback (most recent call last):
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 123, in execute
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 542, in save
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 522, in doExport
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 65, in writeMaterials
    thisMaterial = ET.SubElement(libMats,'material',id=matName,name=matName)
NameError: name 'ET' is not defined

location: <unknown location>:-1

location: <unknown location>:-1

(D Kesserich) #188

Aw, crap. I knew I forgot something!

I’ll fix that as soon as I get home from work.

(D Kesserich) #189

Fixed now. Same download link as before.

@sastrei: I actually haven’t looked at background export at all. I’ll try poking at it next weekend. It’ll probably involve adding come new create options.

(Christoph Timmermann) #190

Hmm… it exports now, but there are some weird issues.
It seems like it exports the nodes with their absolute location rather than using the relative one.

(D Kesserich) #191

I’m a dumb. Was getting global positions and rotations instead of local. Fixed now. Same download link.

Hopefully this doesn’t mess up animations any. Annoyingly, Open3DModelViewer doesn’t seem cool with scientific notation in a DAE file.

(Christoph Timmermann) #192

It works now, but has problems with one DAE I try to export.

Traceback (most recent call last):
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 123, in execute
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 543, in save
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 526, in doExport
  File "D:\Programme\Blender\2.78\scripts\addons\HW_Toolkit\", line 62, in writeTextures
    init.text = D.textures[texName].image.filepath
AttributeError: 'Texture' object has no attribute 'image'

location: <unknown location>:-1

Wasn’t able to test animations yet.

(Taiidan Republic Mod) #193

What is different about that ship? Does it have an engine glow or innate material without an image by any chance?

(Christoph Timmermann) #194

It only has a ship mesh with three materials (diffuse textures) assigned and a collision mesh without any material.

(D Kesserich) #195

Do you have a texture slot with no image textures assigned somewhere? Maybe using a procedural for baking or something?

(Christoph Timmermann) #196

No. I have just redone the materials, same issue.
I even tried it with a “fresh” ship, same issue.

Here is a little example of the error:

(D Kesserich) #197

Found it. There’s an unused texture named ‘Tex’ in your textures. It doesn’t have any users, so it’s weird that it’s crapping up the array still. I’ll add a check to only write textures if they have an image attribute when I get home.

(D Kesserich) #198

Fixed. Same download.

(Pbobbert) #199


I’m having a lot of trouble trying to get a .hod into HWRM without the game crashing upon trying to load the universe. I have followed your crash course tutorial, your quality of life tutorial, as well as the example showing ship building posted on Aug 15.

I have not had any issues using the .dae exporter (i think), and hodor seems to be working.

example hodor output

C:\Games\SteamC\steamapps\common\Homeworld\GBXTools\HODOR>hodor -script=myparams.hodor
DAE->HOD: Loading D:\HomeworldTFS\ship\cube\cube.DAE
DAE->HOD: Creating Homeworld2 Multi Mesh File - Version 512
Parsing C:\Games\SteamC\SteamApps\common\Homeworld\GBXTools\HODOR\SHADERS.MAP
DAE->HOD: Generating Scene Data LOD[0]
DAE->HOD: Generating Collision Meshes
DAE->HOD: Generating Animation Channels

Press any key to continue . . .


However when I rename my cube.hod to kus_scout.hod and place it into the folder it makes the game crash.

Would you be willing to take a look at my cube.blend and tell me if there is anything wrong with it? I am using the most up to date blender 2.7.8 and I have tried both the 1.1.3 exporter and the one found in this thread labeled master. (I also wanted to point out that in blender both of these show up as 1.1.2)

Here is a link to my cube.blend

Similarly, when I do the same thing with the demo_ship.hod I have the same error. Also as a curious note visual studio cannot open the demo_ship.dae without crashing. But it can open all of my exported .dae files just fine.


(Sastrei) #200

@pbobbert See if it works with a valid material.

(D Kesserich) #201

There are a couple of things wrong.

  • Like sastrei says, your material name isn’t following the proper material naming convention. It has to be MAT[a_material_name_here]_SHD[shader_name_here (usually this will be 'ship')].
  • You also have a texture assigned to the material that isn’t following the texture slot naming convention. IMG[image_name_without_extension]_FMT[compression_format(usually DXT1)]

Also, the 2.0 patch changed a lot of stuff about the Kushan and Taiidan Scout’s ship file. Iirc it has something to do with how the boost effect is attached now? And I don’t know what the node name is or where in the hierarchy it’s supposed to go and I haven’t been able to get the straight swap to work since then when I use the Scout. Try using the light corvette instead. The process is pretty much exactly the same, but you might have to add another weapon line to the .ship file since the light corvette only has one gun.