Sync mesh for blender

Works in progress and technical screen shots.

Moderator: joepal

Re: Sync mesh for blender

Postby SaltyCowdawg » Sun Sep 18, 2016 7:34 pm

odd-artifact-sync-mh.jpg
Where'd that come from?


It would seem I found a way to break this.

Here's what I have going:

Created an export (DAE) file of a generic human. Started the MH server. Imported to Blender and performed the following changes on the generic human.

* Increased height
* Increased weight
* changed from gender neutral to female
* changed breast parameters

Then I hit sync and the toon did not update but I got a wierd artifact at its feet.

This is being done on a Linux Mint laptop if that makes a difference.
Peter L. Berghold <peter@berghold.net> or <Salty.Cowdawg@gmail.com>
Retired IT with 30+ years in the business
User avatar
SaltyCowdawg
 
Posts: 458
Joined: Fri Aug 09, 2013 3:12 pm
Location: Ayden NC

Re: Sync mesh for blender

Postby Rhynedahll » Sun Sep 18, 2016 11:43 pm

Aranuvir wrote:Just quickly from my memory (not sure if I'm right). IIRC the install process has changed since the video was created. You need to install the plug-in 1_mhapi, too. (https://github.com/makehumancommunity/c ... /makehuman)


Thanks! That sorted it out. :)

It appears that the applyModifier.py will do exactly what I need -- allow a mesh to be created from scratch.

What commands can be sent through genericCommand.py?

Is it possible to cause MH to export the mesh?
Orphan, an epic fantasy by H. Jonas Rhynedahll
The Key to Magic: Book One
Available on Kindle at Amazon: The Key to Magic
Rhynedahll
 
Posts: 195
Joined: Sat Nov 28, 2009 1:23 pm

Re: Sync mesh for blender

Postby joepal » Mon Sep 19, 2016 7:05 am

Rhynedahll wrote:Thanks! That sorted it out. :)

It appears that the applyModifier.py will do exactly what I need -- allow a mesh to be created from scratch.

What commands can be sent through genericCommand.py?

Is it possible to cause MH to export the mesh?


The idea is to support all core operations that can be performed in the UI. But we're very far from that as of yet. The export functionality has not been touched yet.

You can get an overview of what's *supposed* to have at least a rough outline so far by reading https://github.com/makehumancommunity/c ... /README.md

The CLI scripts will basically be small wrappers for calling these APIs via a socket. So for example that mhrc/applyModifier.py will call MHAPI.modifiers.applyModifier().

MHAPI is an attempt to make a higher level, coherent and more approachable programming interface for the MH code. It will take quite some time to get it to cover everything, but it's not an either/or thing: the parts that are implemented becomes immediately usable.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: Sync mesh for blender

Postby Rhynedahll » Mon Sep 19, 2016 10:00 am

joepal wrote:
The idea is to support all core operations that can be performed in the UI. But we're very far from that as of yet. The export functionality has not been touched yet.




As a learning experience, I'd like to study what needs to be done to expose the export functionality.

Could you possibly give me a brief outline of what must be done as far as the MH source and the plugin?
Orphan, an epic fantasy by H. Jonas Rhynedahll
The Key to Magic: Book One
Available on Kindle at Amazon: The Key to Magic
Rhynedahll
 
Posts: 195
Joined: Sat Nov 28, 2009 1:23 pm

Re: Sync mesh for blender

Postby joepal » Mon Sep 19, 2016 11:38 am

It should not be very tricky. The procedure is roughly this:

* Identify the relevant code in MH. The export functionality located in the 9_export_*.py plugins
* Figure out a nice and readable set of API calls to translate these into
* Decide on a namespace (see below) for putting these in
* Write the relevant wrappers in the MHAPI plugin. See for example https://github.com/makehumancommunity/c ... difiers.py
* Test these somehow, for example by writing a plugin which simply calls them all and see if things crash
* Write socket wrappers for the MHAPI calls, in 8_server_socket. See for example https://github.com/makehumancommunity/c ... /modops.py
* Copy/paste/modify a reasonably similar CLI wrapper in order to create a shell command. See for example https://github.com/makehumancommunity/c ... odifier.py

While this may seem a bit convoluted, there are good reason for separating things into layers.

MH core code: This is how things look in the code. It shouldn't be modified. However, it's a bit opaque for new developers, so it benefits from being abstracted into a more coherent API set.

MHAPI: This is the abstraction layer. It includes some code wrappers to simplify some processes, but more often than not a call here has a 1:1 correspondence in a call in the MH core code. MHAPI is used by plugins that are installed in makehuman. For example the asset downloader plugin uses this.

