New File Added: Mesh2DOF_blender255_migration_WIP.zip

<<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
Code:
# 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():
        imp.reload(Mesh2DOF)
        
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):
        context.window_manager.fileselect_add(self)
        return {'RUNNING_MODAL'}    

def menu_func_export(self, context):
    self.layout.operator(ExportDOF.bl_idname, text="DOF1 (.dof)")
    
def register():
    bpy.utils.register_module(__name__)

    bpy.types.INFO_MT_file_export.append(menu_func_export)

def unregister():
    bpy.utils.unregister_module(__name__)

    bpy.types.INFO_MT_file_export.remove(menu_func_export)

if __name__ == "__main__":
    register()

and here is the changed --from the upload referred to by this thread-- portion of the Mesh2DOF.py file.
Code:
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:
		print(obj)
		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:
....\2.57\scripts\addons\io_export_mesh_dof
or this folder:
..../2.57/scripts/addons/io_export_mesh_dof
and populate it with:
__pycache__ <-- a folder
__init__.py
DOFfile.py
Mesh2DOF.py
VertOpt.py
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
 
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.
 
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!?

Hmmm

Dave
 
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.
 

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top