MakeHuman to Egg

I might be overstating the obvious here. First wouldn’t it be far more simplistic to go from MakeHuman directly to Egg format? Both are written in Python code and MH supports export plugins for python.

Before someone reinvents the wheel, I did several searches for MakeHuman to Egg plugin and came up empty. I would like to hear back from anyone interested in attempting to create such a plugin and lending a hand.

MakeHuman has several export formats already available;

  1. bvh
  2. collada
  3. fbx
  4. md5 (Quake)
  5. mhx (Blender)
  6. obj (wavefront)
  7. ogre
  8. stl (Stereolithography aka 3D printers)

Some may say to convert to Blender and then to Egg. But that is an extra step and very messy having to deal with the layers, UV, and animation. Not to mention learning another program (unless you must) just to convert a file from one format to another.

I believe Egg should be a direct export too. I am assuming the task only requires the model mesh and textures to be dumped into the Egg text file format. Most of these plugins have little code and I know from viewing the contents of an Egg, it has a format not unlike an OBJ file. I attach here the export of MH to OBJ plugin as an example;
init.py

#!/usr/bin/python2.7
# -*- coding: utf-8 -*-

"""
**Project Name:**      MakeHuman

**Product Home Page:** http://www.makehuman.org/

**Code Home Page:**    https://bitbucket.org/MakeHuman/makehuman/

**Authors:**           Thomas Larsson

**Copyright(c):**      MakeHuman Team 2001-2014

**Licensing:**         AGPL3 (http://www.makehuman.org/doc/node/the_makehuman_application.html)

    This file is part of MakeHuman (www.makehuman.org).

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

**Coding Standards:**  See http://www.makehuman.org/node/165

Abstract
--------

TODO
"""

from export import Exporter
from exportutils.config import Config

class ObjConfig(Config):

    def __init__(self):
        Config.__init__(self)
        self.useRelPaths = True
        self.useNormals = False


class ExporterOBJ(Exporter):
    def __init__(self):
        Exporter.__init__(self)
        self.name = "Wavefront obj"
        self.filter = "Wavefront (*.obj)"
        self.fileExtension = "obj"
        self.orderPriority = 60.0

    def build(self, options, taskview):
        import gui
        Exporter.build(self, options, taskview)
        self.useNormals = options.addWidget(gui.CheckBox("Normals", False))

    def export(self, human, filename):
        from progress import Progress
        from . import mh2obj

        progress = Progress.begin() (0, 1)
        cfg = self.getConfig()
        cfg.setHuman(human)
        mh2obj.exportObj(filename("obj"), cfg)

    def getConfig(self):
        cfg = ObjConfig()
        cfg.useNormals = self.useNormals.selected

        cfg.useTPose          = False # self.useTPose.selected
        cfg.feetOnGround      = self.feetOnGround.selected
        cfg.scale,cfg.unit    = self.taskview.getScale()

        return cfg

def load(app):
    app.addExporter(ExporterOBJ())

def unload(app):
    pass

mh2obj.py

#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import wavefront
import os
import exportutils
from progress import Progress
import proxy

#
#    exportObj(human, filepath, config):
#

def exportObj(filepath, config=None):
    progress = Progress(0, None)
    if config is None:
        config = exportutils.config.Config()
    human = config.human
    config.setupTexFolder(filepath)
    filename = os.path.basename(filepath)
    name = config.goodName(os.path.splitext(filename)[0])

    progress(0, 0.3, "Collecting Objects")
    objects = human.getObjects(excludeZeroFaceObjs=True)

    progress(0.3, 0.99, "Writing Objects")
    wavefront.writeObjFile(filepath, objects, True, config)

    progress(1.0, None, "OBJ Export finished. Output file: %s" % filepath)

If I am wrong, I apologize for the inconvenience.

—Edited for additional information–
Before I nod off to sleep I found the format of the Egg to be less like OBJ than I had thought, but I am working on it. I am comparing the files I made with a simple cube. DFX, EGG, OBJ, and X formats can all be read from any text editor.

DFX defines the cube in a file 207 lines long 694 bytes.
EGG defines the same cube in a file 183 lines 4238 bytes.
OBJ file is by far simplistic at 16 lines and 157 bytes.
X defines the cube in 65 lines at 1419 bytes.

I will get back to you when I have more information also I will be knocking on the door of the MakeHuman community as well. There is no reason they can’t pitch in and help.