1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. #GiveAwayFriday. Win a copy of F1 2017 - The Game. Click here to join.

Blender dof exporter

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

  1. Stereo

    Stereo

    Messages:
    2,344
    Ratings:
    +1,371
    Alright, it's functional enough I'm comfortable uploading it. Several improvements to the python script used for exporting DOFs from Blender.

    Download:
    http://nmurdoch.ca/scripts/io_export_dof.zip

    Compatibility:
    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.

    Installation:
    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.
    [​IMG]
    Once you've done this, it should be available in the File>Export menu.

    Usage:
    Selecting it will bring up the File Save window, with this sidebar:
    [​IMG]
    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:
    [​IMG]
    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)


    Gotchas:
    - 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.

    Misc:
    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

    Stereo

    Messages:
    2,344
    Ratings:
    +1,371
    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. boomer541

    boomer541

    Messages:
    1,347
    Ratings:
    +164
    Thanks Stereo!
     
  4. radome

    radome

    Messages:
    169
    Ratings:
    +24
    Thanks Stereo. Now if only I could get one of my WIP projects to a level where it needed exporting....<sigh>
     
  5. Stereo

    Stereo

    Messages:
    2,344
    Ratings:
    +1,371
    http://nmurdoch.ca/scripts/io_export_dof_0.3.zip
    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).