Feature #1067

MH 1.1.0 release build - target scripting malfunction

Added by Rob Baer over 2 years ago. Updated almost 2 years ago.

Status:NewStart date:10/15/2016
Priority:NormalDue date:
Assignee:Joel Palmius% Done:

0%

Category:-
Target version:MakeHuman 1.1.2

Description

MH 1.1.0 release build on Windows 10

The scripting plugin describes a MHScript.applyTarget() function of the form:

    MHScript.applyTarget('eyes/l-eye-height2-decr|incr',0.25)
    MHScript.applyTarget('eMHScript.applyTarget(yes/r-eye-height2-decr|incr',0.30)
    MHScript.applyTarget('ears/r-ear-flap-decr|incr',0.4)
    MHScript.applyTarget('ears/l-ear-flap-decr|incr',0.4)
    MHScript.applyTarget('ears/r-ear-scale-vert-decr|incr',0.65)
    MHScript.applyTarget('ears/l-ear-scale-vert-decr|incr',0.65)

This produces log errors of the form:

Unable to open E:/makehuman-1.1.0-win32/data/targets/ears/l-ear-scale-vert-decr|incr.target ([Errno 22] invalid mode ('rU') or filename: u'E:/makehuman-1.1.0-win32/data/targets/ears/l-ear-scale-vert-decr|incr.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/macrodetails-proportions/BodyProportions.target ([Errno 2] No such file or directory: u'E:/makehuman-1.1.0-win32/data/targets/macrodetails-proportions/BodyProportions.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/macrodetails-universal/Muscle.target ([Errno 2] No such file or directory: u'E:/makehuman-1.1.0-win32/data/targets/macrodetails-universal/Muscle.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/macrodetails-height/Height.target ([Errno 2] No such file or directory: u'E:/makehuman-1.1.0-win32/data/targets/macrodetails-height/Height.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/eyes/l-eye-height2-decr|incr.target ([Errno 22] invalid mode ('rU') or filename: u'E:/makehuman-1.1.0-win32/data/targets/eyes/l-eye-height2-decr|incr.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/eyes/r-eye-height2-decr|incr.target ([Errno 22] invalid mode ('rU') or filename: u'E:/makehuman-1.1.0-win32/data/targets/eyes/r-eye-height2-decr|incr.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/ears/r-ear-flap-decr|incr.target ([Errno 22] invalid mode ('rU') or filename: u'E:/makehuman-1.1.0-win32/data/targets/ears/r-ear-flap-decr|incr.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/ears/l-ear-flap-decr|incr.target ([Errno 22] invalid mode ('rU') or filename: u'E:/makehuman-1.1.0-win32/data/targets/ears/l-ear-flap-decr|incr.target')
Unable to open E:/makehuman-1.1.0-win32/data/targets/ears/r-ear-scale-vert-decr|incr.target ([Errno 22] invalid mode ('rU') or filename: u'E:/makehuman-1.1.0-win32/data/targets/ears/r-ear-scale-vert-decr|incr.target')

This appears to result from the fact that the release build (at least on Windows) does not include the actual target files. I guess they have been moved to a .json or .npz file somewhere. At any rate, the scripting plugin seems unable to use MHScript.applyTarget() in the manner described.

History

#1 Updated by Rob Baer over 2 years ago

MHScript.updateModelingParameter('eyes/l-eye-height2-decr|incr',0.25)

seems to accomplish the desired effect. Perhaps I don't understand what the purpose of MHScript.applyTarget('eyes/l-eye-height2-decr|incr',0.25) is.

#2 Updated by Joel Palmius over 2 years ago

There are no target names that have actual pipe signs in them. If you list the ears assets directory in a source build, you'll see

l-ear-flap-decr.target
l-ear-flap-incr.target
l-ear-lobe-decr.target
l-ear-lobe-incr.target
l-ear-rot-backward.target
l-ear-rot-forward.target
l-ear-scale-decr.target

If I remember right, the applyTarget call applies a target by actual filename. i don't remember if this is influenced by having compiled to npz.

Modifiers ("modeling parameters") are virtual. They usually consist of groups of targets, although they might consist of a single target. In those cases you use the modifier name rather than the target file name.

#3 Updated by Jonas Hauquier over 2 years ago

Pipe characters are used in modifier names, not in target names.
You should use them like this:

human.getModifier('eyes/l-eye-height2-decr|incr').setValue(0.25)

I recommend using modifiers for the more complex targets instead of accessing the targets directly.

#4 Updated by Rob Baer over 2 years ago

  • Tracker changed from Bug to Feature
  • Target version deleted (MakeHuman 1.1.1)

Thanks gentlemen! The distinction between a modifier object and a target object is a little clearer. The bug report could probably be closed at this point, but before doing so, let me take the opportunity to suggest that some wiki docs might help in this area (I've changed the issue to a feature request and blanked the target). Do either of you have a suggestion of how to extend Joel's build in examples to a full blown wiki document? AN outline of such a document that we might peck away at would be useful.

Miscellaneous topics that I couldn't immediately figure out from the example appends already provide (nice jump start by the way):
  • adding topologies to the model
  • adding proxies parts like eyebrows, eyelashes, tongue, etc to the model
  • choosing a scale (cm, m, dm, inch) when saving an .obj file
  • choosing other export options - how is is done.
  • method of exporting using fbx, dae, or mhx2 exportes (and setting those export parameters
  • how to initialize an incrementing file name counter without restarting a script or how to set a specific starting value based on existing file names if a restart has occurred
  • There are setAge() and setheight() convenience functions, but what are the (or are there?) similar convenience functions for the other model macro sliders like (Weight, proportion, etc)
  • There is a setHeadSquareness() convenience function, but it is not clear what/if there are similar convenience functions for other face shapes
  • getting the current "user path" and creating a subdirectory to save a series of batch output to
  • It would also be useful to understand a little better the namespace for functions that might be defined in the scripting interface.

This is just a start, off the top of the head. What else might go here?

#5 Updated by Jonas Hauquier about 2 years ago

I did a writeup of the differences between modifiers/targets on the technical specs pages of the wiki.

#6 Updated by Rob Baer about 2 years ago

Jonas Hauquier wrote:

I did a writeup of the differences between modifiers/targets on the technical specs pages of the wiki.

Fantastic! I'll give it a read.

#7 Updated by Joel Palmius almost 2 years ago

  • Target version set to MakeHuman 1.1.2

The scripting plugin should probably be removed or significantly reworked.

Also available in: Atom