<?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>zoomy dot net &#187; Code</title>
	<atom:link href="http://zoomy.net/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://zoomy.net</link>
	<description>an animation examination.</description>
	<lastBuildDate>Sun, 26 Feb 2012 00:03:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Check for Existence of a Variable in MEL</title>
		<link>http://zoomy.net/2011/06/16/check-for-existence-of-a-variable-in-mel/</link>
		<comments>http://zoomy.net/2011/06/16/check-for-existence-of-a-variable-in-mel/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 15:13:23 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MEL]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1795</guid>
		<description><![CDATA[Error-catching in MEL with the catch command won&#8217;t catch a &#8220;variable does not exist&#8221; error, so use whatIs instead: if (`whatIs "$test"` == "Unknown") { print "yes"; } else { print "no"; } There ya go.]]></description>
			<content:encoded><![CDATA[<p>Error-catching in MEL with the <code>catch</code> command won&#8217;t catch a &#8220;variable does not exist&#8221; error, so use <code>whatIs</code> instead:</p>
<p><code>if (`whatIs "$test"` == "Unknown") {<br />
    print "yes";<br />
} else {<br />
  print "no";<br />
}</code></p>
<p>There ya go.</p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2011/06/16/check-for-existence-of-a-variable-in-mel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Importing Expressions in Maya</title>
		<link>http://zoomy.net/2011/04/24/importing-expressions-in-maya/</link>
		<comments>http://zoomy.net/2011/04/24/importing-expressions-in-maya/#comments</comments>
		<pubDate>Sun, 24 Apr 2011 21:21:50 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MEL]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1732</guid>
		<description><![CDATA[Writing expressions in Maya is a huge pain. The error messages are vague, there&#8217;s no stack trace, and the editor is a text entry field with no line numbers, syntax highlighting, or line wraps. And Maya forbid you try to write a script with a dynamically-generated expression in it &#8212; then everything has to be [...]]]></description>
			<content:encoded><![CDATA[<p>Writing expressions in Maya is a huge pain. The error messages are vague, there&#8217;s no stack trace, and the editor is a text entry field with no line numbers, syntax highlighting, or line wraps. And Maya forbid you try to write a script with a dynamically-generated expression in it &#8212; then everything has to be a giant encoded string. And when you try to run it, it squirts venom at you from its eyeballs.</p>
<p>However, it&#8217;s possible to write and edit your expression in the text editor of your choice, save it to a file, and import that file into your script at runtime. This is much, much nicer, and comes with less venom.</p>
<p>There&#8217;s a way using <code>fread</code> to put the entire contents of a file into a string at once, but I had trouble with it &#8212; this way, reading a line at a time, seems to work better. [Based on <a href="http://www.scriptswell.net/2010/09/mel-tutorial-how-to-read-text-file.html">this tutorial</a> from <a href="http://www.scriptswell.net/">Jay Grenier's Script Swell</a>.]</p>
<p><strong>Code follows:</strong></p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2011/04/24/importing-expressions-in-maya/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>selectTrigger v01</title>
		<link>http://zoomy.net/2010/12/23/selecttrigger-v01/</link>
		<comments>http://zoomy.net/2010/12/23/selecttrigger-v01/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 04:55:04 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MEL]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1705</guid>
		<description><![CDATA[Here&#8217;s a Maya script I wrote to trigger the selection of one object with the selection of another, inspired by Hamish McKenzie&#8216;s Trigger UI, as seen in Andrew Silke&#8216;s venerable Generi rig. The script makes a scriptNode, which creates and tracks a scriptJob. The scriptJob checks selected objects each time something is selected, and if [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a Maya script I wrote to trigger the selection of one object with the selection of another, inspired by <a href="http://macaronikazoo.com/">Hamish McKenzie</a>&#8216;s Trigger UI, as seen in <a href="http://www.andrewsilke.com/">Andrew Silke</a>&#8216;s venerable <a href="http://www.andrewsilke.com/generi_rig/generi_rig.html">Generi rig</a>.</p>
<p><iframe src="http://player.vimeo.com/video/18108732?title=0&amp;byline=0&amp;portrait=0" width="550" height="309" frameborder="0"></iframe></p>
<p>The script makes a scriptNode, which creates and tracks a scriptJob. The scriptJob checks selected objects each time something is selected, and if the control object is first in the selection list, the target objects will be selected as well. Since scriptJobs only last until the scene is closed, the scriptNode also re-creates the scriptJob when the scene is reopened.</p>
<p>I&#8217;d like to draw your particular attention to line 34, wherein I escape a backslash <em>six times.</em></p>
<p>Download script here: <a href="http://zoomy.net/pub/selectTrigger_v01.mel">selectTrigger_v01.mel</a></p>
<p>Code follows:</p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/12/23/selecttrigger-v01/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ramp rig</title>
		<link>http://zoomy.net/2010/12/07/ramp-rig/</link>
		<comments>http://zoomy.net/2010/12/07/ramp-rig/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 02:28:06 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1679</guid>
		<description><![CDATA[Occasionally in my Maya rigging work I want to use and animate a ramp (or many ramps) as part of a node network, but going through the ramp-editing interface is tedious, and the graph editor doesn&#8217;t give me the visual feedback I&#8217;d like. So I wrote a script that creates a simple interface for manipulating [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally in my Maya rigging work I want to use and animate a ramp (or many ramps) as part of a node network, but going through the ramp-editing interface is tedious, and the graph editor doesn&#8217;t give me the visual feedback I&#8217;d like. So I wrote a script that creates a simple interface for manipulating a monochrome ramp in the viewport.</p>
<p><iframe src="http://player.vimeo.com/video/17584993?title=0&amp;byline=0&amp;portrait=0" width="550" height="309" frameborder="0"></iframe></p>
<p>Note that real-time feedback is only available in the viewport&#8217;s &#8220;High Quality&#8221; mode.</p>
<p>Download the file here: <a href="http://zoomy.net/pub/rampRig01.py">rampRig01.py</a></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/12/07/ramp-rig/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coral Towers</title>
		<link>http://zoomy.net/2010/08/30/coral-towers/</link>
		<comments>http://zoomy.net/2010/08/30/coral-towers/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 05:25:00 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1640</guid>
		<description><![CDATA[New attachment support in my favela-generating code, plus a Romanesque model set, and I&#8217;ve got a collaboration by de Chirico and Dr. Seuss.]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/14535881?title=0&amp;byline=0&amp;portrait=0" width="550" height="550" frameborder="0"></iframe></p>
<p>New attachment support in my favela-generating code, plus a Romanesque model set, and I&#8217;ve got a collaboration by de Chirico and Dr. Seuss.</p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/08/30/coral-towers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Translucent City</title>
		<link>http://zoomy.net/2010/08/04/translucent-city/</link>
		<comments>http://zoomy.net/2010/08/04/translucent-city/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 12:51:24 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1620</guid>
		<description><![CDATA[Made with my foetal citybuilder script, rendered in with mental ray using the misss_physical shader.]]></description>
			<content:encoded><![CDATA[<p><object width="540" height="540"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13872345&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 src="http://vimeo.com/moogaloop.swf?clip_id=13872345&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" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="540" height="540"></embed></object></p>
<p>Made with my foetal citybuilder script, rendered in with mental ray using the misss_physical shader.</p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/08/04/translucent-city/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Voxelizer 1.0</title>
		<link>http://zoomy.net/2010/07/03/voxelizer-1-0/</link>
		<comments>http://zoomy.net/2010/07/03/voxelizer-1-0/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 22:37:43 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1580</guid>
		<description><![CDATA[Voxelizer 1.0 is a script written in Python for Maya. It builds an array of animated cubes in the shape of selected target objects. It takes the color of the cubes from the texture and lighting of the object, and respects visibility and transparency. It also allows keyable voxel and gap sizes, by checking the [...]]]></description>
			<content:encoded><![CDATA[<p><object width="550" height="550"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13045902&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=13045902&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="550" height="550"></embed></object></p>
<p>Voxelizer 1.0 is a script written in Python for Maya. It builds an array of animated cubes in the shape of selected target objects. It takes the color of the cubes from the texture and lighting of the object, and respects visibility and transparency. It also allows keyable voxel and gap sizes, by checking the sizes of optional control objects.</p>
<p>Download files here:<br />
<a href="http://zoomy.net/pub/Voxelizer1.0.py">Voxelizer1.0.py</a><br />
<a href="http://zoomy.net/pub/Voxelizer1.0_test.ma">Voxelizer1.0_test.ma</a> (Maya 2010)</p>
<p>Instructions and code follow:</p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/07/03/voxelizer-1-0/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Banana 02</title>
		<link>http://zoomy.net/2010/06/24/banana-02/</link>
		<comments>http://zoomy.net/2010/06/24/banana-02/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 14:35:56 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1567</guid>
		<description><![CDATA[Separate controls for the size of the voxel grid and the size of the cubes.]]></description>
			<content:encoded><![CDATA[<p><object width="550" height="550"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12812867&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12812867&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="550" height="550"></embed></object></p>
<p>Separate controls for the size of the voxel grid and the size of the cubes. </p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/06/24/banana-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Banana</title>
		<link>http://zoomy.net/2010/06/22/banana/</link>
		<comments>http://zoomy.net/2010/06/22/banana/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 02:33:14 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1563</guid>
		<description><![CDATA[The code now respects alpha, and can vary the cube size.]]></description>
			<content:encoded><![CDATA[<p><object width="550" height="550"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12782448&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12782448&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="550" height="550"></embed></object></p>
<p>The code now respects alpha, and can vary the cube size. </p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/06/22/banana/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colored Voxels</title>
		<link>http://zoomy.net/2010/05/25/colored-voxels/</link>
		<comments>http://zoomy.net/2010/05/25/colored-voxels/#comments</comments>
		<pubDate>Wed, 26 May 2010 02:41:13 +0000</pubDate>
		<dc:creator>meetar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zoomy.net/?p=1555</guid>
		<description><![CDATA[Returning to the scene of the cubical crime&#8230; I&#8217;ve found a way to apply colors to my mesh-voxelizing script, by sampling the color of the source model with Maya&#8217;s polyGeoSampler command. Incredibly, polyGeoSampler isn&#8217;t queryable. It&#8217;s used to bake the color of a mesh&#8217;s textures to the vertices of the mesh. So once you&#8217;ve done [...]]]></description>
			<content:encoded><![CDATA[<p><object width="550" height="550"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12037650&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12037650&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="550" height="550"></embed></object></p>
<p>Returning to the scene of the cubical crime&#8230;</p>
<p>I&#8217;ve found a way to apply colors to my mesh-voxelizing script, by sampling the color of the source model with Maya&#8217;s polyGeoSampler command. <strong>Incredibly</strong>, polyGeoSampler isn&#8217;t queryable. It&#8217;s used to bake the color of a mesh&#8217;s textures to the vertices of the mesh. So once you&#8217;ve done that, you can query *that* color with the polyNormalPerVertex command.</p>
<p>This technique only gives the expected result as long as your voxels are larger than your polys. Isn&#8217;t there any way to return the color of a texture at a given point on a poly? </p>]]></content:encoded>
			<wfw:commentRss>http://zoomy.net/2010/05/25/colored-voxels/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

