Creating a new humanoid model with scripts

If you have problems understanding something or getting started, ask here

Moderator: joepal

Creating a new humanoid model with scripts

Postby Shreyansh_Dubey » Mon Sep 24, 2018 12:19 pm

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:
Shreyansh_Dubey
 
Posts: 9
Joined: Sun Sep 16, 2018 10:09 am

Re: Creating a new humanoid model with scripts

Postby Aranuvir » Mon Sep 24, 2018 6:29 pm

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.
Aranuvir
 
Posts: 1317
Joined: Sun Oct 12, 2014 2:12 pm

Re: Creating a new humanoid model with scripts

Postby Shreyansh_Dubey » Wed Sep 26, 2018 8:44 am

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
Shreyansh_Dubey
 
Posts: 9
Joined: Sun Sep 16, 2018 10:09 am

Re: Creating a new humanoid model with scripts

Postby loki1950 » Wed Sep 26, 2018 3:39 pm

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 :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo Ideapad 320-15ABR Win 10/Mint 19
User avatar
loki1950
 
Posts: 1219
Joined: Thu Dec 18, 2014 6:27 pm
Location: Ottawa,Ontario

Re: Creating a new humanoid model with scripts

Postby Aranuvir » Wed Sep 26, 2018 6:53 pm

@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.
Aranuvir
 
Posts: 1317
Joined: Sun Oct 12, 2014 2:12 pm

Re: Creating a new humanoid model with scripts

Postby Shreyansh_Dubey » Thu Sep 27, 2018 9:56 am

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 ;)
Shreyansh_Dubey
 
Posts: 9
Joined: Sun Sep 16, 2018 10:09 am

Re: Creating a new humanoid model with scripts

Postby antsani » Sat Jun 27, 2020 11:21 pm

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?
antsani
 
Posts: 3
Joined: Sat Jun 27, 2020 10:34 pm

Re: Creating a new humanoid model with scripts

Postby RobBaer » Sun Jun 28, 2020 12:59 am

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.
User avatar
RobBaer
 
Posts: 1219
Joined: Sat Jul 13, 2013 3:30 pm
Location: Kirksville, MO USA

Re: Creating a new humanoid model with scripts

Postby carolyn_wong » Wed Feb 09, 2022 5:05 pm

It is easy to make mistakes in such things. I would turn to the experts with such a question.
User avatar
carolyn_wong
 
Posts: 1
Joined: Wed Jan 05, 2022 7:29 am
Location: Fort Worth


Return to Newbies

Who is online

Users browsing this forum: No registered users and 1 guest