Expression mixer improvements

MakeHuman python API, python plugins, etc

Moderator: joepal

Expression mixer improvements

Postby 6r1d » Sat Aug 12, 2017 6:45 am

I'd like to add my changes to the expression mixer. Now it syncs to the expression in expression selector, including expression name, author and license.

Image

  • "Edit selected" button will copy parameters from current expression to the mixer, set selected expression to "None" and allow user to edit expression values. (I am not sure how I could leave selected expression, and I doubt it's a good idea: for example, user could save the expression under a different name and old one will appear.)
  • "Apply" button is left for the situations where user doubts that expression values are applied properly.
  • "Reset" button just resets the sliders and expression selector, so user could be sure about working on the new expression.

I've also though about old sliders and I did another slider design, more close to the Blender style. I wanted to see more accurate values for the sliders. Also, I wanted to have text value input.
There is a little animation to show the general idea.

Image

I'd like to add these sliders to another tabs later, if that would be fine.

Talking about the code, I downloaded Makehuman trunk from BitBucket and just changed several files.
I've tried to look up the FAQ about contributing the code, but it's empty now.
Sorry, I don't know much about MakeHuman team workflow, so for now I'll simply attach my changes for anyone interested to discuss and then I'll commit these to BitBucket if code looks fine.
I'd like to hear more about MH coding standards and workflow, obviously. :)

To test the new slider itself, put slider_demo.py and slider.py in the same directory, then launch slider_demo.py.

To update MH trunk with new code:
  • put 7_expression_mixer.py at makehuman/makehuman/plugins/ directory
  • put qtgui.py and slider.py to makehuman/makehuman/lib/ dir
Attachments
7_expression_mixer.py
makehuman/makehuman/plugins/7_expression_mixer.py
(12.7 KiB) Downloaded 325 times
qtgui.py
makehuman/makehuman/lib/qtgui.py
(79.88 KiB) Downloaded 321 times
slider_demo.py
Demo file for the new slider
(1.07 KiB) Downloaded 315 times
slider.py
New slider itself
(12.89 KiB) Downloaded 310 times
6r1d
 
Posts: 2
Joined: Wed Jul 29, 2015 1:02 am

Re: Expression mixer improvements

Postby jujube » Sat Aug 12, 2017 12:38 pm

This should be very useful. Thanks for making it, and welcome to the makehuman community!
jujube
 
Posts: 404
Joined: Fri Aug 14, 2015 10:46 pm

Re: Expression mixer improvements

Postby blindsaypatten » Sat Aug 12, 2017 1:02 pm

This would be great! A desire to have numeric input and display has come up several times.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: Expression mixer improvements

Postby Aranuvir » Sat Aug 12, 2017 3:47 pm

Actually I like the new style of sliders. I think this contribution merits a discussion of a new slider design in general.

Just some remarks (though I do not know much about gui programming :) ):
As I far as I can see slider.py does its own event handling. This should be centralized to MakeHuman's event handler. Key codes are already defined in qtui.py. We are currently migrating to P3 maybe you could change the script so it runs on both P2 and P3 or make run on P3 only.
Perhaps you want to fork from github (https://github.com/makehumancommunity/makehuman) and make pull requests for the project?
Minor issues: Hitting reset, does not redraw the model (though the old reset didn't work either)
Some users have "," on there number pad instead of ".". Handling this graceful shouldn't be to difficult...
Aranuvir
 
Posts: 1059
Joined: Sun Oct 12, 2014 2:12 pm

Re: Expression mixer improvements

Postby 6r1d » Wed Aug 23, 2017 2:21 am

> This should be very useful. Thanks for making it, and welcome to the makehuman community!
Happy to hear that. :-)

> A desire to have numeric input and display has come up several times.
Good to know.

> Actually I like the new style of sliders. I think this contribution merits a discussion of a new slider design in general.
There would always be something to improve, I suppose.
For instance, I wanted to ignore user reset when cursor is not over the component. I checked PyQt and PySide APIs only to find out that cursor is always “over the component” when somebody uses drag functionality.
And this idea would probably be useless: there could be “undo” functionality for expressions, someone might want right-click menus on widgets like it was done in Blender, etc.

> though I do not know much about gui programming
There is a very helpful article I used to write the widget: http://zetcode.com/gui/pysidetutorial/customwidgets/

> As I far as I can see slider.py does its own event handling. This should be centralized to MakeHuman's event handler.
Hmm, I agree from the coding perspective.
There might be an issue, though: I don't want the model to rotate each time user presses 2, 4, 6, 8 while typing something in the component.
That's why I use ShortcutOverride. I'll read MH code a bit more since I don't know much about the event handling mechanism.

> Key codes are already defined in qtui.py.
Nice, I'd use "Keys" class, then.

> We are currently migrating to P3 maybe you could change the script so it runs on both P2 and P3 or make run on P3 only.
PySide is very good! Slider works with PySide and Python 3.5.2 in my computer with minor changes (I've made it thinking about both PyQt and PySide).

> Perhaps you want to fork from github (https://github.com/makehumancommunity/makehuman) and make pull requests for the project?
Yes, I'll make pool request soon.

> Hitting reset, does not redraw the model
Checked it, there was a little problem, I think it would work better in the pull-request version.

> Some users have "," on there number pad instead of ".". Handling this graceful shouldn't be to difficult...
Yes, I fixed it in my local version.
6r1d
 
Posts: 2
Joined: Wed Jul 29, 2015 1:02 am

Re: Expression mixer improvements

Postby Aranuvir » Fri Aug 25, 2017 8:18 pm

I had opened a feature request on the bug tracker http://bugtracker.makehumancommunity.org/issues/1202. You can try to argue on the bug tracker, but keep in mind, the Linux Kernel is kept less conservative than MakeHuman's code. Good luck! :evil:

Though, I don't think this is true for our git hub code. ;) But I'd prefer keeping gui experiments in a separate branch. :D

Just some thoughts: It is hard to setup Pyside on Windiows since it only supports up to Python 3.4 which is deprecated (and I couldn't find official binaries any more). On the other hand I cannot find any official build of Pyside2 in the debian/ubuntu repos. If we really intend to redesign the sliders (i.e. a great part of the ui), I'd suggest to port the code to QT5, too, and make sure it runs on both PyQt5 and Pyside2.
Aranuvir
 
Posts: 1059
Joined: Sun Oct 12, 2014 2:12 pm


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest