• This Website Is Not For Sale
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

New File Added: Mesh2DOF_blender255_migration_WIP.zip

Discussion in 'Racer' started by radome, Nov 16, 2010.

  1. Downloads: A new file has been added by radome:


    This is a work in progress and may just barely work. It probably needs experts to fine tune it.
    Last edited: Dec 5, 2013
  2. Thank you!
  3. You are welcome. Hopefully, even now, someone is polishing it up so that it can be a real blender 2.5 addon :o)
  4. <<BUMP>> Oh! I'm someone.

    In his best Morpheus-addresses-the-citizens-of-Zion voice he said:
    Rise up! and start using Blender two-five!
    Here is my WIP on the Blender 2.57 addon-ness of the Brent Burton Mesh2DOF package!

    Here is __init__.py
    # This file is part of a migration of an original package to 
    # the new Blender 2.5 architecture. Regarding the copying of files
    # in that package the original author stated ->> 
    # ->>This file may be copied.  However, if you make improvements,
    # ->>please send me a copy.
    # Revision history---------------------------------------------------
    # ->>Brent Burton <brentb@relro.net>
    # ->>Originally released: July 2003
    # ->>RaceSimCentral: vizor_atx
    # ->>----------------------------------------------------------------
    # radome <radome914gt@att.net>
    # Migration to Blender 2.5 architecture: 2010 - 2011
    # ->>Convert a Blender NMesh object to a DOF
    # -------------------------------------------------------------------
    # ->>file.  This module needs the DOFfile module.
    bl_info = {
        "name": "Mesh2DOF",
        "author": "Brent Burton, migration to 2.5 by radome",
        "version": (0, 2, 2),
        "blender": (2, 5, 7),
        "api": 35622,
        "location": "File > Export",
        "description": "Export Mesh Objects to DOF1 files",
        "warning": "Work In Progress",
        "wiki_url": "",
        "tracker_url": "",
    	"support": 'COMMUNITY',
        "category": "Import-Export"}
    # Reload the package on Blender F8 keypress
    if "bpy" in locals():
        import imp
        if "Mesh2DOF" in locals():
    import bpy
    from bpy.props import BoolProperty, FloatProperty, StringProperty
    from io_utils import ExportHelper, ImportHelper
    class ExportDOF(bpy.types.Operator, ExportHelper):
        '''Export mesh objects as DOF (.dof) files'''
        bl_idname = "mesh_obj.dof"
        bl_label = "Mesh Objects to DOF"
        bl_options = {'PRESET'}
        directory = bpy.props.StringProperty(subtype="DIR_PATH")
        filename_ext = ".dof"
        filter_glob = StringProperty(default="*.dof;*.DOF", options={'HIDDEN'})
        # List of operator properties, the attributes will be assigned
        # to the class instance from the operator settings before calling.
        # context group
        use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default=False)
        layer = StringProperty(name="Scene Layer Number", description="Export from this scene layer number", default="1")
        scale = FloatProperty(name="Scale", description="Scale is an inverse-modeling factor", default=1.0)
        def execute(self, context):
            from . import Mesh2DOF
    #       if not use_selection:
            return Mesh2DOF.ExportLayer(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
    #        else:
    #        return Mesh2DOF.ExportLayer(specific_layer, targetdir, target_scale)
        def invoke(self, context, event):
            return {'RUNNING_MODAL'}    
    def menu_func_export(self, context):
        self.layout.operator(ExportDOF.bl_idname, text="DOF1 (.dof)")
    def register():
    def unregister():
    if __name__ == "__main__":
    and here is the changed --from the upload referred to by this thread-- portion of the Mesh2DOF.py file.
    from bpy import *
    #from bpy import bpy.data bpy.ops bpy.props bpy.types bpy.context bgl blf mathutils geometry
    from . import DOFfile, VertOpt
    #---------------- module version info
    version = 1.0
    # PUBLIC ExportLayer()
    # Scale is an inverse-modeling factor.
    # I.e., if the modeling in Blender is done at 1:10, scale would be 10.0.
    def ExportLayer(operator, context, filepath, use_selection, layer, directory, scale=1.0):
    	"""Exports all mesh objects from a particular layer.
    	If layer==-1, all mesh objects are exported.
    	The resulting DOF files are stored in 'directory'.
    	numExported = 0
    	totalVin = 0
    	totalVout = 0
    	totalVopt = 0
    	totalTris = 0
    	layer = int(layer)
    	for obj in bpy.data.objects:
    		if layer == -1 or obj.layers[layer - 1] == True:
    			if not use_selection or (use_selection and obj.select == True):
    				if obj.type == "MESH":
    					print ("Exporting mesh " +  obj.name)
    					(vin, vout, vopt, tris) = ExportMesh(obj, directory, scale)
    					print ("---> Vin: %d  Vout: %d  Vopt: %d Tris: %d" % (vin, vout, vopt, tris))
    					totalVin += vin
    					totalVout += vout
    					totalVopt += vopt
    					totalTris += tris
    					numExported += 1
    					print ("%d meshes exported into %s" % (numExported, directory))
    					print ("Totals: Vin: %d  Vout: %d  Vopt: %d Tris: %d" % (totalVin, totalVout, totalVopt, totalTris))
    # EOF
    Just make this folder:
    or this folder:
    and populate it with:
    __pycache__ <-- a folder
    and start Blender 2.57 and look at Add-Ons Import-Export tab of File -> User Preferences to enable it.

    Remember: You need Materials with textures on all faces. Not just textures applied to UV coordinates in edit mode.
    Don't look for support on blender.org yet as this has not been uploaded to the trackers
  5. Still don't know why Blender separates these. Just makes it harder to get expected texture behaviour from edit mode.
  6. I still use Blender ver 2.45 as it does everything I want it to and am trying to learn Python so that I can make an exporter for the .DSkeleton file. I'm making progress very slowly as I have trouble getting Python to do what I want it to.

    Sure could use some help from a good Python programmer.
  7. Does anyone have the file mentioned in this thread? It doesn't work anymore and I'd like to convert my Blender build car to Racer.
  8. Does Blender not have an ASE exporter?

  9. The modeller process is quite good really, the biggest issue is that it is lots of pressing etc.

    If it could be automated with a batch system it'd be very nice though.

    Ie, load all ASE in a folder, scale, optimise, export to $.dof or whatever... delete ASE.

    That way you can just have a Blender > ASE workflow and double click the batch each time and it'd just turn the latest ASE > dof and delete the ASE behind it.

    Of course, building a proper DOF exporter is the ideal route. One thing I didn't realise was that Some1's tool doesn't support smooth groups, wheras the ASE > modeller > DOF route does, and the Racer CTR also supports smooth groups. But then one is very slow and the CTR splits meshes by shader which is also annoying hehe.

    A decent DOF exporter is probably a bit more complex to write than you think initially...

    It'd be nice if Ruud could add batch support to modeller.exe... maybe it's already there though!?


  10. Thank you both. ASE exporter to modeler seems to be the way to go. At first I had some problems with triangle conversion making some of the faces/polygons disappear in modeler and textures not exporting.. But I finally solved both and got the car in the game. :)

    Now to try again with a complete car.