1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Blender dof exporter

Discussion in 'Racer Physics and Technical' started by Stereo, Feb 12, 2015.

  1. Stereo

    Premium Member

    Alright, it's functional enough I'm comfortable uploading it. Several improvements to the python script used for exporting DOFs from Blender.


    Blender 2.63 is I believe the earliest version with one specific change that necessitated updating the script. I've tested it in 2.71.

    Open User Preferences, pick 'Install from File' along the bottom edge. Pick the zip. Go to the Addons tab, and check it. Save User Settings.
    Once you've done this, it should be available in the File>Export menu.

    Selecting it will bring up the File Save window, with this sidebar:
    For now, it can only save to a single dof. I plan to add the batch-style one dof per object again as an option at some point.
    If "Selected Objects" is checked, it'll export the selection - otherwise it'll export everything that can be converted into a mesh.
    If "Apply Modifiers" is checked, it does the obvious, collapses the modifier stack (to be technical, it's using 'PREVIEW' mode - you'll get what you see in the 3d window)
    "Use Parent Origin" transforms objects so their origin is the parent object's. This is to allow the following:
    By placing the Empty "WHEEL_LF" at the center of the wheel, the wheel can be left in its natural position on the model, and on export, the coordinates will treat the location of that empty "WHEEL_LF" as zero, so the wheel rotates correctly.
    "Plus 90 Around X" is just a convenience function for me - Assetto Corsa, the other game I export to, sets up the steering wheel to rotate around +Y, whereas Racer uses +Z, so by checking this, I can export for Racer without having to rotate it back to the Z axis.

    Fixes vs. the one I had from radome a while ago:
    - compatibility with latest (2.63+) versions of Blender by changing 'faces' to 'tessfaces'
    - object position, rotation, and scale are now handled more correctly (you shouldn't need to apply rotations)

    - all objects need a Material assigned.
    - all objects need a UV Map assigned (gonna change this so it just writes 0's)
    - vertex colours no longer supported (although I am not sure their use case)
    - texture names are not currently being referenced from the material. I don't think anyone uses this in the 0.9.0RCs. If you really need it to work, it's currently writing "<MaterialName>.tga" - so if your material's named 'Rim-12spoke', it'll be looking for 'Rim-12spoke.tga'.
    - no check for GOB1 size limits - I've heard more than 20k vertices in a single material is a problem but have not personally tested yet.

    No warranty, etc. save your blend file before trying this. Feel free to upload & modify to other sites.
    Last edited: Feb 15, 2015
    • Like Like x 2
  2. Stereo

    Premium Member

    Fixed some bugs - found why faces were missing (apparently that 2.63 update changed the specs on the array of faces in a subtle way, so faces using vertex 0 didn't always export - or maybe this was a bug in the old one too, I didn't use it a huge amount) - corrected the rotation of normals during the use of 'parent origin' option. File available at the same url in the original post.
  3. Thanks Stereo!
  4. Thanks Stereo. Now if only I could get one of my WIP projects to a level where it needed exporting....<sigh>
  5. Stereo

    Premium Member

    New version that I won't overwrite the old because I don't have the time to exhaustively test again; adds ability to export vertex colors (which does work).
    * check the box on the export screen to include them
    * all objects selected must have vertex colors painted on for it to work
    * it'll use the active vertex colors if multiple are present

    Hopefully I'll add the 'batch' mode that will write out a whole folder of .dofs at once next (for making tracks).