Sunday, August 22, 2010

Problems with the MHX importer.

The names of python calls in Blender 2.5x are currently changing rapidly. This is fundamentally a good thing, because the idea is to make all changes now, so the API can become stable after the 2.54 beta release. However, it also means that existing scripts, including the MHX importer, break on a daily basis. The situation for MHX is especially tricky, because not only does the import script itself depend on the API, but so do the exported MHX files. The current version works with Blender rev 31508, which I compiled from svn on Sunday morning, August 22, but not with revisions that differ significantly from that. The importer will not work with MHX files that have been exported from older versions of MakeHuman.

Another problem has to do with registration of the MHX importer. An old version (0.9) ships as an add-on with Blender, and its existence somehow makes it impossible to reregister a new one. I have partially resolved this problem by including code which attempts to unregister the importer prior to registering the new version (0.15). This works under Linux (more precisely, on my Ubuntu box at home where Blender is compiled from svn), but under Windows the MHX alternative does not show up in the import menu (at least not on my Windows box at work with a recent graphicall build by Cog). It seems like there are a few glitches in the registration process in Blender.

Hence it unfortunately seems like MHX import will remain broken for some time.

Update 2010.08.25


Now I think that MHX is working under Windows, too. It is still impossible to load the import script into Blender's text editor and execute it from there, because Blender complains that some subclass is already registered. But I found a workaround that works, at least for me. Tested with Blender 2.53.1 rev 31550.

1. Copy the file Makehuman/importers/mhx/blender25x/import_scene_mhx.py to Blender/2.53/scripts/addons.
2. Delete or rename the file io_import_scene_mhx.py which is already there. It must not be a Python file.
3. If there is a .pyc file, delete that too.
4. Start Blender.
5. It should now be possible to enable the new MHX import from File > User preferences > Addon. Make sure that you have version 0.15 or later. The version that shipped with Blender is version 0.9
6. Import the mhx file from the File > Import menu.

These steps should work on Linux as well, but it might also be possible to execute from the editor.

10 comments:

  1. Well at least there is some good news on the API renaming front. :D From blendernation.com

    Quote:
    Renaming of all variables for button names and Python calls (i.e. in RNA) is basically done, Campbell awaits feedback on last renames.

    Link: blendernation.com

    ReplyDelete
  2. ...and if you're on a mac you'll need to open the blender.app package to get to the 2.53/scripts/addons folder

    ReplyDelete
  3. also it would be cool if we could follow your mhx related posts on planetblender.org or on the belndernation stream!

    ReplyDelete
  4. I followed the posted instructions. The importer registered alright in Blender, but when I went to import the MHX file, it would not import, I get the following message:
    File "C:\PROGRA~1\Blender\2.53\scrips\addons\import_scene_mhx.py", line 2250, in pushOnTodoList
    raise NameError("Todo", expr)
    NameError: ('Todo', 'tex.brightness = 1')

    ReplyDelete
  5. what's the reason behind your "own" exhange format. why not use collada?

    ReplyDelete
  6. ok maybe not everything can be exported with .dae, I see you export quite advanced with IK/FK armatures etc. nice.

    ReplyDelete
  7. Look at the collada spec, and you'll have the answer :).

    ReplyDelete
  8. I just downloaded the MH Win and the importer for MHX in Blender has the 0.9 revision number.

    Where is that 0.15 ???

    ReplyDelete
  9. It is in MakeHuman's svn, more precisely at http://code.google.com/p/makehuman/source/browse/#svn/trunk/makehuman/importers/mhx/blender25x . It is also in the nightly builds, if they still exist.

    ReplyDelete
  10. Can you please post the latest version of blender for which there is a functional makehuman importer.
    Just tried the official beta 2.54 against the nightly MH release and it doesn't seem to work.
    Thank you

    ReplyDelete

© MHteam 2001-2010