Page 1 of 1

Creating a new humanoid model with scripts

PostPosted: Mon Sep 24, 2018 12:19 pm
by Shreyansh_Dubey
I just want a sample script to learn how can I edit models and create new models and save them. I have downloaded the MHAPI from Github https://github.com/makehumancommunity/c ... gins-mhapi and I am using Makehuman on Ubuntu which I have downloaded from https://github.com/makehumancommunity/makehuman
Please just tell me how can I use only scripting to create a new Human models in the default pose only, actually I want to just see once how MHAPI functions are used, what all libraries and classes do I have to import, so just someone help me with a sample script. :?
NOTE: I don't require the usage of Blender at all, however if the above task and the below task are not possible without Blender then do tell me how will Blender help me.
Other than that my actual task is to create a dataset of 10000 makehuman models using a script, that i will see rightnow I am just concerned about the basics.
Thankyou :geek: :ugeek:

Re: Creating a new humanoid model with scripts

PostPosted: Mon Sep 24, 2018 6:29 pm
by Aranuvir
I assume you know programming in Python. You're running MakeHuman from current master. Be aware that the code is currently not 100% for production, e.g. FBX export does not work, atm. You can use 7_shell for testing. For convenience, I'd recommend to install jupyter-qtconsole (and of course all Jupyter stuff needed for qtconsole) via apt. This should give you a better shell... (7_data.py can be helpful, too).

Here some starting points to try out inside the interactive shell:
Code: Select all
[1] from core import G # can be omitted in MakeHuman's internal shell

[2] human = G.app.selectedHuman

[3] dir(human)

[4] human.targetsDetailStack


Code: Select all
# someTarget is a target name of your choice, weight is a float with 0.0 <= weight <= 1.0. A target is the equivalent to Blender's 'shape key' and weight is the amount this shape key will be applied.

[5] import getpath as gp

[6] human.setDetail(gp.getSysDataPath('targets/' + someTarget + '.target'), weight) # setDetail takes the path to a target file and a weight (or strength) value (actually you should use os.path.join.... 8-B)

[7] self.human.setDetail(gp.getDataPath('custom/' + someTarget + '.target'), weight)

#and finally
[8] human.applyAllTargets()


Code: Select all
[9] human.modiferNames

[10] modifier = human.getModifier('macrodetails/Age')

[11] modifier.getValue()

[12] modifier.setValue(1.0)

[13] human.applyAllTargets()

[14] modifier = human.getModifier('measure/measure-ankle-circ-decr|incr')

[15} modifier.getValue()

[...]


Hope this helps a bit. BTW, please decide which subforum you are going to post to.

Re: Creating a new humanoid model with scripts

PostPosted: Wed Sep 26, 2018 8:44 am
by Shreyansh_Dubey
Thanks a lot sir I am now able to start and understand how these object modifiers are being used to set value. Just one more thing if you can tell, when use modifier.setValue(1.0), it just sets the scale in increment or decrement, that is fine with the Macro modifiers, but what my major objective is how do i set the measure values in cms or inches using this. Actually i want to define my own set of measurements for each of the measure modifiers

Re: Creating a new humanoid model with scripts

PostPosted: Wed Sep 26, 2018 3:39 pm
by loki1950
Your main issue will be translating the 0 ->1 to actual real world measurements as there is NO one- to one function our measurements are determined after all the targets are applied(by calculation on the final mesh) and as I stated early the lack of said function means it's a one way operation developing that function will not be trivial.BTW this function has been asked for since the inception of the project but was determined to be beyond our scope.

Enjoy the Choice :)

Re: Creating a new humanoid model with scripts

PostPosted: Wed Sep 26, 2018 6:53 pm
by Aranuvir
@Shreyansh_Dubey: you could try to work through "0_modeling_a_measurement.py". Maybe you find something of use in there. When it comes to model randomization, "0_modeling_8_random.py" might be of interest, too.

Re: Creating a new humanoid model with scripts

PostPosted: Thu Sep 27, 2018 9:56 am
by Shreyansh_Dubey
loki1950 wrote:Your main issue will be translating the 0 ->1 to actual real world measurements as there is NO one- to one function our measurements are determined after all the targets are applied(by calculation on the final mesh) and as I stated early the lack of said function means it's a one way operation developing that function will not be trivial.BTW this function has been asked for since the inception of the project but was determined to be beyond our scope.

Enjoy the Choice :)


Actually I understood this thing when I saw these values are so interdependent on each other that creating a lookup table and calculation common ratios for scale translations is not that easy, this requires to modify the whole scaling of the Makehuman software and that means a lot of work. But thanks that you told it is beyond current scope otherwise I would be still searching and digging into open source codes for it. Now I will somehow bypass its need for my project ;)

Re: Creating a new humanoid model with scripts

PostPosted: Sat Jun 27, 2020 11:21 pm
by antsani
is deciphering the 0-1 into real world measurements still a giant task? Wasn't sure if recent releases have made this easier or not?

Re: Creating a new humanoid model with scripts

PostPosted: Sun Jun 28, 2020 12:59 am
by RobBaer
antsani wrote:is deciphering the 0-1 into real world measurements still a giant task? Wasn't sure if recent releases have made this easier or not?

Unfortunately no new news here.