<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/><office:font-face-decls><style:font-face style:name="OpenSymbol" svg:font-family="OpenSymbol"/><style:font-face style:name="FreeMono" svg:font-family="FreeMono" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:background-color="#ffffff" fo:keep-with-next="always"><style:background-image/></style:paragraph-properties><style:text-properties style:font-name="Liberation Sans" fo:font-size="14pt" fo:background-color="#ffff00"/></style:style><style:style style:name="P2" style:family="paragraph" style:parent-style-name="Head1"/><style:style style:name="P3" style:family="paragraph" style:parent-style-name="Head2"/><style:style style:name="P4" style:family="paragraph" style:parent-style-name="Head3"/><style:style style:name="P5" style:family="paragraph" style:parent-style-name="listpara" style:list-style-name="L1"/><style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame"><style:graphic-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" style:run-through="foreground" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph" fo:padding="0cm" fo:border="none"/></style:style><style:style style:name="fr2" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" style:run-through="foreground" style:wrap="none" style:vertical-pos="from-top" style:vertical-rel="paragraph-content" style:horizontal-pos="from-left" style:horizontal-rel="paragraph-content" fo:padding="0cm" fo:border="none" style:shadow="none" style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style><text:list-style style:name="L1"><text:list-level-style-bullet text:level="1" text:style-name="Bullet_5f_20_5f_Symbols" style:num-prefix=" " style:num-suffix=" " text:bullet-char="•"><style:list-level-properties text:space-before="0.499cm" text:min-label-width="0.635cm"/></text:list-level-style-bullet><text:list-level-style-number text:level="2" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.905cm" fo:text-indent="-0.635cm" fo:margin-left="1.905cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="3" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-0.635cm" fo:margin-left="2.54cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="4" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.175cm" fo:text-indent="-0.635cm" fo:margin-left="3.175cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="5" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.81cm" fo:text-indent="-0.635cm" fo:margin-left="3.81cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="6" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="4.445cm" fo:text-indent="-0.635cm" fo:margin-left="4.445cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="7" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.08cm" fo:text-indent="-0.635cm" fo:margin-left="5.08cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="8" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.715cm" fo:text-indent="-0.635cm" fo:margin-left="5.715cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="9" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.35cm" fo:text-indent="-0.635cm" fo:margin-left="6.35cm"/></style:list-level-properties></text:list-level-style-number><text:list-level-style-number text:level="10" style:num-suffix="." style:num-format="1"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.985cm" fo:text-indent="-0.635cm" fo:margin-left="6.985cm"/></style:list-level-properties></text:list-level-style-number></text:list-style></office:automatic-styles><office:body><office:text text:use-soft-page-breaks="true"><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="P1">Insert title and front page graphics here</text:p><text:h text:style-name="Head1" text:outline-level="1">1. Introduction (SID: 622)</text:h><text:p text:style-name="para">The scripting plugin is available as a tab inside MakeHuman. It enables the user to execute repetitive tasks or to perform operations currently not possible through the GUI.</text:p><text:h text:style-name="Head2" text:outline-level="2">1.1. Why do we need scripting? (NID: 623)</text:h><text:p text:style-name="para">There are several good reasons why scripting is necessary:</text:p><text:list xml:id="list19373814611" text:style-name="L1"><text:list-item><text:p text:style-name="P5">Some tasks are not otherwise viable.Consider the weight simulation pasted as an example further down in this document. Now imagine doing that by moving the slider by 0.01 per update and making a new screenshot.</text:p></text:list-item><text:list-item><text:p text:style-name="P5">Debugging.When developing it&apos;s invaluable to be able to perform operations &quot;runtime&quot; in order to understand what&apos;s happening and be able to print info about the current state of objects. Currently you have to modify the code and restart the whole application everytime you want to print another debug info point.</text:p></text:list-item><text:list-item><text:p text:style-name="P5">Enabling professional pipelines.In professional pipelines you will most likely want to automate some tasks instead of repeating them by hand every time you need to perform the operation.</text:p></text:list-item></text:list><text:h text:style-name="Head3" text:outline-level="3">1.1.1. What does the scripting module support?</text:h><text:p text:style-name="para">The scripting module simply runs python instructions inline. Any python can be run here. Full access to all objects declared are made available. For example you have full access to the human model.</text:p><text:p text:style-name="para">In addition to this, some basic tasks have been abstracted and made available under a MHScript object. The idea is that users shouldn&apos;t necessarily have to understand MH internals in order to write basic scripts.</text:p><text:p text:style-name="para">All abstracted calls are listed in a box in the scripting tab, and the user can choose to append an example to the scripting text, together with some comments describing how the operation is used.</text:p><text:h text:style-name="Head1" text:outline-level="1">2. Scripting (SID: 566)</text:h><text:p text:style-name="para">Topics related to scripting</text:p><text:h text:style-name="Head2" text:outline-level="2">2.1. Quickstart (NID: 567)</text:h><text:p text:style-name="para"><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="paragraph" svg:width="21.5cm" draw:z-index="0"><draw:text-box fo:min-height="15.12cm"><text:p text:style-name="Illustration"><draw:frame draw:style-name="fr2" draw:name="idp27008" text:anchor-type="paragraph" svg:x="0.004cm" svg:y="0.002cm" svg:width="21.5cm" style:rel-width="100%" svg:height="15.12cm" style:rel-height="scale" draw:z-index="1"><draw:image xlink:href="Pictures/1000020100000433000002F47D7A29D2.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>Illustration <text:sequence text:ref-name="refIllustration0" text:name="Illustration" text:formula="ooow:Illustration+1" style:num-format="1">1</text:sequence>: Hello</text:p></draw:text-box></draw:frame></text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.1.1. A practical example</text:h><text:p text:style-name="para"/><text:p text:style-name="para">Consider the following script example:</text:p><text:p text:style-name="code"><text:soft-page-break/><text:line-break/>weight = 0.0<text:line-break/>while (weight &lt; 1.0):<text:line-break/><text:tab/>MHScript.setWeight(weight)<text:line-break/><text:tab/>weight = weight + 0.01<text:line-break/><text:tab/>filename = MHScript.incrementingFilename(&quot;weight&quot;)<text:line-break/><text:tab/>MHScript.screenShot(filename)<text:line-break/></text:p><text:p text:style-name="para">Here we produce 100 still images of how the weight slider influences a model. The results can be viewed here<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body><text:p text:style-name="Footnote">http://www.jwp.se/files/weight.avi</text:p></text:note-body></text:note> </text:p><text:h text:style-name="Head2" text:outline-level="2">2.2. Available operations (NID: 568)</text:h><text:h text:style-name="Head3" text:outline-level="3">2.2.1. applyTarget(target file name, weight)</text:h><text:p text:style-name="para">This will apply the target on the model. If the target was already applied, the weight will be updated Note that targets are relative to the data/targets directory, and should not include the .target extension, so a valid target name would be, for example, &quot;breast/breast-dist-max&quot;</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:MHScript.applyTarget(&apos;aTargetName&apos;,1.0)</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.2.2. incrementingFilename(file name base, [file extension], [pad length])</text:h><text:p text:style-name="para">This will return a file name containing a numerical component which increases by one for each call. The default file extension is &quot;.png&quot;. The default pad length is 4. For example, the following lines:</text:p><text:p text:style-name="para"/><text:p text:style-name="para">print incrementingFilename(&quot;test&quot;,&quot;.target&quot;,3)</text:p><text:p text:style-name="para">print incrementingFilename(&quot;test&quot;,&quot;.target&quot;,3)</text:p><text:p text:style-name="para"/><text:p text:style-name="para">Will print:</text:p><text:p text:style-name="para"/><text:p text:style-name="para">test001.target</text:p><text:p text:style-name="para">test002.target</text:p><text:p text:style-name="para"/><text:p text:style-name="para">The counter is reset each time the script is executed</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:filename = MHScript.incrementingFilename(&apos;test&apos;)</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3"><text:soft-page-break/>2.2.3. loadModel(model name,[path])</text:h><text:p text:style-name="para">This will load a human model from an MHM file. The &quot;model name&quot; part should be a string without spaces and without the .MHM extension. The &quot;path&quot; part defaults to the user&apos;s makehuman/models directory.</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE: MHScript.loadModel(&apos;myTestModel&apos;)</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.2.4. printDetailStack()</text:h><text:p text:style-name="para">This will print a list of all applied targets (and their weights) to standard output.</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:MHScript.printDetailStack()</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.2.5. saveModel(model name,[path])</text:h><text:p text:style-name="para">This will save the human model to an MHM file. The &quot;model name&quot; part should be a string without spaces and without the .MHM extension. The &quot;path&quot; part defaults to the user&apos;s makehuman/models directory. Note that this will not save any thumbnail.</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:MHScript.saveModel(&apos;myTestModel&apos;)</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.2.6. screenShot(png file name)</text:h><text:p text:style-name="para">This will save a png file of how the model currently looks.</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:MHScript.screenShot(&apos;screenshot.png&apos;)</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.2.7. setAge(age)</text:h><text:p text:style-name="para">Sets the age of the model. The age parameter is a float between 0 and 1, where 0 is 12 years old and 1 is 70.</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:MHScript.setAge(0.5)</text:p><text:p text:style-name="para"/><text:h text:style-name="Head3" text:outline-level="3">2.2.8. setWeight(weight)</text:h><text:p text:style-name="para"><text:soft-page-break/>Sets the weight of the model. The weight parameter is a float between 0 and 1, where 0 is starved and 1 is severely overweight</text:p><text:p text:style-name="para"/><text:p text:style-name="para">EXAMPLE:MHScript.setWeight(0.5)</text:p><text:p text:style-name="para"/></office:text></office:body></office:document-content>