How to init G.app

MakeHuman python API, python plugins, etc

Moderator: joepal

How to init G.app

Postby LLX_Code » Wed Aug 16, 2023 8:07 am

Hello guys, I have generated a bunch of mhm files through the mass production. However, I want to get each mhm file's corresponding mesh, like obj file. I read through the forum and could not find an effective guidance. I also followed some instructions but it always returns that G.app is a nonetype, and I do not know how to initialise it. I know this would just be a few lines of codes but I just don't know how to write this.
LLX_Code
 
Posts: 2
Joined: Wed Aug 16, 2023 8:01 am

Re: How to init G.app

Postby LLX_Code » Wed Aug 16, 2023 8:11 am

For example, I tried the following:
Code: Select all
from core import G
application=MHApplication
#application.__init__(G.app)

mhapi = G.app.mhapi
human = mhapi.internals.getHuman()

directory = "C:\\Users\\My_name\\Documents\\makehuman\\v1py3\\models"
for filename in os.listdir(directory):
    if filename.endswith(".mhm"):
        human.load("C:\\Users\\My_name\\Documents\\makehuman\\v1py3\\models\\" + filename, True)
        mhapi.exports.exportAsOBJ(
            "C:\\Users\\My_name\\Documents\\makehuman\\v1py3\\models\\" + filename[0:-4] + ".obj")

    else:
        continue

from one of the screenshot forum, it returns that G.app is a nonetype
LLX_Code
 
Posts: 2
Joined: Wed Aug 16, 2023 8:01 am


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest