Just some observations, though I haven't really played around with this part of code.
If you intend to do scripting at all, it could be helpful to get to know greater parts of the code, so either download MakeHuman source code from bitbucket (P2) or github (P3) and get an IDE of your choice (I'd recommend PyCharm Community Edition) with code inspection functionality. (Though, recently it has become difficult to get all dependencies needed to run from source (= PyQT4), best choice is a Linux platform.)
In your example self.human is defined as:
- Code: Select all
from core import G
self.human = G.app.selectedHuman
You can use MakeHuman's built-in data inspection (tab utilities/data) to see what selectedHuman consists of. If you take a look a 9_export_collada/mh2obj.py you can see that selectedHuman provides a method called getObjects, from there you can pull the meshes and so on ...
- Code: Select all
objects = self.human.getObjects(excludeZeroFaceObjs=Ture/False)
And then:
- Code: Select all
meshes = [o.meshes for o in objects]
It might be helpful to take a look at apps/guiexport.py and shared/wavefront.py, too.
The method writeObjFile from wavefront.py has a glitch in P3, the line
- Code: Select all
if isinstance(path, file):
should be replaced by something like
- Code: Select all
if isinstance(path, io.IOBase):
or
if hasattr(path, 'write'):
if not the check is superfluous at all. Fixing this in my branch ...