Socket server: This is a secondary layer for exposing MHAPI calls to a network socket. That's pretty much all it does. This is used by the sync mesh plugin in blender and the CLI script. My intention is that it should be generic enough to be possible to talk to from wherever. Thus it uses JSON objects for the communication protocol.

CLI: These are scripts which call the socket server. genericCommand is able to call any wrapped call. But in most cases it'll make sense to write a separate script for each major group of calls. For example a script for applying modifiers.

Concerning namespaces, I've grouped MHAPI calls into topics in order to make the code more readable. See https://github.com/makehumancommunity/c ... /README.md. You'd most likely want to start an "exports" namespace, which should be located in a file called _exports.py. This needs to be referenced in https://github.com/makehumancommunity/c ... api/api.py.

Just out of my head you might then want to create calls such as

mhapi.exports.exportHumanToFile(format, filename, options)

or

mhapi.export.exportHumanToObj(filename, options)

.. which would be implemented as methods in your _export.py file.

Once this is done, write a corresponding wrapper for each call in the 8_server_socket code.

Finally, write a script for calling the socket server from the command line.

Obviously, it'd be possible to implement the calls directly in 8_server_socket rather than going via MHAPI, but I'd like to keep the separation as listed above.

If/when you have code you like, make a pull request against the community-plugins repo. I plan on being flexible and welcoming concerning submissions to this repo, as it doesn't really harm anything to experiment a bit here.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: Sync mesh for blender

Postby Rhynedahll » Mon Sep 19, 2016 5:40 pm

Thankyou!

I'll start studying these things. :)

I've copied your entire post out into a text document so that I can break it down into steps that I work on.
Orphan, an epic fantasy by H. Jonas Rhynedahll
The Key to Magic: Book One
Available on Kindle at Amazon: The Key to Magic
Rhynedahll
 
Posts: 195
Joined: Sat Nov 28, 2009 1:23 pm

Re: Sync mesh for blender

Postby NotoriousGTW » Sun Oct 23, 2016 2:20 pm

When I click on the sync mesh button in blender, makehuman instantly stops working. What could cause this?

Blender console shows the following error:
Code: Select all
Traceback (most recent call last):
  File "C:\Users\NotoriousGTW\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\MH_Community\mh_sync\SyncOperator.py", line 30, in execute
    json_obj = self.executeJsonCall()
  File "C:\Users\NotoriousGTW\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\MH_Community\mh_sync\SyncOperator.py", line 20, in executeJsonCall
    return self.call.send()
  File "C:\Users\NotoriousGTW\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\MH_Community\mh_sync\JsonCall.py", line 207, in send
    buf = client.recv(1024)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

location: <unknown location>:-1

NotoriousGTW
 
Posts: 7
Joined: Fri Mar 18, 2016 2:46 pm

Re: Sync mesh for blender

Postby RobBaer » Fri Nov 04, 2016 7:55 am

There is not enough information in your post to be sure, but the fact that a connection has disappeared makes it seem like you could have closed and re-opened MakeHuman or had 2 instances open and closed the wrong one.

If this problem persists a list of actions that can reproduce the problem would help us get to the root cause.
User avatar
RobBaer
 
Posts: 1208
Joined: Sat Jul 13, 2013 3:30 pm
Location: Kirksville, MO USA

Re: Sync mesh for blender

Postby joepal » Fri Nov 04, 2016 8:16 am

I've seen this too. On the MH side this usually coincides with a crash in the Qt libraries.

I think it's due to a problem with concurrency, Qt dislikes that it's interacted with from another thread.

I haven't been able to solve this yet, but I haven't spent much time on it. The problem appears a bit randomly.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: Sync mesh for blender

Postby NotoriousGTW » Sat Nov 05, 2016 12:48 pm

that's odd because it happens literally every time i press mesh sync

also i folowed this step by step:

joepal wrote:Assuming windows, copy "mh_sync_mesh" dir to [your blender dir]\[your blender version]\scripts\addons. Copy 8_server_socket to [your MH dir]\plugins. In blender go to user preferences, filter on "mh" and enable the plugin. In MH I think the plugin is auto-enabled, but if not go to settings->plugins and enable it.

In MH go to utilities->socket and check the box to start the server.

In blender select a human mesh, and click the sync button in the makehuman category of the toolshelf.
NotoriousGTW
 
Posts: 7
Joined: Fri Mar 18, 2016 2:46 pm

PreviousNext

Return to WIP (Work In Progress)

Who is online

Users browsing this forum: No registered users and 1 guest

cron