Automaton animation

Images of characters done with MakeHuman

Moderator: joepal

Re: Automaton animation

Postby jcpalmer » Thu Jun 01, 2017 9:34 pm

Ok, I have a preliminary feature to transfer Expressions to a PoseLibrary. I PR'ed and approved it. I ended up using the directory ops calls with some changes to get pose available to Blender.

These 2 calls give me both the make human & user directories. I just then read each .mhpose file directly in Blender, so no need to gather up info in MH pass it back, then go through it in Blender.

The SyncPose operator is then called in a loop, passing the file name of the expression to return. The result of the call is saved in the poselibrary with the name matching the name field in the .mhpose file.

Only problem is I do not know near enough about MH to actually change the expression in code. It creates all the poses with the right names, but they are all the same expression. Help, please.
jcpalmer
 
Posts: 115
Joined: Tue Dec 16, 2014 4:14 pm

Re: Automaton animation

Postby joepal » Fri Jun 02, 2017 6:49 am

That's nice.

I'll take a look at it tomorrow and see if I can figure out the missing step.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4474
Joined: Wed Jun 04, 2008 11:20 am

Re: Automaton animation

Postby jcpalmer » Fri Jun 02, 2017 6:03 pm

Thanks. In the meantime, I just updated the documentation page.
expressionDoc.jpg

BTW, I did isolate that expressions get loaded in the 2_posing_expression plug-in. There is a chooseExpression() method which takes a filename arg. After that, I have no clue, but passing a filename string means the Blender side is done.

2_posing_expression.py
jcpalmer
 
Posts: 115
Joined: Tue Dec 16, 2014 4:14 pm

Re: Automaton animation

Postby joepal » Sat Jun 03, 2017 10:23 am

Yeah, applying poses in MH is a somewhat involved process, where you have to create an animation first. And on top of that, for expressions you might have to mix two poses.

I'll see if I can wrap this in an easier manner in MHAPI and then expose it as as a new socket call.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4474
Joined: Wed Jun 04, 2008 11:20 am

Re: Automaton animation

Postby joepal » Sat Jun 03, 2017 10:41 am

For future reference (mainly so I find it again later this afternoon), here is how to rotate individual bones in order to create a pose manually: viewtopic.php?f=4&t=14356&p=39209#p39209
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4474
Joined: Wed Jun 04, 2008 11:20 am

Re: Automaton animation

Postby joepal » Sat Jun 03, 2017 3:21 pm

So far so good... I've been able to make a MHAPI wrapper for setting an expression with a single file name as argument. I'm working in a separate branch in the MHAPI repo atm, see https://github.com/makehumancommunity/c ... keleton.py, line 61.

With this, I was able to use the scripting tab to run the following:

Code: Select all
from core import G
mhapi = G.app.mhapi
mhapi.skeleton.setExpressionFromFile('/home/joepal/source/makehuman_stable_with_assets/makehuman/data/expressions/cry01.mhpose')


If I wrap this with an operator in the socket plugin, is that approximately what you'd need?
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4474
Joined: Wed Jun 04, 2008 11:20 am

Re: Automaton animation

Postby jcpalmer » Sat Jun 03, 2017 8:58 pm

Great!

I have already reorganized the Blender side so that the SyncOperator class does not inherit from bpy.types.Operator, essentially a button callback. Makes calling the directory ops to get the directories, which should never really be buttons easy to call where ever. Also makes the easily SyncPose callable in a loop. Remember also that you can pass parameters in the socket calls. The SyncPose call conditionally passes a poseFilename parameter.

I do not want a separate socket call. I want to use the SyncPose call, as there is considerable processing in applying the return data to the skeleton. I think checking for a poseFilename parameter right in the SyncPose socket code is the way I was expecting. Like:

Code: Select all
    def getPose(self,conn,jsonCall):
       
        poseFilename = jsonCall.params["poseFilename"]
        if poseFilename is not None:
            from core import G
            mhapi = G.app.mhapi
            mhapi.skeleton.setExpressionFromFile(poseFilename)
       
        self.parent.addMessage("Constructing dict with bone matrices.")
       
        skeleton = self.human.getSkeleton()
        skelobj = dict();

        bones = skeleton.getBones()
       
        for bone in bones:
            rmat = bone.getRestMatrix('zUpFaceNegY')
            skelobj[bone.name] = [ list(rmat[0,:]), list(rmat[1,:]), list(rmat[2,:]), list(rmat[3,:]) ]

        print skelobj

        jsonCall.data = skelobj
jcpalmer
 
Posts: 115
Joined: Tue Dec 16, 2014 4:14 pm

Re: Automaton animation

Postby joepal » Mon Jun 05, 2017 7:14 am

Ok, there's a semantic quirk here though: There are two different kinds of poses. "Expressions" are actually a collection of face units which in a second step causes a pose, while there are also "poses" which are poses directly. The difference being that an expression is collected in a ".mhpose" file referring to frames in a BVH file, while a pose is fetched directly from a BVH file verbatim.

I've extended the code example you wrote to take both into account, see https://github.com/makehumancommunity/c ... 5f874a5383

Note that I've taken the opportunity to break out the socket server to a separate repo now too, as I'm going to ensure py3 compatibility and so forth. The only things remaining active in the old community-plugins repo is now the blender side stuff, and the CLI stuff. The new repo is here: https://github.com/makehumancommunity/c ... ins-socket

I have not actually tested any of these things, just made sure the plugin loads.

I sent a github invite with write permission for the new repo.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4474
Joined: Wed Jun 04, 2008 11:20 am

Re: Automaton animation

Postby jcpalmer » Mon Jun 05, 2017 5:36 pm

Everything except Blender & CLI could then be deleted from this repo, right?

I might not get to testing this till tomorrow. Will not be testing the .bvh route.
jcpalmer
 
Posts: 115
Joined: Tue Dec 16, 2014 4:14 pm

Re: Automaton animation

Postby joepal » Mon Jun 05, 2017 6:38 pm

jcpalmer wrote:Everything except Blender & CLI could then be deleted from this repo, right?


Yes. I'd probably be a good thing to do so eventually.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4474
Joined: Wed Jun 04, 2008 11:20 am

PreviousNext

Return to Gallery

Who is online

Users browsing this forum: No registered users and 1 guest

cron