<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MathiesonFacer.com</title>
	<atom:link href="http://www.mathiesonfacer.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mathiesonfacer.com</link>
	<description>Mathieson Facer - Rigging Technical Director</description>
	<lastBuildDate>Thu, 10 May 2012 04:29:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Another go with Maya Muscle</title>
		<link>http://www.mathiesonfacer.com/featured/another-go-with-maya-muscle/</link>
		<comments>http://www.mathiesonfacer.com/featured/another-go-with-maya-muscle/#comments</comments>
		<pubDate>Thu, 10 May 2012 04:29:03 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1324</guid>
		<description><![CDATA[I used the Maya Muscle system again recently and had a great time with it. I started with the simple muscle builder again this time, but was lucky to be working with someone who had more experience with Maya Muscle than I did. I followed her advice and abandoned the simple muscle builder and went [...]]]></description>
			<content:encoded><![CDATA[<div>I used the Maya Muscle system again recently and had a great time with it. I started with the simple muscle builder again this time, but was lucky to be working with someone who had more experience with Maya Muscle than I did. I followed her advice and abandoned the simple muscle builder and went the route of the muscle creator instead. No regrets. She gave me some other pointers as well, which were great, and pointed me in the direction of the full instruction manual for Maya Muscle. This was huge as I was not able to find it before despite searching in the past. The closest I had come previously was finding a chapter from it on Google. This was super handy to have and I can&#8217;t believe I wasn&#8217;t able to find it on my own. I have no idea why it was so hard. The link was even <a href="http://usa.autodesk.com/adsk/servlet/index?siteID=123112&amp;id=13710022&amp;linkID=9242256">missing from Autodesk&#8217;s website</a> <wbr>when I was there looking for documentation. <a href="http://images.autodesk.com/adsk/files/muscle.pdf">Here is the link for the full manual.</a></wbr></div>
<div></div>
<p><span id="more-1324"></span></p>
<div>Although my experience was great this time around, I still ran into many problems and, what seemed to be, bugs:</div>
<div>
<ul>
<li>Mirroring muscles across would not always work. Sometimes some of the locators would be mirrored into the wrong spot even though the rest of the muscle was correct. This meant that I couldn&#8217;t even correct the misplaced locator, because doing so would then ruin the rest of my muscle set up.</li>
<li>I found problems when duplicating nurbs surfaces that I had added a muscle shape node to. It would duplicate the muscle shape node as well, but not rename it. It would create a naming conflict, so I would go and rename it manually. Unfortunately this then lead to the muscle object being able to get added to the muscle deformer but not actually have any affect even when weights were painted to it. It took a while before I realized this was happening and was a pain to fix when it did happen. I had to remove the muscle from the solution, delete the muscle shape node, and then re-initialize the nurbs object as a muscle again.</li>
<li>For some reason, removing a muscle object from a deformer takes forever. It literally takes about 10 times as long as it takes to add it to the solution. Most of the time it would completely mangle my mesh when it finished the process and I would then have to re-open my scene and start again. It was a huge pain in the ass. I found a easier and safer approach was to save out my weight maps, delete the actual muscle deformer, re-add it, re-add all the muscle objects, and then load the weight maps back on. This was a manual process, but as I said was surprisingly much faster. It also did not lead to my mesh exploding randomly.</li>
<li>Mirroring weights over was a bit of a pain because, unfortunately, there were a few muscles created that I failed to name with the correct convention. Each muscle that is created with the muscle creator consists of at least 47 nodes. Each one of these nodes then has to be renamed. I must have been doing something wrong because some problems would start popping up after attempting to rename all these nodes. Anyways, the inconsistency in naming convention was a real pain because the weight mirroring tools expect you to pass in a left and right side string to help associate left and right side muscles. The left and right side strings is exactly what I failed on keeping consistent. There were two different identifiers being used: _l_/_r_ and _L/_R. When doing the _l_/_r_ it would detect all muscles matching that convention, but then fail on any matching the _L/_R. Naturally, you would then attempt mirroring using the _L/_R identifiers to do whatever was missed. The problem here is, it mirrors the weights for all muscles. It will, in this case, succeed for all of the _L/_R muscles, but incorrectly mirror the _l_/_r_ now. I wish there was some other way for Maya Muscle to form that left side/right side associations to avoid situations like this. I am going to have to look further into a solid way of renaming entire muscles so situations like this can be easier to address in the future. There is an option in the Muscle menu to delete one of these muscles and all of its associated nodes, but I could not find anything for renaming. Very puzzling.</li>
</ul>
<p>That is all for now. I know there was more that I ran into, but I cannot recall at the moment. Overall, I enjoyed working with it very much and the end result looked pretty nice. I am considering the above points just a learning experience, as I still have not used the system excessively. Like anything else, you have to learn the in and outs over time. I feel like I learned a lot of them through this most recent experience.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/featured/another-go-with-maya-muscle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python module &#8211; recursiveReload</title>
		<link>http://www.mathiesonfacer.com/tools/maya/python-module-recursivereload/</link>
		<comments>http://www.mathiesonfacer.com/tools/maya/python-module-recursivereload/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 06:48:28 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Maya]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1271</guid>
		<description><![CDATA[Something that bothered me when I first started working with Python in Maya was reloading of modules. When working on tools that have multiple modules importing each other, it can be a pain to have to change something in one of the imported modules. There are a number of situations that arise where your modules [...]]]></description>
			<content:encoded><![CDATA[<p>Something that bothered me when I first started working with Python in Maya was reloading of modules. When working on tools that have multiple modules importing each other, it can be a pain to have to change something in one of the imported modules. There are a number of situations that arise where your modules just do not reload correctly. You might have imported an object from a module, or you might have imported a method with the same name as the module you imported it from, or you might have imported using an alias.</p>
<p>A situation came up last week at work that was somewhat related to this issue. Another one of the TDs was in the process of writing a daemon script, and we needed a way of ensuring that all of our modules get updated automatically without re-starting the daemon every single time we commit a change.</p>
<p><span id="more-1271"></span></p>
<p>I came up with a quick solution before leaving for the weekend, but I felt there was a better solution available. I decided to take on a small home project over the weekend to come up with a more robust solution. With a bit of playing around I came up with a recursive solution utilizing the inspect module that seems to be working pretty well, so I thought I&#8217;d share :).</p>
<p>recursiveReload.py:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
Created on 2012-02-25
&nbsp;
@author: Mat
'</span><span style="color: #483d8b;">''</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">inspect</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">distutils</span> <span style="color: #ff7700;font-weight:bold;">import</span> sysconfig
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">types</span> <span style="color: #ff7700;font-weight:bold;">import</span> ModuleType
&nbsp;
_processedModules = <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
_importedModules = <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
_remappingData = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> ImportRemapData<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span>
        <span style="color: #008000;">self</span>,
        destModuleName,
        destAttrName,
        sourceModuleName,
        sourceAttrName,
        attrType
        <span style="color: black;">&#41;</span>:
&nbsp;
        <span style="color: #008000;">self</span>._destModuleName = destModuleName
        <span style="color: #008000;">self</span>._destAttrName = destAttrName
        <span style="color: #008000;">self</span>._sourceModuleName = sourceModuleName
        <span style="color: #008000;">self</span>._sourceAttrName = sourceAttrName
        <span style="color: #008000;">self</span>._attrType = attrType
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> remap<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
        This gets the new modules and assigns the new attr value to the
        attr name in the new destination module.
        '</span><span style="color: #483d8b;">''</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#get the newly reloaded source module and then the new attr value</span>
        sourceModule = <span style="color: #dc143c;">sys</span>.<span style="color: black;">modules</span><span style="color: black;">&#91;</span><span style="color: #008000;">self</span>._sourceModuleName<span style="color: black;">&#93;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#we need to get the new attr value as well</span>
        newAttrVal = <span style="color: #008000;">None</span>
        <span style="color: #808080; font-style: italic;">#if the new attr val is a module, we need to get the module from sys</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>._attrType == ModuleType:
            newAttrVal = <span style="color: #dc143c;">sys</span>.<span style="color: black;">modules</span><span style="color: black;">&#91;</span><span style="color: #008000;">self</span>._sourceAttrName<span style="color: black;">&#93;</span>
        <span style="color: #808080; font-style: italic;">#otherwise, just get it from the new source module</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            newAttrVal = <span style="color: #008000;">getattr</span><span style="color: black;">&#40;</span>sourceModule, <span style="color: #008000;">self</span>._sourceAttrName<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#get the newly reloaded destination module and set the new attr value</span>
        destModule = <span style="color: #dc143c;">sys</span>.<span style="color: black;">modules</span><span style="color: black;">&#91;</span><span style="color: #008000;">self</span>._destModuleName<span style="color: black;">&#93;</span>
        <span style="color: #008000;">setattr</span><span style="color: black;">&#40;</span>destModule, <span style="color: #008000;">self</span>._destAttrName, newAttrVal<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> recursiveReload<span style="color: black;">&#40;</span>module, debug=<span style="color: #008000;">False</span><span style="color: black;">&#41;</span>:
&nbsp;
    <span style="color: #808080; font-style: italic;">#get all of the data necessary for full reload of the module</span>
    _getModuleData<span style="color: black;">&#40;</span>module<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#reload all of the collected modules</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> importedModule <span style="color: #ff7700;font-weight:bold;">in</span> _importedModules:
        <span style="color: #ff7700;font-weight:bold;">if</span> debug:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Reloading module: %s'</span> <span style="color: #66cc66;">%</span> importedModule
        <span style="color: #008000;">reload</span><span style="color: black;">&#40;</span>importedModule<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#now that the modules are all reloaded, re-map the extra data</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> remapData <span style="color: #ff7700;font-weight:bold;">in</span> _remappingData:
        remapData.<span style="color: black;">remap</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#clear our variables for future use</span>
    _processedModules.<span style="color: black;">clear</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    _importedModules.<span style="color: black;">clear</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">del</span> _remappingData<span style="color: black;">&#91;</span>:<span style="color: black;">&#93;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">True</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> _getModuleData<span style="color: black;">&#40;</span>module<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
    Inspects the module and all of its sub-modules to get all imported modules
    and data required for us to re-map variables properly.
    '</span><span style="color: #483d8b;">''</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#add this module to the list of processed modules so we do not try to</span>
    <span style="color: #808080; font-style: italic;">#process it again and risk getting into an infinite loop</span>
    _processedModules.<span style="color: black;">add</span><span style="color: black;">&#40;</span>module<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#get all attr names from the module</span>
    attrNames = <span style="color: #008000;">dir</span><span style="color: black;">&#40;</span>module<span style="color: black;">&#41;</span>
&nbsp;
    detectedModules = <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> attrName <span style="color: #ff7700;font-weight:bold;">in</span> attrNames:
&nbsp;
        <span style="color: #808080; font-style: italic;">#get attr value and try to get the module where the value originated from</span>
        attrVal = <span style="color: #008000;">getattr</span><span style="color: black;">&#40;</span>module, attrName<span style="color: black;">&#41;</span>
        attrModule = <span style="color: #dc143c;">inspect</span>.<span style="color: black;">getmodule</span><span style="color: black;">&#40;</span>attrVal<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#if we didn't get a module returned, we are dealing with a builtin, or</span>
        <span style="color: #808080; font-style: italic;">#we are dealing with this module skip to the next loop iteration.</span>
        <span style="color: #808080; font-style: italic;">#We need to do two checks for builtin modules, if it is in the builtin</span>
        <span style="color: #808080; font-style: italic;">#module names and if it does not have a __file__ attr.</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> attrModule \
        <span style="color: #ff7700;font-weight:bold;">or</span> attrModule.__name__ <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">builtin_module_names</span> \
        <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span>attrModule, <span style="color: #483d8b;">'__file__'</span><span style="color: black;">&#41;</span> \
        <span style="color: #ff7700;font-weight:bold;">or</span> attrModule == <span style="color: #dc143c;">sys</span>.<span style="color: black;">modules</span><span style="color: black;">&#91;</span>__name__<span style="color: black;">&#93;</span>:
            <span style="color: #ff7700;font-weight:bold;">continue</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#we also do not want to reload if the module comes from the standard lib</span>
        <span style="color: #808080; font-style: italic;">#to check for this, we need to get the module's path and check that it</span>
        <span style="color: #808080; font-style: italic;">#is in the lib folder, but not in the site packages folder</span>
        moduleFilepath = attrModule.__file__.<span style="color: black;">lower</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        pyStdLib = sysconfig.<span style="color: black;">get_python_lib</span><span style="color: black;">&#40;</span>standard_lib=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>.<span style="color: black;">lower</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        pySitePkg = sysconfig.<span style="color: black;">get_python_lib</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">lower</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> moduleFilepath.<span style="color: black;">startswith</span><span style="color: black;">&#40;</span>pyStdLib<span style="color: black;">&#41;</span> \
        <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #ff7700;font-weight:bold;">not</span> moduleFilepath.<span style="color: black;">startswith</span><span style="color: black;">&#40;</span>pySitePkg<span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">continue</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#add the module to the list of modules that have been imported</span>
        detectedModules.<span style="color: black;">add</span><span style="color: black;">&#40;</span>attrModule<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#if the attr value does not have a name attr, skip to the next iteration</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span>attrVal, <span style="color: #483d8b;">'__name__'</span><span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">continue</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">#if the module where the attr value came from is different from the</span>
        <span style="color: #808080; font-style: italic;">#current module, collect data we need to remap things</span>
        origName = attrVal.__name__
        <span style="color: #ff7700;font-weight:bold;">if</span> attrModule <span style="color: #66cc66;">!</span>= module:
            <span style="color: #808080; font-style: italic;">#print module.__name__, attrName, attrModule.__name__, origName</span>
            remapData = ImportRemapData<span style="color: black;">&#40;</span>
                module.__name__,
                attrName,
                attrModule.__name__,
                origName,
                <span style="color: #008000;">type</span><span style="color: black;">&#40;</span>attrVal<span style="color: black;">&#41;</span>
                <span style="color: black;">&#41;</span>
            _remappingData.<span style="color: black;">append</span><span style="color: black;">&#40;</span>remapData<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#add the detected modules to the imported modules set</span>
    _importedModules.<span style="color: black;">update</span><span style="color: black;">&#40;</span>detectedModules<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#cycle through the modules we detected, which have not already been processed</span>
    <span style="color: #808080; font-style: italic;">#and process them as well</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> detectedModule <span style="color: #ff7700;font-weight:bold;">in</span> detectedModules:
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> detectedModule <span style="color: #ff7700;font-weight:bold;">in</span> _processedModules:
            <span style="color: #ff7700;font-weight:bold;">continue</span>
&nbsp;
        _getModuleData<span style="color: black;">&#40;</span>detectedModule<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">True</span></pre></div></div>

<p>The recursiveReload method within the module is what is of interest here. To use this script, simply pass a module to this method. It will collect all modules that have been imported into the current working module, as well as all classes and modules that have been imported from modules or imported using aliases. It will then search each of the collected sub modules for the same information, and so on and so forth. When it hits the bottom, it will finish searching and then begin the reloading process. It will reload all of the modules, and then re-map extra data such as methods and classes and aliases.</p>
<p>Here is an example of the script in action. Save the following sample scripts in the same directory as the recursiveReload.py module seen above. Run test1a.py and then go and edit and save the test2.py and test3.py files while test1a.py is still running. Not everything will properly reload. Now, do the same with test1b.py. All changes should reload.</p>
<p>test1a.py:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> test2
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;font-weight:bold;">import</span> sleep
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'This is test1a.py'</span>
    <span style="color: #008000;">reload</span><span style="color: black;">&#40;</span>test2<span style="color: black;">&#41;</span>
    test2.<span style="color: black;">printStatement</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    sleep<span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span></pre></div></div>

<p>test1b.py:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> test2
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;font-weight:bold;">import</span> sleep
<span style="color: #ff7700;font-weight:bold;">from</span> recursiveReload <span style="color: #ff7700;font-weight:bold;">import</span> recursiveReload
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'This is test1b.py'</span>
    thisModule = <span style="color: #dc143c;">sys</span>.<span style="color: black;">modules</span><span style="color: black;">&#91;</span>__name__<span style="color: black;">&#93;</span>
    recursiveReload<span style="color: black;">&#40;</span>thisModule, debug=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>
    test2.<span style="color: black;">printStatement</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    sleep<span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span></pre></div></div>

<p>test2.py:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> test3 <span style="color: #ff7700;font-weight:bold;">import</span> anotherPrintStatement
<span style="color: #ff7700;font-weight:bold;">from</span> test3 <span style="color: #ff7700;font-weight:bold;">import</span> PrintMultiplication <span style="color: #ff7700;font-weight:bold;">as</span> PrintMulti
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> printStatement<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'This is test2.py'</span>
    anotherPrintStatement<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    PrintMulti<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span></pre></div></div>

<p>test3.py:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> anotherPrintStatement<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'This is test3.py'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> PrintMultiplication<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, x, y<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> x <span style="color: #66cc66;">*</span> y</pre></div></div>

<p>Feel free to continue adding more modules and make the importation chain even longer. It should continue to work.</p>
<p>You can pass True to the optional argument <em>debug</em> to have information printed to the console about which modules are being reloaded. The method will not reload builtin modules, the recursiveReload module, the __main__ module (it qualifies as a builtin anyways), and any modules that originate from the Python installation&#8217;s standard library but not in the site packages.</p>
<p>There are a few situations where this module currently will not work. It will fail when importing variables from other modules that are storing basic data types such as strings, ints, floats, booleans. They cannot be traced back to the module where they originated from using the inspect.getmodule method.</p>
<p>This will also fail if you change an import statement from <em>from moduleName import moduleName</em> to <em>import moduleName</em>, if moduleName is the name of the module and then name of an object from within the module that you are importing. I have yet to get this change properly remapping. You can, however, change an import statement from <em>from moduleName import methodName </em>to <em>import moduleName</em> with no issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/tools/maya/python-module-recursivereload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Separate blendshapes seamlessly in Maya</title>
		<link>http://www.mathiesonfacer.com/featured/separate-blendshapes-seamlessly-in-maya/</link>
		<comments>http://www.mathiesonfacer.com/featured/separate-blendshapes-seamlessly-in-maya/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 21:54:03 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1264</guid>
		<description><![CDATA[Last week, I had to come up with a way of separating one blendshape into multiple blendshapes. So basically, imagine we have one blendshape of a full smile and we need to separate it into left and right. If you go to the Edit Deformers menu, there is an option to paint blendshape weights. This [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I had to come up with a way of separating one blendshape into multiple blendshapes. So basically, imagine we have one blendshape of a full smile and we need to separate it into left and right.</p>
<p>If you go to the Edit Deformers menu, there is an option to paint blendshape weights. This is the tool we will be using, but the tricky part of separating blendshapes like this is the overlap area between the shapes. Since blendshapes are additive, if the overlap area is not done properly, when both blendshapes are enabled you may run into areas where it is morphing more or less than what you intended.</p>
<p><span id="more-1264"></span></p>
<p>So, our issue is essentially that these weights are not normalized. There is a simple solution to this problem: paint the weights using a skin node so that they are normalized, and then transfer the weights over to our blendshape node.</p>
<p>To do this, you will need to have good UVs set up for your mesh. They don&#8217;t have to be perfect, but they definitely cannot have any faces overlapping. When the UVs are good to go, duplicate your mesh. This is the mesh we will add the skin node to.</p>
<p>For our example, we are separating our main blendshape into left and right blendshapes. Create two joints and name them &#8220;left_blendshape&#8221; and &#8220;right_blendshape&#8221;. It doesn&#8217;t matter where you place these joints, as we are not going to be using them to deform the mesh. All we care about is getting the weights. Select these two joints and your skinning mesh and then create a smooth bind skin node. Paint your weights for however you want the shapes to be separated. The weights will be normalized so that all influences combined will add up to 1, which means our blendshapes will also add up to 1.</p>
<p>To transfer the weights over to your blendshape, select your skinned mesh and go to Skin &gt; Edit Smooth Skin &gt; Export Skin Weight Maps. Click on the options box. We want to export the luminance. Increase the map size to something large so get as much data transferred as possible. I use 2048&#215;2048. Choose TIFF as the file format. Export the maps to wherever you want, just as long as you remember where you saved them to.</p>
<p>Now, on your mesh that has the blendshape set up, so to Edit Deformers &gt; Paint Blend Shape Weights Tool. Click on the options box to bring up the tools panel. Select your main blendshape that your are wanting to separate into left and right shapes. Go down to Attribute Maps &gt; Import. Make sure Luminance is chosen for Import value and then click on the Import button. Navigate to the folder where you exported your weight maps to from the skin node. Load the &#8220;left_blendshape&#8221; map and when you set the weight for the main blendshape to 1, it should only enable the blendshape on the left side. Duplicate the mesh, and you now have your blendshape for the left side. Repeat this process to get your right side blendshape as well.</p>
<p>Now that you have both your right and left blendshapes as separate meshes, select them both, select your main, undeformed mesh, and create a new blendshape node. The new blendshape node should now have both your left and right side blendshapes, and if you set both of their weights to 1 in the channel box they should add together perfectly and look exactly like the main blendshape that you started the process with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/featured/separate-blendshapes-seamlessly-in-maya/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rig encapsulation using Maya&#8217;s assets</title>
		<link>http://www.mathiesonfacer.com/blog/rig-encapsulation-using-mayas-assets/</link>
		<comments>http://www.mathiesonfacer.com/blog/rig-encapsulation-using-mayas-assets/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 04:10:51 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1257</guid>
		<description><![CDATA[I&#8217;ve been playing around lately with Maya&#8217;s assets, and I think they&#8217;re pretty cool. Following the example provided in Maya&#8217;s documents, I wasn&#8217;t too happy with the result. I had to play around a bit before figuring out how I want to use them. Here are my thoughts on some points after playing around. There [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around lately with Maya&#8217;s assets, and I think they&#8217;re pretty cool. Following the example provided in Maya&#8217;s documents, I wasn&#8217;t too happy with the result. I had to play around a bit before figuring out how I want to use them. Here are my thoughts on some points after playing around.</p>
<p>There are two levels of encapsulation when working with assets: black boxing and attribute locking. Black boxing basically just hides  any non-published nodes from the Outliner so the animators can&#8217;t go getting into trouble with the guts of the rig. The guts of the rig is the proverbial &#8220;big red button&#8221;: leave a note saying &#8220;DO NOT TOUCH&#8221;, and it only increases temptation. Attribute locking goes through the entire asset and locks any attributes that have not been published.</p>
<p><span id="more-1257"></span></p>
<p>There are a few problems with both of these encapsulation types. The biggest problems I have belong to the attribute locking. First off, any attributes you do not publish for the animator to use get locked and hidden. This means that for any attribute you want the animator to use, you actually need to publish. The problem with this is that every published attribute gets added to the asset node. This is a very useful feature, as you can publish your geometry visibility and controls visibility toggles, for example, and have them appear on the master node of the encapsulated rig, but when you have a hundred or so controls in the rig and several attributes per control that need to be published&#8230; well, yeah, it becomes cluttered and messy. All of a sudden a great feature has become completely useless.</p>
<p>Second problem with attribute locking is, locking certain attributes on certain nodes can actually break your rig. I wrote a MEL script on a previous production that was to go through all hidden nodes and lock all attributes on those nodes. I found that after doing this it would actually kill my IK handles and/or constraints (I didn&#8217;t bother trying to troubleshoot it much since it was obviously having major issues, so not sure exactly which nodes and attributes were having the problem). I thought Autodesk would have been taken into consideration with Maya&#8217;s assets, but apparently not. I ran into the same issue where parts of my rig just straight up broke after locking attributes.</p>
<p>The problem with black boxing, luckily, is a very small problem which can be easily fixed. The problem is that, although unpublished nodes are hidden from the Outliner, the animators can still select them when doing a select hierarchy command, so they&#8217;re not actually fully &#8220;black-boxed&#8221;. I fixed this by setting up two script jobs. The first script job is for when a scene is loaded. When the scene is loaded, it collects all asset container nodes, cycles through them, and appends the names of all unpublished nodes in each asset container to a shared array. The other script job is for whenever a new selection is made. When a new selection is made, the script job just quickly deselects the list of unpublished nodes we collected earlier.</p>
<p>One other issue I&#8217;ve run into is that when you add nodes to an asset, it essentially makes it impossible to work with it in the hypergraph. All of the nodes are stored in a container, and there is no isolating the nodes. If you select one node and tell it to graph just one level deep for inputs and outputs, it ignores you. You are looking at the entire node graph at all times, whether you like it or not. For this reason, I&#8217;ve actually made this entire process automated, and it is performed when the rig gets published. The script assumes you are organizing your rig scene a certain way, and then packages the rig accordingly. To explain further, when I start creating a rig, I have a hierarchy of group nodes set up that looks similar to the following:</p>
<ul>
<li>master</li>
<ul>
<li>controls</li>
<li>geo</li>
<ul>
<li>highRes</li>
<li>lowRes</li>
</ul>
<li>rig</li>
<ul>
<li>joints</li>
<li>deformers</li>
<li>misc</li>
</ul>
</ul>
</ul>
<p>The packaging script knows to expect these nodes. It collects all nodes under the master node and adds them into an asset. Then, it collects all nodes under controls prefixed with &#8220;CNT_&#8221; and publishes them so they will still appear in the Outliner when blackboxed. Once blackboxed, the &#8220;CNT_&#8221; prefix is kind of redundant since every single node you see will have &#8220;CNT_&#8221; in front. I like to remove the prefix during packaging so that the animator only sees &#8220;LeftArm&#8221; or &#8220;Neck&#8221;, for example. It makes the rig a lot more readable in the Outliner.</p>
<p>Also, the packager expects that all attributes found on the master node found above should be published to the asset. Although I am not using the Lock Attribute feature, publishing attributes still makes it so that those attributes appear on the asset node. There is a setting in the channel box that allows you to have these attributes then be visible whenever you have selected any object belonging to the asset. This can be nice as long as you keep the number of attributes low and they are something that affects the entire rig.</p>
<p>Oh, I almost forgot one other cool thing about using assets. It makes walking the hierarchy a sinch for animators. The up and down arrows do not take you to the shape node, or the group node you have your control parented to. It takes you directly to the next published node and skips everything else in between.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/blog/rig-encapsulation-using-mayas-assets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Final Destination 5</title>
		<link>http://www.mathiesonfacer.com/blog/final-destination-5/</link>
		<comments>http://www.mathiesonfacer.com/blog/final-destination-5/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 00:57:38 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/blog/final-destination-5/</guid>
		<description><![CDATA[A movie I recently worked on came out last weekend. That movie is Final Destination 5. I worked on it over at Prime Focus from February to the end of June. Prime Focus was responsible for the epic bridge collapse sequence in the movie. A lot of hard work went into the sequence, and it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mathiesonfacer.com/wp-content/images/galleryImages/292236_10150758645530445_840485444_20344659_4069721_n.jpg"><img class="size-full wp-image-1252 alignleft" title="292236_10150758645530445_840485444_20344659_4069721_n" src="http://www.mathiesonfacer.com/wp-content/images/galleryImages/292236_10150758645530445_840485444_20344659_4069721_n.jpg" alt="" width="128" height="384" /></a>A movie I recently worked on came out last weekend. That movie is Final Destination 5. I worked on it over at Prime Focus from February to the end of June.</p>
<p>Prime Focus was responsible for the epic bridge collapse sequence in the movie. A lot of hard work went into the sequence, and it featured a lot of gory deaths :)</p>
<p>I was responsible for the digital doubles on the bridge, both background and hero characters. I also wrote some tools for the project including a motion capture importer/mapper, and a tool to help match move easily make adjustments along the camera&#8217;s axis, while not changing how it appears to the camera, when stereoscope issues arose.</p>
<p>If you haven&#8217;t seen the movie yet, consider checking it out. You pretty much know what you&#8217;re going to get from a Final Destination movie, but this installation is a lot of fun, not as predictable with how the deaths play out, and quite funny!</p>
<p><span id="more-1251"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/blog/final-destination-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to Maya Muscle</title>
		<link>http://www.mathiesonfacer.com/blog/intro-to-maya-muscle/</link>
		<comments>http://www.mathiesonfacer.com/blog/intro-to-maya-muscle/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 06:22:47 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1247</guid>
		<description><![CDATA[I started using Maya Muscle this past week for a project I am doing at work. I&#8217;m enjoying it a lot so far. Muscle simulations have come a long way since I was last actively working with them. I started out using the simple muscle system with the muscle spline deformer, but at the advice [...]]]></description>
			<content:encoded><![CDATA[<p>I started using Maya Muscle this past week for a project I am doing at work. I&#8217;m enjoying it a lot so far. Muscle simulations have come a long way since I was last actively working with them.</p>
<p>I started out using the simple muscle system with the muscle spline deformer, but at the advice of the documentation I have started exploring the newer &#8220;Muscle Creator&#8221; system, successor to the &#8220;Muscle Builder&#8221;. I can see how this new system adds more flexibility and makes things even easier again for setting up and customizing muscles (as stated in the docs).</p>
<p><span id="more-1247"></span></p>
<p>I am going to continue testing both methods for the time being though. I&#8217;d like to decide for myself which workflow I think works best rather than just following what the documentation tells me to do. There have been many &#8220;new and improved&#8221; features rolled out in software packages in the past few years which never really caught on. Some do succeed admirably, but it seems just as many end up failing. Best thing to do, usually, is listen to general consensus among peers. So far in my searching, however, I have yet to find a consensus out there. Going to have to figure it out on my own.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/blog/intro-to-maya-muscle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nesquik Commercials</title>
		<link>http://www.mathiesonfacer.com/featured/nesquik-commercials/</link>
		<comments>http://www.mathiesonfacer.com/featured/nesquik-commercials/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 04:18:27 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1238</guid>
		<description><![CDATA[This is another project I did almost two years ago now. Once again, it was a quick turnaround for Hatch Studio, when I was last working at PEN Productions. Paul Neale Rigged the ears on the bunny in the two commercial spots the bunny character was used in, while I took care of the rest [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.mathiesonfacer.com/wp-content/images/galleryImages/nesquik.jpg"><img class="aligncenter size-full wp-image-1239" title="nesquik" src="http://www.mathiesonfacer.com/wp-content/images/galleryImages/nesquik.jpg" alt="" width="546" height="410" /></a></p>
<p style="text-align: left;">This is another project I did almost two years ago now. Once again, it was a quick turnaround for Hatch Studio, when I was last working at PEN Productions. Paul Neale Rigged the ears on the bunny in the two commercial spots the bunny character was used in, while I took care of the rest of the character. I think Hatch did a great job on these commercials, as well as the Kid&#8217;s Cuisine spots.</p>
<p><span id="more-1238"></span></p>
<p style="text-align: left;"><a href="http://www.hatchstudios.net/#index.cfm?event=display.work&amp;workid=148" target="_blank">Click here to head over to Hatch Studio&#8217;s website and watch the ads.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/featured/nesquik-commercials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kid Cuisine Commericals</title>
		<link>http://www.mathiesonfacer.com/featured/kid-cuisine-commericals/</link>
		<comments>http://www.mathiesonfacer.com/featured/kid-cuisine-commericals/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 03:53:43 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1220</guid>
		<description><![CDATA[This was a project from close to two years ago now. Time sure does fly. It was a quick turnaround for Hatch Studio when I was last working with PEN Productions. I did all the rigging on the penguin-looking main character, &#8220;Kid&#8221;. Click here to visit Hatch Studio&#8217;s website and check out the ads.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mathiesonfacer.com/wp-content/images/galleryImages/kidCuisine.jpg"><img title="kidCuisine" src="http://www.mathiesonfacer.com/wp-content/images/galleryImages/kidCuisine.jpg" alt="" width="546" height="410" /></a></p>
<p>This was a project from close to two years ago now. Time sure does fly. It was a quick turnaround for Hatch Studio when I was last working with PEN Productions. I did all the rigging on the penguin-looking main character, &#8220;Kid&#8221;.</p>
<p><span id="more-1220"></span></p>
<p><a href="http://www.hatchstudios.net/#index.cfm?event=display.work&amp;workid=119">Click here to visit Hatch Studio&#8217;s website and check out the ads.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/featured/kid-cuisine-commericals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEN Productions Master Classes</title>
		<link>http://www.mathiesonfacer.com/news/pen-productions-master-classes/</link>
		<comments>http://www.mathiesonfacer.com/news/pen-productions-master-classes/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 03:53:35 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1132</guid>
		<description><![CDATA[Paul Neale and PEN Productions are now offering online Master Classes! Paul is one of the top character riggers, modelers, and technical directors in the 3DS Max community and has been recognized by Autodesk as a 3DS Max Master. Three classes are currently being offered: Max/Mudbox Workflow, Intro to Character Rigging, and Max Script for [...]]]></description>
			<content:encoded><![CDATA[<p>Paul Neale and PEN Productions are now offering online Master Classes! Paul is one of the top character riggers, modelers, and technical directors in the 3DS Max community and has been recognized by Autodesk as a 3DS Max Master.</p>
<p>Three classes are currently being offered: Max/Mudbox Workflow, Intro to Character Rigging, and Max Script for Character Rigging. This is a great opportunity if any of these topics appeal to you, as you are being taught directly by one of the best in the business and unlike DVDs and video tutorials you get the chance to ask questions.</p>
<p><span id="more-1132"></span></p>
<p>Head over to the <a href="http://www.paulneale.com/masterClasses/" target="_blank">PEN Productions</a> website to check out details!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/news/pen-productions-master-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sticky Lips: How To &amp; Sample File</title>
		<link>http://www.mathiesonfacer.com/featured/sticky-lips-how-to-sample-file/</link>
		<comments>http://www.mathiesonfacer.com/featured/sticky-lips-how-to-sample-file/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 00:53:11 +0000</pubDate>
		<dc:creator>Mat</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[R&D]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.mathiesonfacer.com/?p=1076</guid>
		<description><![CDATA[It was requested that I release my sticky lips setup so people could try to take the solution further. I haven&#8217;t spent much time on it since posting about it way back, so I figured I might as well. Only thing I ask of anybody that does further develop this is please provide a link [...]]]></description>
			<content:encoded><![CDATA[<p>It was requested that I release my sticky lips setup so people could try to take the solution further. I haven&#8217;t spent much time on it since posting about it way back, so I figured I might as well. Only thing I ask of anybody that does further develop this is please provide a link back to my website and keep me up to date on any improvements you have made :)</p>
<p><a href="http://www.mathiesonfacer.com/wp-content/sampleFiles/stickyLips.zip">Click here to download the sample file</a> (Made in 3ds Max 2010, and is of a Sackboy-looking teapot since I do not want to be distributing the model seen below, which is not mine, around the internets)</p>
<p>A video of the effect in action. Special thanks to Craig Hobbs for use of the model:</p>
<p><object width="546" height="410" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=25393000&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed width="546" height="410" type="application/x-shockwave-flash" src="http://vimeo.com/moogaloop.swf?clip_id=25393000&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" allowfullscreen="true" allowscriptaccess="always" /></object></p>
<p>For now I am just going to do a general write-up of some things I am doing in the file and why I am doing them. It might sound like a tutorial at parts, but I&#8217;m more just explaining the general process and thoughts behind the setup. This is not intended to actually be a tutorial, and you may still have to figure some things out on your own.<span id="more-1076"></span></p>
<p><span style="text-decoration: underline;"><strong>PLEASE NOTE</strong></span>: This has not yet been tested in a production scenario; it is just some RnD work I have been doing. The solution does work and is simple to set up, but it does get slow with heavier meshes. This should only be used in the final render rig, as being in the animation rig will make the animator&#8217;s life miserable.</p>
<p><span style="text-decoration: underline;"><strong>UPDATE 1:</strong></span> I may already have an improved method, thanks to <a href="http://www.penproductions.ca/" target="_blank">Paul Neale</a>, for doing this that is much better when it comes to speed and also solves the issue of hands and other extremities passing through the volume selected falloff area. I still have to test it.</p>
<p><span style="text-decoration: underline;"><strong>UPDATE 2:</strong></span> The new method is quite improved, nearly doubling the FPS of the previous method. I am not going to share the new method here, as it basically uses the same ideas listed below. There is only a slight difference, but I will leave that up to you to figure out. I don&#8217;t want to give everything away :)</p>
<hr />
<p>There are a few tricks to this set up. The keys are to have a volume select modifier, a spline with a sweep modifier, a duplicated mesh of your character&#8217;s head, and a morpher modifier above your skin modifier. Its thinking outside the box a little bit, and may seem kind of confusing at first, but after doing it once or twice it really is quite simple.</p>
<p>You&#8217;ll want to start setting this up after you have the jaw skinned for your character. Once you have the jaw all skinned and looking pretty, you need to duplicate the skinned mesh. The only alterations you need to make on this duplicated mesh is with the skinning around the mouth. Change the skinning of the lips so that they remain sealed when the jaw opens. This is how your lips will look when they stick. If you want to improve performance, you can remove all bones from the skin modifier except for the head and jaw bone (or whatever bones are actually influencing the lip area on your mesh). Un-hide the node &#8220;hlp_lips_geo&#8221; in the sample scene to see how mine were set up.</p>
<p>On the original mesh, you will notice there is a morpher modifier above the skin modifier. The reason for it being above the skin modifier is that we want the mesh to assume the absolute pose of our sticky lips mesh, so we want it to morph <em>after</em> the skinning has affected it. Having it below the skin modifier just doesn&#8217;t produce the same result. So, add the morpher modifier above the skin modifier, and then pick the duplicate &#8220;sticky lips&#8221; mesh as the target and turn it up to 100.</p>
<p>If you test it out at this point, you&#8217;ll notice the mesh just morphs back to whatever pose the duplicate mesh was in at the time it was picked. This isn&#8217;t what we want. There is a checkbox in the morpher modifier called &#8220;Automatically reload targets&#8221;. This needs to be enabled. This checkbox does exactly what it says and automatically reloads our target mesh. What this means is, since our target mesh is skinned, it will always morph to the current skinned state of the mesh. Once this is enabled, things should look a little better.</p>
<p>Now our lips are sticking, but they&#8217;re never un-sticking. This is where the volume select and a spline with a sweep come into play. Select the edges of the lower or upper lip, where they would be sticking, from one corner of the mouth to the other, and extract the edges as a shape. You can just go and make your own spline shape if you want, I just find this to be easiest and the most accurate method of getting the shape. Once the spline is created, it needs a sweep modifier so it had some thickness to it. This spline is what will be driving our volume select modifier, which is controlling our morpher modifier.</p>
<p>Up next, we need to add the volume select to the main head mesh, under the morpher modifier. Change the settings to what I have set up in the sample file. The main things to change are selection level to vertex, and select by mesh object, picking your spline. Enabling soft selection here is quite important, and you will have to play with the settings further down the road when you are fine tuning the stickiness.</p>
<p>We need the spline to follow the mouth&#8217;s skinning now. We want it to sit in the middle of the lips when opening, so the easiest way to achieve this is to skin wrap it to the duplicate mesh and then convert to skin. I had some errors with Max when leaving the skin wrap on the spline after converting it to skin; I consistently experienced issues with the viewport no longer redrawing, and the odd time Max would crash. The great thing about this method, and using a skin wrap here, is that if you have morph targets set up for your head you can easily extract matching shapes for your spline. You can even write a script to just go and automatically extract all shapes and set up a new morpher on the spline, making all the same connections as on the head&#8217;s morpher.</p>
<p>I have given the animator some manual controls for the stickiness. You can find these controls on the attribute holder on the jaw control object. I rigged the spline using a simple affect region modifier, connecting the side to side motion up to the slider labelled &#8220;Unstick Point&#8221; and then connecting the depth of the affect region (the y-axis of the end point) to the &#8220;Unstick&#8221; spinner. I also connected up the falloff from the affect region to the &#8220;Sticky Range&#8221; slider, pinch from the affect region to the &#8220;Sticky Pinch&#8221; spinner, and the morph target on the main head to the &#8220;Sticky Enabled&#8221; spinner. There may be other settings that would be useful for the animator to have control of, but this is all I&#8217;ve chosen to do in this example. Play around with each to see how it affects the end result. You may also want to play with the soft selection settings on the volume select, or the radius on the sweep modifier.</p>
<p>The reason this solution has speed issues is mostly because of the volume select modifier. It will work best with lower density meshes. Also, since it is generating a selection based on vertices being within a certain range of the spline object, if the character&#8217;s hand belongs to the same mesh and goes within this range, it may cause some issues. Just some things to consider. I am already thinking up ways to get around these issues, but I haven&#8217;t tested any of them yet.</p>
<p>That&#8217;s all for now. I just wanted to get this posted. Hope you&#8217;ve found it helpful! If you do not fully understand something I am explaining above, try examining the Max file to figure out what I did. If it still doesn&#8217;t make sense, feel free to leave your question in the comments below. Positive feedback is always welcome too :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mathiesonfacer.com/featured/sticky-lips-how-to-sample-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

