Page 1 of 1

Batch model export

PostPosted: Thu Feb 07, 2019 10:57 pm
by doc555
Is there any way to batch export mhm files to fbx instead of I must load and export individually? I think for example command line solution or any other way.
Thanks.

Re: Batch model export

PostPosted: Fri Feb 08, 2019 8:43 am
by joepal
No, there is no such functionality atm.

But I recently adapted the MHAPI plugin to have an export API: https://github.com/makehumancommunity/c ... gins-mhapi

With this, it should be reasonably easy to write a script (for example in the utility->scripting tab) to iterate over files in a directory and export them.

This is a code outline and not tested:

Code: Select all
from core import G
mhapi = G.app.mhapi
human = mhapi.internals.getHuman()

human.load("/full/path/to/mhm/myHuman.mhm", True)
mhapi.export.exportAsFBX("/full/path/to/output/myHuman.fbx")


Note that this currently requires that you have manually downloaded MHAPI, as the exports subset of the API was added after the release of alpha 2.

Re: Batch model export

PostPosted: Thu Mar 07, 2019 11:00 pm
by doc555
Thank you for your info.
I tried the code but I got this error message:
"The script produced an exception: 'API' object has no attribute 'exports'"

Re: Batch model export

PostPosted: Fri Mar 08, 2019 6:12 am
by joepal
Which I think means you didn't update to the latest MHAPI.

Or you could wait a few days and download alpha 3 when it is released. It will include the latest MHAPI.

Re: Batch model export

PostPosted: Thu Apr 18, 2019 7:40 am
by doc555
Thank you. I'm checking it.