<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title> mel wiki</title>
<link>http://mayamel.tiddlyspot.com</link>
<description>- Your Maya mel / Python / API / scripting resource on the web -</description>
<language>en-us</language>
<copyright>Copyright 2012 WarpCat</copyright>
<pubDate>Thu, 02 Feb 2012 17:36:15 GMT</pubDate>
<lastBuildDate>Thu, 02 Feb 2012 17:36:15 GMT</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>TiddlyWiki 2.4.0</generator>
<item>
<title>Measuring circles</title>
<description>&lt;ul&gt;&lt;li&gt;Circumference&lt;ul&gt;&lt;li&gt;Pi (3.14) times Diameter : C = pi * d&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Diameter:&lt;ul&gt;&lt;li&gt;2 times the Radius :  d = 2 * R&lt;/li&gt;&lt;li&gt;Circumference / pi : C / pi&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Radius:&lt;ul&gt;&lt;li&gt;Half the Diameter : R = d / 2&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Area&lt;ul&gt;&lt;li&gt;Pi times the radius squared : A = pi * r&lt;sup&gt;2&lt;/sup&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<category>MATH</category>
<category>measure</category>
<category>circle</category>
<category>pi</category>
<category>circumference</category>
<category>diameter</category>
<category>radius</category>
<category>area</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BMeasuring%20circles%5D%5D</link>
<pubDate>Thu, 02 Feb 2012 17:35:31 GMT</pubDate>
</item>
<item>
<title>Calculate pi</title>
<description>Pi is the ratio of the circumference of a circle to its diameter, approximately &lt;code&gt;3.14159&lt;/code&gt;. &lt;br&gt;So if you wanted to calculate this yourself:&lt;br&gt;&lt;pre&gt;# Python code:

# diameter is circumference / pi:
diameter = 5.0

# circumference is pi * diameter:
circumference = 15.7079632679

# so:
pi = circumference/diameter
# 3.14159265359
&lt;/pre&gt;</description>
<category>MATH</category>
<category>pi</category>
<category>math.pi</category>
<category>circumference</category>
<category>diameter</category>
<category>circle</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BCalculate%20pi%5D%5D</link>
<pubDate>Thu, 02 Feb 2012 17:30:55 GMT</pubDate>
</item>
<item>
<title>API : Maya Python API 2.0</title>
<description>Starting with Maya 2012 Hotfix 1, enhancements were made to Python scripting with the new 'Maya Python API 2.0'.  You can see some high-level notes &lt;a class=&quot;externalLink&quot; href=&quot;http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&amp;amp;id=16935849&amp;amp;linkID=9242259 &quot; title=&quot;External link to http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&amp;amp;id=16935849&amp;amp;linkID=9242259 &quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.  The docs for it don't seem to be online, but you can download a zip of them here:&lt;br&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://images.autodesk.com/adsk/files/maya-python-api-2-0-docs.zip&quot; title=&quot;External link to http://images.autodesk.com/adsk/files/maya-python-api-2-0-docs.zip&quot; target=&quot;_blank&quot;&gt;http://images.autodesk.com/adsk/files/maya-python-api-2-0-docs.zip&lt;/a&gt;&lt;br&gt;The new api modules are found in the &lt;code&gt;maya.api&lt;/code&gt; package.&lt;br&gt;For example, here is the 'old way' to import &lt;code&gt;OpenMaya&lt;/code&gt;:&lt;br&gt;&lt;pre&gt;import maya.OpenMaya as om
print type(om.MDagPath())
# &amp;lt;class 'maya.OpenMaya.MDagPath'&amp;gt;
&lt;/pre&gt;And the new 'api' way:&lt;br&gt;&lt;pre&gt;import maya.api.OpenMaya as om
print type(om.MDagPath())
# &amp;lt;type 'OpenMaya.MDagPath'&amp;gt;
&lt;/pre&gt;As you can see, the 'old way' typed instances as objects, but the new way types them as physical new types.&lt;br&gt;&lt;br&gt;I've also noticed that it looks like the api objects are no longer being wrapperd via &lt;strong&gt;swig&lt;/strong&gt; objects:  Calls to &lt;code&gt;someSwigObject.disown()&lt;/code&gt; that worked in 2010 will fail on 2012 raising a nice exception:&lt;br&gt;&lt;pre&gt;# AttributeError: 'PyCObject' object has no attribute 'disown' # 
&lt;/pre&gt;This isn't necessarily a result of API 2.0, but it does have a coincidence in timing....&lt;br&gt;&lt;br&gt;It should be noted that as of this authoring the whole API hasn't been ported over: currently only a subset has:  This seems questionable for usage... but I'm not too sure on the background of this project yet.  &lt;br&gt;&lt;br&gt;Here are the list of advantages they post:&lt;br&gt;&lt;ul&gt;&lt;li&gt;Array types are full Python sequences, including slice support.&lt;/li&gt;&lt;li&gt;Methods which take Maya array parameters will usually also take native Python sequences, such as arrays and tuples. *Exceptions are made in some case for performance reasons.&lt;/li&gt;&lt;li&gt;The outputs of methods are usually returned in their return values, not through their parameter lists. Exceptions are made in some cases for performance reasons.&lt;/li&gt;&lt;li&gt;Methods which return multiple values (e.g. MFnFluid.getResolution) return them as a tuple or list, eliminating the need for MScriptUtil.&lt;/li&gt;&lt;li&gt;Object attributes are preferred over rather than set/get methods. For example you can now write &lt;code&gt;array.sizeIncrement=64&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;There are more types of exceptions used when methods fail. Not everything is a RuntimeError, as was the case in the old API.&lt;/li&gt;&lt;li&gt;The new API is generally faster than the old. Up to three times faster in some cases.&lt;/li&gt;&lt;/ul&gt;</description>
<category>API</category>
<category>api 2.0</category>
<category>api.OpenMaya</category>
<category>swig</category>
<category>disown</category>
<category>PyCObject</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BAPI%20%3A%20Maya%20Python%20API%202.0%5D%5D</link>
<pubDate>Tue, 31 Jan 2012 01:01:00 GMT</pubDate>
</item>
<item>
<title>API: Attribute Creation &amp; Usage</title>
<description>Several subjects below, here's what we have:&lt;br&gt;&lt;ol&gt;&lt;li&gt;Overview of API Attribute-Related Concepts&lt;/li&gt;&lt;li&gt;Attribute Property Defaults&lt;/li&gt;&lt;li&gt;Overview of API attribute creation classes&lt;/li&gt;&lt;li&gt;Creation&lt;/li&gt;&lt;li&gt;Example Usage&lt;/li&gt;&lt;li&gt;Differences between 'compound' and 'array'&lt;/li&gt;&lt;li&gt;Understanding Array Indices (physical &amp;amp; logical)&lt;/li&gt;&lt;li&gt;Networked and non-networked plugs&lt;/li&gt;&lt;li&gt;Additional examples&lt;/li&gt;&lt;/ol&gt;&lt;hr&gt;&lt;strong&gt;Important note&lt;/strong&gt;:  &lt;br&gt;In Maya, the term 'attribute' can mean two different things based on where it's used: either the 'user side' or the 'programmer side':&lt;br&gt;&lt;ul&gt;&lt;li&gt;On the user side, they interact with attributes on nodes, querying\setting their values, keyframing them, etc.  The only point of entry is &quot;the attribute&quot;.  The attribute 'has a value', for example.  The value and the attribute go hand in hand.&lt;/li&gt;&lt;li&gt;On the programmer side, an 'attribute' is:&lt;ul&gt;&lt;li&gt;Quoted from 'Complete Maya Programming': &quot;...a template or blueprint for how a piece of data in the node should be &lt;em&gt;created&lt;/em&gt;. The important distinction from the user's perspective is that the attribute doesn't actually hold any data.  It simply provides a specification for the data.  Given this specification, the actual data is created.&quot;.&lt;/li&gt;&lt;li&gt;Basically, it's a description for the type of data that can be stored, but that's only part of the equation (one of four main parts).&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;The next section describes the four areas that are required for data storage\retrieval on a node in the API.&lt;br&gt;&lt;h3&gt;Overview of API Attribute-Related Concepts:&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Attributes&lt;/strong&gt;:&lt;ul&gt;&lt;li&gt;Attributes in the API define the name and type of data a node can store.  &lt;/li&gt;&lt;li&gt;Attributes themselves don't store data, they define what type of data can be stored.&lt;/li&gt;&lt;li&gt;Analogies help:  Picture a house as a representation of a node.  Each attribute is represented as a gate around the house:  Only if a package can 'fit through a certain gate' can it be allowed into the house.  Each gate defines access to one type of 'package', but it itself doesn't store the package.&lt;/li&gt;&lt;li&gt;API attributes differ from user-interaction in Maya on a node.  When in Maya you execute &quot;&lt;code&gt;setAttr sphere02.translsateX 3;&lt;/code&gt;&quot; it feels like you've set the &lt;code&gt;translateX&lt;/code&gt; attribute to the value of &lt;code&gt;3&lt;/code&gt;.  But behind the scenes, it's not being stored that way:   The &lt;code&gt;translateX&lt;/code&gt; attribute is simply the gate through which you've squeezed your numeric package.  Where that value actually lives is discussed below.&lt;/li&gt;&lt;li&gt;They are represented as &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_object.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_object.html&quot; target=&quot;_blank&quot;&gt;MObject&lt;/a&gt; objects, and created\manipulated (at time of creation) via &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnAttribute&lt;/a&gt; and descendant classes.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Plugs&lt;/strong&gt;:&lt;ul&gt;&lt;li&gt;A plug is an instance of an attribute on a node.&lt;/li&gt;&lt;li&gt;They allow you to get and set data, make connections, lock attributes, etc.&lt;/li&gt;&lt;li&gt;Following the house analogy from above, a plug is like a gate-keeper:  It can lock the gate, pass data from outside the gate to inside the gate (and vice-versa), and even connect gates between two different houses together.&lt;/li&gt;&lt;li&gt;They are represented as &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_plug.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_plug.html&quot; target=&quot;_blank&quot;&gt;MPlug&lt;/a&gt; and &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_plug_array.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_plug_array.html&quot; target=&quot;_blank&quot;&gt;MPlugArray&lt;/a&gt; objects.  &lt;/li&gt;&lt;li&gt;They can be created &amp;amp; queried via &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_dependency_node.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_dependency_node.html&quot; target=&quot;_blank&quot;&gt;MFnDependencyNode&lt;/a&gt; (&amp;amp; its descendants), queried via &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_anim_util.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_anim_util.html&quot; target=&quot;_blank&quot;&gt;MAnimUtil&lt;/a&gt;, are passed as an argument to &lt;code&gt;MPxNode.compute()&lt;/code&gt;, and additionally manipulated via &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_d_g_modifier.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_d_g_modifier.html&quot; target=&quot;_blank&quot;&gt;MDgModifier&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Data Handles&lt;/strong&gt;:&lt;ul&gt;&lt;li&gt;When a node is computing data (in its &lt;code&gt;compute()&lt;/code&gt; method) and needs to access data in its data block, it gains that access through a 'data handle'.&lt;/li&gt;&lt;li&gt;Data handles allow you to query and set data living in a data block, as defined by a given attribute.&lt;/li&gt;&lt;li&gt;Data handles can't make connections between attributes or lock them (for example), they only query\set data.  But because of this they can operate much faster than plugs.  In addition, they can query a 'dirty' attribute without forcing a recompute of the DG which can allow for even greater optimization.&lt;/li&gt;&lt;li&gt;Following the analogy, a data handle is like a butler who can put data in storage (received from the plug), and take data out of storage, passing it to the plug.&lt;/li&gt;&lt;li&gt;They are represented as &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_data_handle.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_data_handle.html&quot; target=&quot;_blank&quot;&gt;MDataHandle&lt;/a&gt; and &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_array_data_handle.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_array_data_handle.html&quot; target=&quot;_blank&quot;&gt;MArrayDataHandle&lt;/a&gt; objects.  They are created via &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_data_block.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_data_block.html&quot; target=&quot;_blank&quot;&gt;MDataBlock&lt;/a&gt;s.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Data Blocks&lt;/strong&gt;:&lt;ul&gt;&lt;li&gt;The data block is the location in the node where the attribute values are stored.&lt;/li&gt;&lt;li&gt;Whenever a new instance of a node is created, a new data block is created for it.&lt;/li&gt;&lt;li&gt;Using the house analogy, the data block is the store-room of the house where all the packages are stored.  The butler can put stuff in and take it out.&lt;/li&gt;&lt;li&gt;They are represented as &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_data_block.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_data_block.html&quot; target=&quot;_blank&quot;&gt;MDataBlock&lt;/a&gt; objects, and passed to the &lt;code&gt;MPxNode.compute()&lt;/code&gt; method as an argument: That's the only way (I'm aware of) you can access them.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;Another way to visualize the analogy:&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;Plug&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Attribute&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Data Handle&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Data Block&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;Gate Keeper&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;The Gate&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Butler&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Storeroom&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;Imagine that a node is a house.  &lt;/li&gt;&lt;li&gt;The gate keeper (plug) can lock\unlock the gate, let packages (data) pass through the gate to the butler, magically connect this gate to the gate on another house (so that they share packages), or get packages from the butler.&lt;/li&gt;&lt;li&gt;The gate itself (attribute) limits what type of packages are allowed into the house (or what type of package is retrieved from it).  If the package doesn't fit, an alarm (error) goes off.&lt;/li&gt;&lt;li&gt;Presuming the package fits through the gate, if the gatekeeper wants the package put in the house (or wants to get a packaged stored in the house), he needs to have the butler (data handle) do it for him.&lt;/li&gt;&lt;li&gt;All packages are kept in the storeroom of the home (data block), which the butler knows a quick path to.&lt;/li&gt;&lt;li&gt;Finally, the gate keeper can have direct access to the storeroom if he's tricky (but he's slower than the butler), and if you slip the butler a $20 (and you sneak in via &lt;code&gt;compute()&lt;/code&gt;) you can access the storeroom directly.&lt;/li&gt;&lt;/ul&gt;So you could say:&lt;br&gt;&lt;ul&gt;&lt;li&gt;A package arrives at the home.  Since it fits through the gate, the gatekeeper passes it to the butler.  The butler than puts it in the storeroom.&lt;/li&gt;&lt;/ul&gt;&lt;hr&gt;&lt;hr&gt;&lt;hr&gt;&lt;h3&gt;Attribute Property Defaults&lt;/h3&gt;When a new attribute is created, these are the default states of its various properties.  They are modifiable via &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnAttribute&lt;/a&gt; (attribute superclass).&lt;br&gt;&lt;ul&gt;&lt;li&gt;Readable.&lt;/li&gt;&lt;li&gt;Writable.&lt;/li&gt;&lt;li&gt;Connectable.&lt;/li&gt;&lt;li&gt;Storable.&lt;/li&gt;&lt;li&gt;Cached.&lt;/li&gt;&lt;li&gt;Not arrays.&lt;/li&gt;&lt;li&gt;Have indices that matter.&lt;/li&gt;&lt;li&gt;Do not use an array builder.&lt;/li&gt;&lt;li&gt;Not keyable.&lt;/li&gt;&lt;li&gt;Not hidden.&lt;/li&gt;&lt;li&gt;Not used as colors.&lt;/li&gt;&lt;li&gt;Not indeterminant.&lt;/li&gt;&lt;li&gt;Set to disconnect behavior kNothing.&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Overview of API attribute creation classes:&lt;/h3&gt;All of these inherit from &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_base.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_base.html&quot; target=&quot;_blank&quot;&gt;MFnBase&lt;/a&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnAttribute&lt;/a&gt; : Used for changing the attribute defaults listed above (among others).&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_compound_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_compound_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnCompoundAttribute&lt;/a&gt; : For the creation of 'compound' attributes:  Attributes that can store multiple different data types.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_enum_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_enum_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnEnumAttribute&lt;/a&gt;  :  For the creation of 'enum' attribute types.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_generic_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_generic_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnGenericAttribute&lt;/a&gt;  :  Creation of attrs that can accept specific data types as defined by &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_data.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_data.html&quot; target=&quot;_blank&quot;&gt;MFnData&lt;/a&gt;.  Similar but different from &lt;code&gt;MFnTypedAttribute&lt;/code&gt;, see docs &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/global/docs/mayasdk2012/en_us/index.html?url=files/Technical_Notes_Generic_Attributes.htm,topicNumber=d28e16031&quot; title=&quot;External link to http://download.autodesk.com/global/docs/mayasdk2012/en_us/index.html?url=files/Technical_Notes_Generic_Attributes.htm,topicNumber=d28e16031&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_light_data_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_light_data_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnLightDataAttribute&lt;/a&gt; : For the creation of 'light data' attribute types.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_matrix_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_matrix_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnMatrixAttribute&lt;/a&gt;  :  For the creation of 'matrix' attribute types.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_message_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_message_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnMessageAttribute&lt;/a&gt;  :  For the creation of 'message' attribute types.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_numeric_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_numeric_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnNumricAttribute&lt;/a&gt;  :  For all 'numric' attribute types as defined by &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_numeric_data.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_numeric_data.html&quot; target=&quot;_blank&quot;&gt;MFnNumricData&lt;/a&gt;.  These include boolean, byte, character, short 2short, 3short, int, 2int, 3int, long, 2long, 3long, float, 2float, 3float, double, 2double, 3double, 4double, and finally 'color' and 'point'.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_typed_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_typed_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnTypedAttribute&lt;/a&gt;  :  Creation of attrs that can accept specific data types as defined by &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_data.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_data.html&quot; target=&quot;_blank&quot;&gt;MFnData&lt;/a&gt;.  These include: numeric (based on &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_numeric_data.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_numeric_data.html&quot; target=&quot;_blank&quot;&gt;MFnNumricData&lt;/a&gt;), plugin, pluginGeometry, string, matrix, stringArray, doubleArray, intArray, pointArray, vectorArray, componentList, mesh, lattice, nurbsCurve, nurbsSurface, sphere, dynArrayAttrs, dynSweptGeometry, subdSurface, nObject.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_unit_attribute.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/API/class_m_fn_unit_attribute.html&quot; target=&quot;_blank&quot;&gt;MFnUnitAttribute&lt;/a&gt;  :  For creation of attributes that store angle, distance, and time.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src=&quot;http://download.autodesk.com/us/maya/2010help/API/class_m_fn_attribute__inherit__graph.gif&quot;&gt;&lt;br&gt;&lt;h3&gt;Creation:&lt;/h3&gt;Placeholders for the node's attributes are initially added as a class-attribute for easy access later.  At this point, then can be filled with &lt;code&gt;MObject&lt;/code&gt;s (since that's what they'll be ultimately), or just be filled with &lt;code&gt;None&lt;/code&gt; since at this point they're not used.&lt;br&gt;&lt;pre&gt;import maya.OpenMaya as ompx
class Foo(ompx.MPxNode):
    attr_someInput = om.MObject() # or None
    attr_someOutput = om.MObject() # or None
&lt;/pre&gt;They are actually created and added to the node inside the plugin's 'initializer' classmethod (or external function.  We'll use classmethod below).  For each attr, they go through one or more of these steps:&lt;br&gt;&lt;ol&gt;&lt;li&gt;Creation : An attribute is created.  You can imagine it just floating in space...&lt;/li&gt;&lt;li&gt;Modification :  After creation, you configure how it should behave.&lt;/li&gt;&lt;li&gt;Attach to node  :  Take it from floating in space, and actually attach it to a specific node.&lt;/li&gt;&lt;li&gt;Defining affects relationship  :  Set if it affects any other attribute.  &lt;strong&gt;Special note&lt;/strong&gt;:  This step must occur after any affected attributes have already been attached to the node (via &lt;code&gt;MPxNode.addAttribute()&lt;/code&gt;).&lt;/li&gt;&lt;/ol&gt;&lt;pre&gt;    @classmethod
    def nodeInitializer(cls):
        # Create the function object that will create the attributes:
        mfnNumericAttribute = om.MFnNumericAttribute()

        # 1. Creation:
        cls.attr_someInput = mfnNumericAttribute.create(&quot;someInput&quot;, &quot;si&quot;, om.MFnNumericData.kFloat)
        # 2. Modification:
        mfnNumericAttribute.setChannelBox(True) # default is False
        mfnNumericAttribute.setKeyable(True)  # default is False
        # 3. Attach to node:
        cls.addAttribute(cls.attr_someInput)

        # 1. Creation:
        cls.attr_someOutput = mfnNumericAttribute.create(&quot;someOutput&quot;, &quot;so&quot;, om.MFnNumericData.kFloat)
        # 2. Modification:
        mfnNumericAttribute.setWritable(False) # Default is True.  This is an output, can't write to it.
        mfnNumericAttribute.setStorable(False) # Default is True.  Do not save value with scene, since it's an output.
        # 3. Attach to node:
        cls.addAttribute(cls.attr_someOutput)

        # 4. Affects relationships for &quot;someInput&quot; attr.  This needs to be executed after
        #     the &quot;someOutput&quot; attr was added to the node.
        cls.attributeAffects(cls.attr_someInput, cls.attr_someOutput)
        # 4. Affects relationships for &quot;someOutput&quot;:
        # None, this is an output
&lt;/pre&gt;&lt;hr&gt;Another attribute type to make is a numric type with children.  A transforms &lt;code&gt;.translate&lt;/code&gt; attribute illustrates this:  There is a root 'translate' attribute you can set, connect to, etc.  But in addition, you can set\connect to its individual children as well:&lt;br&gt;&lt;pre&gt;translate : float 3
--&amp;gt; translateX : float
--&amp;gt; translateY : float
--&amp;gt; translateZ : float
&lt;/pre&gt;How can you set this up in the API?  You first create each of the child attributes, and then, when creating the parent, you pass them as a creation argument.  Here's a simple example snippet:&lt;br&gt;&lt;pre&gt;    @classmethod
    def nodeInitializer(cls):
        mfnNumericAttribute = om.MFnNumericAttribute()

        # Create the children attrs:
        cls.attr_transX = mfnNumericAttribute.create(&quot;translateX&quot;, &quot;tx&quot;, om.MFnNumericData.kFloat)
        cls.attr_transY = mfnNumericAttribute.create(&quot;translateY&quot;, &quot;ty&quot;, om.MFnNumericData.kFloat)
        cls.attr_transZ = mfnNumericAttribute.create(&quot;translateZ&quot;, &quot;tz&quot;, om.MFnNumericData.kFloat)
        # Now create the parent attr by passing in the children:
        cls.attr_trans = mfnNumericAttribute.create(&quot;translate&quot;, &quot;t&quot;, cls.attr_transX, cls.attr_transY, cls.attr_transZ)
        mfnNumericAttribute.setChannelBox(True)
        mfnNumericAttribute.setKeyable(True)
        cls.addAttribute(cls.attr_trans)
&lt;/pre&gt;Some things to note:  &lt;br&gt;&lt;ul&gt;&lt;li&gt;The &lt;code&gt;MFnAttribute&lt;/code&gt; docs say &quot;This form of the create method allows the creation of compound attributes out of numeric attributes.&quot;    So, even though we build using a &lt;code&gt;MFnAttribute&lt;/code&gt;, it ends up being &lt;code&gt;MFnCompoundAttribute&lt;/code&gt;? (I've yet to figure out what's going on here).&lt;ul&gt;&lt;li&gt;When making compound attrs, their children all need to be added to to the class via &lt;code&gt;cls.addAttribute()&lt;/code&gt;. However, in the examples I've seen, when making 'child array attrs', they &lt;em&gt;don't&lt;/em&gt; need to be added that way: only their parent does (like in the above example).&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;You modify the parents parameters (&lt;code&gt;setChannelBox&lt;/code&gt;, etc) not the children, since the children inherit the parameters.&lt;/li&gt;&lt;li&gt;By passing in three &lt;code&gt;kFloat&lt;/code&gt; children, it implies that the &lt;code&gt;someInput&lt;/code&gt; attr is now a &lt;code&gt;k3float&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;If you didn't care about the child attributes, you could simply create the attribute this way:&lt;br&gt;&lt;pre&gt;    @classmethod
    def nodeInitializer(cls):
        mfnNumericAttribute = om.MFnNumericAttribute()

        cls.attr_trans = mfnNumericAttribute.create(&quot;translate&quot;, &quot;t&quot;, om.MFnNumericData.k3Float)
        mfnNumericAttribute.setChannelBox(True) 
        mfnNumericAttribute.setKeyable(True)
        cls.addAttribute(cls.attr_trans)
&lt;/pre&gt;So you can still manipulate &lt;code&gt;translate&lt;/code&gt; as you're used to, but you no longer gain gain access to the children, like &lt;code&gt;translateX&lt;/code&gt;.&lt;br&gt;&lt;h3&gt;Example Usage:&lt;/h3&gt;The attrs are accessed inside the &lt;code&gt;compute()&lt;/code&gt; method.  Take note of a few things:&lt;br&gt;&lt;ol&gt;&lt;li&gt;First there is a query if the given input plug is an instance of the attribute that needs computing.&lt;/li&gt;&lt;li&gt;Next, a data handle based on that instanced attribute is generated pointing inside of the data block.&lt;/li&gt;&lt;li&gt;Work is done on the data.&lt;/li&gt;&lt;li&gt;Finally, another data handle is created pointing to the data defined by the instanced output attribute, the output data is updated, and the input plug is set to clean.&lt;/li&gt;&lt;/ol&gt;&lt;pre&gt;    def compute(self, plug, dataBlock):
        &quot;&quot;&quot;
        This is an overridden method of the MPxNode class.  Does the &quot;work&quot; the node is to perform.

        Parameters:
        plug : MPlug : http://download.autodesk.com/us/maya/2010help/API/class_m_plug.html
        dataBlock : MDataBlock : http://download.autodesk.com/us/maya/2010help/API/class_m_data_block.html
        &quot;&quot;&quot;
        # Check that the requested recompute is our output value
        if (plug == Foo.attr_someOutput):
            # Read the input values, returns a MDataHandle, which is  a smart pointer
            # back into the MDataBlock (dataBlock)
            # http://download.autodesk.com/us/maya/2010help/API/class_m_data_handle.html
            dataHandle = dataBlock.inputValue(Foo.attr_someInput)

            # Compute the output values.  In this case, it is a simple mult operation:
            outVal = dataHandle.asFloat() * 10

            # Get a handle to the output value and store the new value.
            handle = dataBlock.outputValue(Foo.attr_someOutput)
            handle.setFloat(outVal)

            # From the docs:  Tells the dependency graph that the given attribute
            # has been updated and is now clean. This should be called after the
            # data in the plug has been recalculated from the inputs of the node.
            dataBlock.setClean(plug)
        else:
            # c++ requires this return, it seems that the Python API doesn't
            # based on my experiments.  Doesn't hurt to leave it though.
            return om.MStatus.kUnknownParameter
&lt;/pre&gt;&lt;h3&gt;Differences between 'compound' and 'array'&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;compound&lt;/strong&gt; is an *attribute type*, like float, string, double etc.  You can't have a &quot;compound float&quot; attribute in the same way you can't have a &quot;string double&quot;.  But you can have a compound attr that has child string, double, and float attributes.  Compound attributes themselves store no values:  They are simply parents of other attribute types.  &lt;ul&gt;&lt;li&gt;Compound attributes are considered 'parents', while they contain 'child' attributes.&lt;/li&gt;&lt;li&gt;The child of a compound attribute can be any other attribute type, including another compound attribute, which has children (which could be compound attributes, etc).  Examples of this are the mesh node's &lt;code&gt;colorPerVertex&lt;/code&gt; compound attribute.  It has a child compound attribute &lt;code&gt;vertexColor&lt;/code&gt;, which has a child compound attribute &lt;code&gt;vertexFaceColor&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;array&lt;/strong&gt; (also known as 'multi' when being created via mel, I think...) is a *property of an attribute*, like being readable, writable, keyable, etc. In theory any attribute type can be made array, *including compound attrs*.  &lt;ul&gt;&lt;li&gt;An example of this is a mesh node's &lt;code&gt;uvSet&lt;/code&gt; attr: It is a compound attr, but is &lt;em&gt;also an array&lt;/em&gt;, which gets confusing fast when trying to access it and its children.  &lt;/li&gt;&lt;li&gt;Array attributes contain multiple 'element attributes', one for each index in the array.  These in turn can be any type, including compound, which in turn could also be array, etc. &lt;/li&gt;&lt;li&gt;Array elements are not 'children attributes', since only compound attrs have official 'children'.  Array attributes are a single attr, that holds multiple values in a list.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Understanding Array Indices (physical &amp;amp; logical)&lt;/h3&gt;Given an attribute that is also array, you can reference its elements two different ways, via the &quot;physical indices&quot; and the &quot;logical indices&quot;.&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Physical index&lt;/strong&gt; : Range from 0 -&amp;gt; &lt;code&gt;numElements()&lt;/code&gt;-1.  Given four plugs for elements A, B, C, and D, A is index 0, B1, C2, D3.  If plug B was deleted, now: A0, C1, D2:  As you can see, the physical index for a given plug can change based on creation and deletion.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Logical index&lt;/strong&gt; : For a given element, this is an assigned\fixed\absolute index that will never change regardless of creation or deletion of other indices.  You can use the plugs &lt;code&gt;getExistingArrayAttributeIndices()&lt;/code&gt; method to populate a &lt;code&gt;MIntArray&lt;/code&gt; with the existing indices.&lt;ul&gt;&lt;li&gt;Referring to an array element in MEL uses the logical index.  MEL can't get the physical index.&lt;/li&gt;&lt;li&gt;Connections between attributes are based on their *logical indices*.  This is needed since the logical indices don't change (and you don't want connections to change after they've been made...).&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;You can query these indices via &lt;code&gt;MPlug&lt;/code&gt;.  Below is some example code and results showing the differences between them.  When calling to &lt;code&gt;elementByLogicalIndex()&lt;/code&gt;, if the given index doesn't yet exist (it is a 'sparse array'), it is created and populated with a default value for that attribute.&lt;br&gt;&lt;pre&gt;plg = myPlg.elementByLogicalIndex(2)
plg.setDouble(11)
plg = myPlg.elementByLogicalIndex(10)
plg.setDouble(27)
plg = myPlg.elementByLogicalIndex(0)
plg.setDouble(100)
&lt;/pre&gt;This would be the result of the physical \ logical indices:&lt;br&gt;&lt;pre&gt;Physical 0 \ Logical 0  : 100
Physical 1 \ Logical 2  : 11
Physical 2 \ Logical 10 : 27
&lt;/pre&gt;&lt;h3&gt;Networked and non-networked plugs&lt;/h3&gt;I'll be honest, I really don't understand the ins and outs of these yet.  But some notes:&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;non-networked plug&lt;/strong&gt; : user created plugs used to establish new connections to an attr, get or set a value on an attr.  When one of these is used, a networked version of the plug is created and added to the dependency node network. A non-networked plug contains an array of array indices that plot the path from the root plug to this plug.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;networked plug&lt;/strong&gt; : Dependency node plugs, can't be explicitely created: only referenced by users.  They also describe the 'tree' of plugs indicating connections made to the attributes of the node.&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Additional Examples&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#API: Simple scripted plugin node&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#API: Simple scripted plugin node&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;API: Simple scripted plugin node&quot;&gt;API: Simple scripted plugin node&lt;/a&gt; : A working overview of a bunch of what the above covers.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#API: Find all child attributes under a compound attribute&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#API: Find all child attributes under a compound attribute&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;API: Find all child attributes under a compound attribute&quot;&gt;API: Find all child attributes under a compound attribute&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#API: Find all attributes &amp;amp; plugs on a node&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#API: Find all attributes &amp;amp; plugs on a node&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;API: Find all attributes &amp;amp; plugs on a node&quot;&gt;API: Find all attributes &amp;amp; plugs on a node&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<category>API</category>
<category>ATTRIBUTES</category>
<category>array</category>
<category>compound</category>
<category>enun</category>
<category>matrix</category>
<category>message</category>
<category>color</category>
<category>point</category>
<category>mesh</category>
<category>angle</category>
<category>distance</category>
<category>time</category>
<category>OpenMaya</category>
<category>OpenMaya.MObject</category>
<category>OpenMaya.MPlug</category>
<category>OpenMaya.MPlug.elementByLogicalIndex</category>
<category>OpenMaya.MPlug.getExistingArrayAttributeIndices</category>
<category>OpenMaya.MPlugArray</category>
<category>OpenMaya.MDataBlock</category>
<category>OpenMaya.MDataHandle</category>
<category>OpenMaya.MArrayDataHandle</category>
<category>OpenMaya.MFnBase</category>
<category>OpenMaya.MFnAttribute</category>
<category>OpenMaya.MFnCompoundAttribute</category>
<category>OpenMaya.MFnEnumAttribute</category>
<category>OpenMaya.MFnGenericAttribute</category>
<category>OpenMaya.MFnLightDataAttribute</category>
<category>OpenMaya.MFnMatrixAttribute</category>
<category>OpenMaya.MFnMessageAttribute</category>
<category>OpenMaya.MFnNumricAttribute</category>
<category>OpenMaya.MFnTypedAttribute</category>
<category>OpenMaya.MFnUnitAttribute</category>
<category>OpenMaya.MFnNumricData</category>
<category>OpenMayaMPx</category>
<category>OpenMayaMPx.MPxNode</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BAPI%3A%20Attribute%20Creation%20%26%20Usage%5D%5D</link>
<pubDate>Tue, 31 Jan 2012 00:14:00 GMT</pubDate>
</item>
<item>
<title>Why does adding an item to a Maya main menu remove all the items?</title>
<description>Recently I was trying to hijack Maya's main 'File' menu, to add my own items.  What I found was, when Maya launches, the menu is empty until you physically open it (click on it), at which point it is populated with the various &lt;code&gt;menuItem&lt;/code&gt;s.  If you try to add your own items to the menu before it's been opened, when you open it, only your item will be shown.  This can be shown by this example:&lt;br&gt;&lt;pre&gt;import maya.cmds as mc

fileMenu = 'mainFileMenu'
fileMenuItems = mc.menu(fileMenu, query=True, itemArray=True)
if fileMenuItems:
    for menuItem in fileMenuItems:
        print menuItem
else:
    print &quot;The menu is unpopulated: %s&quot;%fileMenu
&lt;/pre&gt;If you haven't opened the File menu before running that code, you'll get the print statement.&lt;br&gt;&lt;br&gt;How to get this working?  Thanks to a tip from David Moulder, I've come up with this solution:&lt;br&gt;&lt;pre&gt;import maya.cmds as mc
import maya.mel as mm
    
def addToFileMenu():
    # If Maya is in batch mode, just exit, no point to update a menu:
    if mc.about(batch=True):
        return
    # Get the global mel variable name for the File menu:
    gMainFileMenu = mm.eval('string $temp_string = $gMainFileMenu')
    # If the contents of the file menu don't exist, build them:
    if mc.menu(gMainFileMenu, query=True, numberOfItems=True) == 0:
        mm.eval('buildFileMenu()')

    # Add our menu to the very top:
    mc.menuItem(label=&quot;My Awesome Menu&quot;, parent=gMainFileMenu, insertAfter='')
&lt;/pre&gt;After you execute that function, you get an awesome new menu item at the top of Maya's File main menu.&lt;br&gt;&lt;br&gt;The mel proc &lt;code&gt;buildFileMenu()&lt;/code&gt; is found in this script, which is sourced when Maya launches in gui mode:&lt;br&gt;&lt;pre&gt;C:\Program Files\Autodesk\Maya20XX\scripts\startup\FileMenu.mel
&lt;/pre&gt;Looking in that directory, there are other scripts for the other menus: &lt;code&gt;EditMenu.mel&lt;/code&gt;, &lt;code&gt;DisplayMenu.mel&lt;/code&gt;, etc, that can be inspected to find the corresponding code needed to build their contents.&lt;br&gt;&lt;hr&gt;Also see:&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#How can I update Maya's menus with my own entry?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#How can I update Maya's menus with my own entry?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;How can I update Maya's menus with my own entry?&quot;&gt;How can I update Maya's menus with my own entry?&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br&gt;&lt;br&gt;</description>
<category>UI</category>
<category>TROUBLESHOOTING</category>
<category>menu</category>
<category>main menu</category>
<category>menuItem</category>
<category>remove</category>
<category>delete</category>
<category>file menu</category>
<category>mainFileMenu</category>
<category>buildFileMenu</category>
<category>FileMenu.mel</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BWhy%20does%20adding%20an%20item%20to%20a%20Maya%20main%20menu%20remove%20all%20the%20items%3F%5D%5D</link>
<pubDate>Fri, 27 Jan 2012 16:33:00 GMT</pubDate>
</item>
<item>
<title>How can I update Maya's menus with my own entry?</title>
<description>Example:  Embed a link to this wiki into Maya's Help menu:&lt;br&gt;&lt;pre&gt;menuItem 
    -p $gMainHelpMenu 
    -l &quot;MEL Wiki&quot; -ann &quot;Your Maya Mel Resource on the Web &quot; 
    -ecr false -c &quot;showHelp -a \&quot;http://mayamel.tiddlyspot.com/\&quot;&quot;;
&lt;/pre&gt;All of Maya's main menu's have their names defined in global string arrays.&lt;br&gt;&lt;hr&gt;Also see:&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#How can I find the names of Maya's main UI menus?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#How can I find the names of Maya's main UI menus?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;How can I find the names of Maya's main UI menus?&quot;&gt;How can I find the names of Maya's main UI menus?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#How can I append a custom sub-menu to one of Maya's main menus?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#How can I append a custom sub-menu to one of Maya's main menus?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;How can I append a custom sub-menu to one of Maya's main menus?&quot;&gt;How can I append a custom sub-menu to one of Maya's main menus?&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<category>UI</category>
<category>menuItem</category>
<category>showHelp</category>
<category>help</category>
<category>menu</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BHow%20can%20I%20update%20Maya's%20menus%20with%20my%20own%20entry%3F%5D%5D</link>
<pubDate>Fri, 27 Jan 2012 16:30:00 GMT</pubDate>
</item>
<item>
<title>How can I append a custom sub-menu to one of Maya's main menus?</title>
<description>See: &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Why does adding an item to a Maya main menu remove all the items?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Why does adding an item to a Maya main menu remove all the items?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Why does adding an item to a Maya main menu remove all the items?&quot;&gt;Why does adding an item to a Maya main menu remove all the items?&lt;/a&gt;</description>
<category>UI</category>
<category>menu</category>
<category>main menu</category>
<category>menuItem</category>
<category>sub menu</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BHow%20can%20I%20append%20a%20custom%20sub-menu%20to%20one%20of%20Maya's%20main%20menus%3F%5D%5D</link>
<pubDate>Fri, 27 Jan 2012 16:30:00 GMT</pubDate>
</item>
<item>
<title>How can I find the names of Maya's main UI menus?</title>
<description>&lt;h3&gt;Method A, via Python:&lt;/h3&gt;&lt;pre&gt;import maya.cmds as mc
menus = mc.window('MayaWindow', query=True, menuArray=True)
# [u'mainFileMenu', u'mainEditMenu', u'mainModifyMenu', u'mainCreateMenu', ...
&lt;/pre&gt;&lt;h3&gt;Method B, via mel:&lt;/h3&gt;All of Maya's main menu's are prefixed with &lt;code&gt;$gMain&lt;/code&gt;... Here's how to get a list of them all:&lt;br&gt;&lt;pre&gt;string $all[] = `env`;
for($i=0;$i&amp;lt;size($all);$i++)
    {
    if(`match &quot;^\\$gMain&quot; $all[$i]` == &quot;$gMain&quot;)
        {
        global string $temp;
        eval(&quot;$temp = &quot; + $all[$i]);
        print ($all[$i] + &quot; = &quot; + $temp + &quot;\n&quot;);
        }
    }
&lt;/pre&gt;Also see:&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#How can I update Maya's menus with my own entry?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#How can I update Maya's menus with my own entry?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;How can I update Maya's menus with my own entry?&quot;&gt;How can I update Maya's menus with my own entry?&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<category>UI</category>
<category>menu</category>
<category>env</category>
<category>match</category>
<category>eval</category>
<category>window</category>
<category>main menu</category>
<category>name</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BHow%20can%20I%20find%20the%20names%20of%20Maya's%20main%20UI%20menus%3F%5D%5D</link>
<pubDate>Fri, 27 Jan 2012 01:11:00 GMT</pubDate>
</item>
<item>
<title>How can I query if a scene has unsaved changes?</title>
<description>&lt;pre&gt;import maya.cmds as mc
needsSaving = mc.file(query=True, modified=True)
&lt;/pre&gt;Have yet to find a API call for this: &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2011help/API/class_m_file_i_o.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2011help/API/class_m_file_i_o.html&quot; target=&quot;_blank&quot;&gt;MFileIO&lt;/a&gt; (the obvious place for it) doesn't have a similar method.</description>
<category>FILE OPERATION</category>
<category>scene</category>
<category>file</category>
<category>modify</category>
<category>modified</category>
<category>save</category>
<category>unsaved changes</category>
<category>OpenMaya</category>
<category>OpenMaya.MFileIO</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BHow%20can%20I%20query%20if%20a%20scene%20has%20unsaved%20changes%3F%5D%5D</link>
<pubDate>Thu, 26 Jan 2012 23:23:00 GMT</pubDate>
</item>
<item>
<title>Instructions For Use</title>
<description>&lt;div class=&quot;gradient&quot; style=&quot;position: relative; overflow-x: hidden; overflow-y: hidden; z-index: 0; &quot;&gt;&lt;div style=&quot;position: absolute; left: 0%; top: 0px; width: 101%; height: 100%; z-index: -1; background-color: rgb(221, 221, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 2%; top: 0px; width: 99%; height: 100%; z-index: -1; background-color: rgb(221, 221, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 4%; top: 0px; width: 97%; height: 100%; z-index: -1; background-color: rgb(222, 222, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 6%; top: 0px; width: 95%; height: 100%; z-index: -1; background-color: rgb(223, 223, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 8%; top: 0px; width: 93%; height: 100%; z-index: -1; background-color: rgb(223, 223, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 10%; top: 0px; width: 91%; height: 100%; z-index: -1; background-color: rgb(224, 224, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 12%; top: 0px; width: 89%; height: 100%; z-index: -1; background-color: rgb(225, 225, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 14%; top: 0px; width: 87%; height: 100%; z-index: -1; background-color: rgb(225, 225, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 16%; top: 0px; width: 85%; height: 100%; z-index: -1; background-color: rgb(226, 226, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 18%; top: 0px; width: 83%; height: 100%; z-index: -1; background-color: rgb(227, 227, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 20%; top: 0px; width: 81%; height: 100%; z-index: -1; background-color: rgb(227, 227, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 22%; top: 0px; width: 79%; height: 100%; z-index: -1; background-color: rgb(228, 228, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 24%; top: 0px; width: 77%; height: 100%; z-index: -1; background-color: rgb(229, 229, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 26%; top: 0px; width: 75%; height: 100%; z-index: -1; background-color: rgb(229, 229, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 28%; top: 0px; width: 73%; height: 100%; z-index: -1; background-color: rgb(230, 230, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 30%; top: 0px; width: 71%; height: 100%; z-index: -1; background-color: rgb(231, 231, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 32%; top: 0px; width: 69%; height: 100%; z-index: -1; background-color: rgb(231, 231, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 34%; top: 0px; width: 67%; height: 100%; z-index: -1; background-color: rgb(232, 232, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 36%; top: 0px; width: 65%; height: 100%; z-index: -1; background-color: rgb(233, 233, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 38%; top: 0px; width: 63%; height: 100%; z-index: -1; background-color: rgb(233, 233, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 40%; top: 0px; width: 61%; height: 100%; z-index: -1; background-color: rgb(234, 234, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 42%; top: 0px; width: 59%; height: 100%; z-index: -1; background-color: rgb(235, 235, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 44%; top: 0px; width: 57%; height: 100%; z-index: -1; background-color: rgb(235, 235, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 46%; top: 0px; width: 55%; height: 100%; z-index: -1; background-color: rgb(236, 236, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 48%; top: 0px; width: 53%; height: 100%; z-index: -1; background-color: rgb(237, 237, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 50%; top: 0px; width: 51%; height: 100%; z-index: -1; background-color: rgb(238, 238, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 52%; top: 0px; width: 49%; height: 100%; z-index: -1; background-color: rgb(238, 238, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 54%; top: 0px; width: 47%; height: 100%; z-index: -1; background-color: rgb(239, 239, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 56%; top: 0px; width: 45%; height: 100%; z-index: -1; background-color: rgb(240, 240, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 58%; top: 0px; width: 43%; height: 100%; z-index: -1; background-color: rgb(240, 240, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 60%; top: 0px; width: 41%; height: 100%; z-index: -1; background-color: rgb(241, 241, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 62%; top: 0px; width: 39%; height: 100%; z-index: -1; background-color: rgb(242, 242, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 64%; top: 0px; width: 37%; height: 100%; z-index: -1; background-color: rgb(242, 242, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 66%; top: 0px; width: 35%; height: 100%; z-index: -1; background-color: rgb(243, 243, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 68%; top: 0px; width: 33%; height: 100%; z-index: -1; background-color: rgb(244, 244, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 70%; top: 0px; width: 31%; height: 100%; z-index: -1; background-color: rgb(244, 244, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 72%; top: 0px; width: 29%; height: 100%; z-index: -1; background-color: rgb(245, 245, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 74%; top: 0px; width: 27%; height: 100%; z-index: -1; background-color: rgb(246, 246, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 76%; top: 0px; width: 25%; height: 100%; z-index: -1; background-color: rgb(246, 246, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 78%; top: 0px; width: 23%; height: 100%; z-index: -1; background-color: rgb(247, 247, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 80%; top: 0px; width: 21%; height: 100%; z-index: -1; background-color: rgb(248, 248, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 82%; top: 0px; width: 19%; height: 100%; z-index: -1; background-color: rgb(248, 248, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 84%; top: 0px; width: 17%; height: 100%; z-index: -1; background-color: rgb(249, 249, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 86%; top: 0px; width: 15%; height: 100%; z-index: -1; background-color: rgb(250, 250, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 88%; top: 0px; width: 13%; height: 100%; z-index: -1; background-color: rgb(250, 250, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 90%; top: 0px; width: 11%; height: 100%; z-index: -1; background-color: rgb(251, 251, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 92%; top: 0px; width: 9%; height: 100%; z-index: -1; background-color: rgb(252, 252, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 94%; top: 0px; width: 7%; height: 100%; z-index: -1; background-color: rgb(252, 252, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 96%; top: 0px; width: 5%; height: 100%; z-index: -1; background-color: rgb(253, 253, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 98%; top: 0px; width: 3%; height: 100%; z-index: -1; background-color: rgb(254, 254, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 100%; top: 0px; width: 1%; height: 100%; z-index: -1; background-color: rgb(255, 255, 255); &quot;&gt;&lt;/div&gt;This is a &lt;a class=&quot;externalLink&quot; href=&quot;http://tiddlywiki.com/&quot; title=&quot;External link to http://tiddlywiki.com/&quot; target=&quot;_blank&quot;&gt;TiddlyWiki&lt;/a&gt;.  To really get a grasp on how to navigate it, check out their &lt;a class=&quot;externalLink&quot; href=&quot;http://tiddlywiki.com/&quot; title=&quot;External link to http://tiddlywiki.com/&quot; target=&quot;_blank&quot;&gt;homepage&lt;/a&gt;.  Quick directions below:&lt;br&gt;&lt;hr&gt;Conceptually, each 'subject' I post in the wiki is put in a 'tiddler' (based on how &quot;Tiddlywiki's&quot; work).  The &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Instructions For Use&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Instructions For Use&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Instructions For Use&quot;&gt;Instructions For Use&lt;/a&gt; section you're in now is a 'tiddler'.  &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Welcome&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Welcome&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Welcome&quot;&gt;Welcome&lt;/a&gt; is a tiddler.  Tiddlers are like individual blog posts.  I tag each tiddler with keywords relevant to the subject of said tiddler, and you can see those tags on a small box on the top right of each tiddler. Clicking on a tag will display a list of every other subject with that tag. Subjects (tiddlers) are also categorized  on the left menu-bar under larger subject-headings.  ALL the tags from &lt;em&gt;every&lt;/em&gt; tiddler are in the 'Tags tab', which is on the right most column of the page.&lt;br&gt;&lt;br&gt;Mainly, you come to the page looking for an answer, and to find it, you &lt;strong&gt;search&lt;/strong&gt; for tags using keywords that may exist in your problem.  When you find a tag, click on it, and see the resultant subjects... see if one matches what you're looking for.&lt;br&gt;&lt;br&gt;&lt;strong&gt;SEARCHING FOR DATA:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;&lt;li&gt;Browse the &quot;Tags&quot; tab in the &lt;em&gt;right column&lt;/em&gt; for mel-ish key-words.&lt;ul&gt;&lt;li&gt;Inside the Tags tab, major &lt;strong&gt;Categories&lt;/strong&gt; are all in caps, like &quot;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#ATTRIBUTES&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#ATTRIBUTES&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;ATTRIBUTES&quot;&gt;ATTRIBUTES&lt;/a&gt;&quot;. &lt;/li&gt;&lt;li&gt;When picking a 'Tag' with more than one link, you can either:&lt;ol&gt;&lt;li&gt;'&lt;code&gt;Open all&lt;/code&gt;' the topics in that Tag (meaning, fully expand all the topics listed in the middle of that pop-up menu).&lt;/li&gt;&lt;li&gt;Open a single topic by picking its heading.&lt;/li&gt;&lt;li&gt;Show all the headings in the Tag by picking: &lt;code&gt;Open tag 'tagname&lt;/code&gt;'.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Use your web browsers screen-search ability ('Ctrl+F' in both Firefox &amp;amp; Internet Explorer) to find key-words you're after (good if 'Tags' tab is open).&lt;/li&gt;&lt;li&gt;Or start browsing from the &lt;strong&gt;Categories&lt;/strong&gt; section in the &lt;em&gt;left column&lt;/em&gt;.  This will open each of their major headings in a new tiddler.&lt;/li&gt;&lt;/ol&gt;If things get too crowded, use the &quot;close all&quot; from the &lt;em&gt;right column&lt;/em&gt; to clean up the page.  Or, you can use &quot;close others&quot; from an individual tiddler (This block called &quot;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Instructions For Use&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Instructions For Use&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Instructions For Use&quot;&gt;Instructions For Use&lt;/a&gt;&quot; is a tiddler, for example).&lt;br&gt;&lt;hr&gt;&lt;strong&gt;COPYING DATA FROM WIKI, TO MAYA:&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;The way the text has been entered into this wiki, copying code from the source-boxes should work:&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;string $source = &quot;source-code in a box&quot;; 
&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Other times it's not in a box, but is still safe for copy:&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;string $source = &quot;source-code not in a box, but still safe to copy&quot;;&lt;/code&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;If you copy any code outside of a box that's 'not safe', Maya &lt;em&gt;may&lt;/em&gt; have a hard time with it's formatting and be angered. Weird&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description>
<category>wiki</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BInstructions%20For%20Use%5D%5D</link>
<pubDate>Wed, 25 Jan 2012 17:23:00 GMT</pubDate>
</item>
<item>
<title>How can I make my own 'UV Texture Editor'?</title>
<description>The &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/CommandsPython/textureWindow.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/CommandsPython/textureWindow.html&quot; target=&quot;_blank&quot;&gt;textureWindow&lt;/a&gt; command.&lt;br&gt;However, the docs say you can only ever have one of these at a time, and the default one exists on Maya startup.  So given that, it's probably better to work with the default one than make your own.  Based on my tests, I've been unable to get a custom one to work.</description>
<category>UI</category>
<category>TEXTURE</category>
<category>uv texture editor</category>
<category>textureWindow</category>
<category>uv</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BHow%20can%20I%20make%20my%20own%20'UV%20Texture%20Editor'%3F%5D%5D</link>
<pubDate>Mon, 23 Jan 2012 21:26:00 GMT</pubDate>
</item>
<item>
<title>How can I create a material and connected shadingEngine?</title>
<description>Simple function to build the material &amp;amp; shading engine, and connect them together.&lt;br&gt;&lt;pre&gt;# Python code
import maya.cmds as mc

def makeMatAndShader(matName, matType):
    material = mc.shadingNode(matType, asShader=True, name=matName)
    # The material will be selected when created:  Need to de-select before
    # Creating our shadingEngine (since it's a set).
    mc.select(clear=True)
    # Nope, can't do it this way, won't shade properly later for some reason:
    # shader = mc.createNode('shadingEngine', name='%sSG'%material)
    # Need to do it this way:
    shader = mc.sets(renderable=True, name='%sSG'%material) 
    # Can use this rather than a call to connectAttr:
    mc.defaultNavigation(connectToExisting=True, source=material, destination=shader)
    return material, shader
&lt;/pre&gt;&lt;pre&gt;matName = 'myPhong'
matType = 'phong'
print makeMatAndShader(matName, matType)
&lt;/pre&gt;&lt;pre&gt;(u'myPhong', u'myPhongSG')
&lt;/pre&gt;</description>
<category>SHADING</category>
<category>shader</category>
<category>shadingEngine</category>
<category>sets</category>
<category>material</category>
<category>shadingNode</category>
<category>defaultNavigation</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BHow%20can%20I%20create%20a%20material%20and%20connected%20shadingEngine%3F%5D%5D</link>
<pubDate>Fri, 20 Jan 2012 22:53:00 GMT</pubDate>
</item>
<item>
<title>Matrix info</title>
<description>When I first authored this subject I didn't use matrices very often.  But I've found the more I learn about them, the more I end up using them...&lt;br&gt;Also see my other subjects: &lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Working with matrices with Python&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Working with matrices with Python&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Working with matrices with Python&quot;&gt;Working with matrices with Python&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Different ways to access matrix and apply data&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Different ways to access matrix and apply data&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Different ways to access matrix and apply data&quot;&gt;Different ways to access matrix and apply data&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr&gt;Launch help for the root &lt;code&gt;dagNode&lt;/code&gt; type node, which has the base matrix attrs:&lt;br&gt;&lt;pre&gt;showHelp -d &quot;Nodes/dagNode.html
&lt;/pre&gt;Launch help for the &lt;code&gt;transform&lt;/code&gt; node (lots of matrix info):&lt;br&gt;&lt;pre&gt;showHelp -d &quot;Nodes/transform.html&quot;;
&lt;/pre&gt;Web:&lt;br&gt;&lt;ul&gt;&lt;li&gt;I made an image describing how 4x4 matrix multiplication works.  You can find it on my &lt;a class=&quot;externalLink&quot; href=&quot;http://www.akeric.com/blog/?p=693&quot; title=&quot;External link to http://www.akeric.com/blog/?p=693&quot; target=&quot;_blank&quot;&gt;blog here&lt;/a&gt;, or on &lt;a class=&quot;externalLink&quot; href=&quot;http://www.flickr.com/photos/warpcat/3956108191/&quot; title=&quot;External link to http://www.flickr.com/photos/warpcat/3956108191/&quot; target=&quot;_blank&quot;&gt;flickr here&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://books.google.com/books?id=_ztrTBEDK28C&amp;amp;lpg=PA191&amp;amp;ots=r56b7bLPzY&amp;amp;dq=python%20transformation%20matrix&amp;amp;pg=PA181#v=onepage&amp;amp;q=python%20transformation%20matrix&amp;amp;f=false&quot; title=&quot;External link to http://books.google.com/books?id=_ztrTBEDK28C&amp;amp;lpg=PA191&amp;amp;ots=r56b7bLPzY&amp;amp;dq=python%20transformation%20matrix&amp;amp;pg=PA181#v=onepage&amp;amp;q=python%20transformation%20matrix&amp;amp;f=false&quot; target=&quot;_blank&quot;&gt;chapter 9&lt;/a&gt; from the book &lt;a class=&quot;externalLink&quot; href=&quot;http://www.apress.com/book/view/9781590598726&quot; title=&quot;External link to http://www.apress.com/book/view/9781590598726&quot; target=&quot;_blank&quot;&gt;Beginning Game Development with Python and PyGame: From Novice to Professional&lt;/a&gt; has a really well described overview.&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://eddieoffermann.com/blog/tag/matrix-multiplication/&quot; title=&quot;External link to http://eddieoffermann.com/blog/tag/matrix-multiplication/&quot; target=&quot;_blank&quot;&gt;http://eddieoffermann.com/blog/tag/matrix-multiplication/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://www.185vfx.com/2003/03/convert-a-3d-point-to-2d-screen-space-in-maya/&quot; title=&quot;External link to http://www.185vfx.com/2003/03/convert-a-3d-point-to-2d-screen-space-in-maya/&quot; target=&quot;_blank&quot;&gt;http://www.185vfx.com/2003/03/convert-a-3d-point-to-2d-screen-space-in-maya/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Online video lectures from &lt;a class=&quot;externalLink&quot; href=&quot;http://ocw.mit.edu/OcwWeb/Mathematics/18-06Spring-2005/VideoLectures/&quot; title=&quot;External link to http://ocw.mit.edu/OcwWeb/Mathematics/18-06Spring-2005/VideoLectures/&quot; target=&quot;_blank&quot;&gt;MIT&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://knol.google.com/k/koen-samyn/matrices-for-3d-applications/2lijysgth48w1/3&quot; title=&quot;External link to http://knol.google.com/k/koen-samyn/matrices-for-3d-applications/2lijysgth48w1/3&quot; target=&quot;_blank&quot;&gt;http://knol.google.com/k/koen-samyn/matrices-for-3d-applications/2lijysgth48w1/3&lt;/a&gt;#&lt;/li&gt;&lt;li&gt;Two different blog posts by Andy Nicholas: &lt;a class=&quot;externalLink&quot; href=&quot;http://www.andynicholas.com/?p=861&quot; title=&quot;External link to http://www.andynicholas.com/?p=861&quot; target=&quot;_blank&quot;&gt;How to Read a 3&#215;3 Matrix&lt;/a&gt;, &lt;a class=&quot;externalLink&quot; href=&quot;http://www.andynicholas.com/?p=911&quot; title=&quot;External link to http://www.andynicholas.com/?p=911&quot; target=&quot;_blank&quot;&gt;Rotating Points With a 3&#215;3 Matrix&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr&gt;&lt;strong&gt;Quick 4x4 matrix review of an identity matrix&lt;/strong&gt; (presuming +X is 'left', +Y is 'up', and +Z is 'forward').  To visualize the x, y, and z-axes, use your hand:  Hold your right hand in front of you, pointer straight ahead, thumb up, and middle-finger left:  Middle-finger = +X-axis, thumb = +Y-axis, pointer = +Z-axis.&lt;br&gt;&lt;ul&gt;&lt;li&gt;The fourth &lt;em&gt;column&lt;/em&gt; '&lt;code&gt;W&lt;/code&gt;' is for the most part unused, it is always &lt;code&gt;(0, 0, 0, 1)&lt;/code&gt;:  This is called the 'homogeneous row'.  W =  A scalar (single, compared to array) value (also known as the 'homogeneous coordinate') used for conversion from Euclidean to Cartesian coordinates.  I'm using those terms because I read it somewhere, not because I necessarily understand what they're talking about :-P&lt;/li&gt;&lt;li&gt;The first three &lt;em&gt;rows&lt;/em&gt; represent the vectors that point in the x, y, and z directions of the transformation, which represent the &lt;em&gt;axis&lt;/em&gt; in 3D space.  Effectively the orientation/heading of the 'local axis' of a transform in Maya.  They also calculate &lt;em&gt;scale&lt;/em&gt;.&lt;/li&gt;&lt;li&gt;The fourth &lt;em&gt;row&lt;/em&gt; (&lt;code&gt;w&lt;/code&gt;) represents the translation, or point in space when transformed by this matrix.  This is the 'homogeneous row':&lt;/li&gt;&lt;/ul&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;X&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Y&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Z&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;W&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;notes&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;x-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;'left', mag=scaleX&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;y-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;'up', mag=scaleY&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;z-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;'forward', mag=scaleZ&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;(w) translate&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;(remember, the right 'W' column is ignored for what we do in Maya)&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;translation&lt;/strong&gt;:  Derived from the bottom row.&lt;ul&gt;&lt;li&gt;translateX, translateY, translateZ =  &lt;code&gt;(0 ,0 ,0)&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;orientation&lt;/strong&gt;:  Vectors that point in the x, y, and z directions of the transformation.&lt;ul&gt;&lt;li&gt;&lt;code&gt;x-axis&lt;/code&gt; : defines the current heading of the  'left' vector = &lt;code&gt;(1, 0, 0)&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;y-axis&lt;/code&gt; : defines the current heading of the 'up' vector = &lt;code&gt;(0, 1, 0)&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;z-axis&lt;/code&gt; : defines the current heading of the 'forward' vector = &lt;code&gt;(0, 0, 1)&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;scale&lt;/strong&gt; : The magnitude of each x, y, and z-axis defines the scale = &lt;code&gt;(1, 1, 1)&lt;/code&gt;&lt;ul&gt;&lt;li&gt;scaleX = &lt;code&gt;mag(x-axis)&lt;/code&gt; = &lt;code&gt;mag(1, 0, 0)&lt;/code&gt; = 1.0&lt;/li&gt;&lt;li&gt;scaleY = &lt;code&gt;mag(y-axis)&lt;/code&gt; = &lt;code&gt;mag(0, 1, 0)&lt;/code&gt; = 1.0&lt;/li&gt;&lt;li&gt;scaleZ = &lt;code&gt;mag(z-axis)&lt;/code&gt; = &lt;code&gt;mag(0, 0, 1)&lt;/code&gt; = 1.0&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;shear&lt;/strong&gt; : still working on that one ;)&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Some examples, based on that info:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;Where individual rotation axis data is stored in the matrix.  Meaning, when you perform an Euler rotation on a node on an individual axis, what part of the matrix does it modify?  Do you notice that the row and column for the transformed axis (excluding translation operations) aren't modified during the transformation? (since the other axes are transforming &lt;em&gt;around it&lt;/em&gt;.)&lt;br&gt;&lt;u&gt;X-axis&lt;/u&gt; rotation:&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;X&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Y&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Z&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;W&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;x-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;y-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;z-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;(w) translate&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;u&gt;Y-axis&lt;/u&gt; rotation:&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;X&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Y&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Z&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;W&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;x-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;y-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;left&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;z-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;(w) translate&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;u&gt;Z-axis&lt;/u&gt; rotation:&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;X&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Y&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Z&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;W&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;x-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;y-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;1&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;left&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;z-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;(w) translate&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;u&gt;Translate XYZ&lt;/u&gt;:&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;X&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Y&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Z&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;W&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;x-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;y-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;left&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;z-axis&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;left&quot;&gt;(w) translate&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;0&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;Identity matrix rotated 45 degrees along the Z axis.  Compare this to the above chart that shows where those values will be stored.  Note how the z-axis remains the same &lt;code&gt;(0, 0, 1, 0)&lt;/code&gt; since it hasn't changed orientation.  But both the x-axis and y-axis now have a new heading? (since they were transformed by the z-axis rotation)  And notice how all their magnitudes still equals &lt;code&gt;1.0&lt;/code&gt;?  Scale remains at &lt;code&gt;(1,1,1&lt;/code&gt;).&lt;ul&gt;&lt;li&gt;Visualize this using the 'left hand rule' described above:  Start with your left hand at identity.  Imagine there is a point on the tip of each finger corresponding to each identity vector.  Now rotate your hand along the z-axis (pointer) &lt;em&gt;clockwise&lt;/em&gt; 45 degrees.  Your pointer is still pointing the exact same direction &lt;code&gt;(0, 0, 1)&lt;/code&gt;, but the points defined by your thumb (+y) and middle finger (+x) have moved in space.  But they're all still the same distance away from the middle of the transform, so their magnitudes still each equal &lt;code&gt;1.0&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;.707107&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;-.707107&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;.707107&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;&lt;span class=&quot;marked&quot;&gt;.707107&lt;/span&gt;&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;Identity matrix scaled to be half as wide, and twice as high:&lt;/li&gt;&lt;/ul&gt;scaleX = &lt;code&gt;mag(x-axis)&lt;/code&gt; = &lt;code&gt;mag(.5, 0, 0)&lt;/code&gt; = .5&lt;br&gt;scaleY = &lt;code&gt;mag(y-axis)&lt;/code&gt; = &lt;code&gt;mag(0, 2, 0)&lt;/code&gt; = 2&lt;br&gt;scaleZ = &lt;code&gt;mag(z-axis)&lt;/code&gt; = &lt;code&gt;mag(0, 0, 1)&lt;/code&gt; = 1&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;.5&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;hr&gt;&lt;strong&gt;Maya transformation matrix:&lt;/strong&gt;&lt;br&gt;Simple version:&lt;br&gt;&lt;ul&gt;&lt;li&gt; Scale Matrix * Rotate Matrix * Translate Matrix = final matrix&lt;/li&gt;&lt;/ul&gt;Long version:&lt;br&gt;&lt;code&gt;matrix = SP *(-1) S * SH * SP * ST * RP *(-1) RA * R * RP * RT * T&lt;/code&gt;&lt;br&gt;&lt;code&gt;*&lt;/code&gt; = matrix multiplication, (-1) = matrix inversion&lt;br&gt;&lt;ul&gt;&lt;li&gt;SP = scale pivot point : point around which scales are performed&lt;/li&gt;&lt;li&gt;S = scale : scaling about x, y, z axes&lt;/li&gt;&lt;li&gt;SH = shear : shearing in xy, xz, yx&lt;/li&gt;&lt;li&gt;ST = scale pivot translate :  translation introduced to preserve existing scale transformations when moving pivot. This is used to prevent the object from moving when the objects pivot point is not at the origin and a non-unit scale is applied to the object&lt;/li&gt;&lt;li&gt;RP = rotate pivot point : point about which rotations are performed &lt;/li&gt;&lt;li&gt;RA = rotate axis = rotation to orient local rotation space&lt;ul&gt;&lt;li&gt;AX * AY * AZ &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;R = rotate = rotation on x, y, z axes.&lt;ul&gt;&lt;li&gt;RX * RY * RZ (multiplication is defined by rotate order)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;RT = rotate (pivot) translate :  translation introduced to preserve exisitng rotate transformations when moving pivot. This is used to prevent the object from moving when the objects pivot point is not at the origin and the pivot is moved.&lt;/li&gt;&lt;li&gt;T = translate :  translation in x, y, z axes.&lt;/li&gt;&lt;/ul&gt;Matrix multiplication happens in order, from left to right.  It can be thought of exactly like a transform hierarchy, with child nodes on the left, and parental nodes on the right.  The matrix to the right will effect the matrix to the left.  So in effect, the root of the hierarchy is '&lt;code&gt;T&lt;/code&gt;' (translate), while the leaf-most child would be '&lt;code&gt;S&lt;/code&gt;' (scale).  This is why the translation of a node effects where it is rotated and scaled, the rotation of a node effects the orientation of scale but has no effect on translation, and the scale of a node has no effect over rotation or translation.&lt;br&gt;&lt;blockquote&gt;It's important to note that Maya internally doesn't store its animation data as matrices.  It stores them on nodes, as keyframe data (scalar values), expression data, dynamic sim, etc.  The matrix is simply a state value that can be queried based on the end result of the incoming anim data for a given transform.&lt;br&gt;&lt;/blockquote&gt;&lt;hr&gt;Matrices are &lt;em&gt;multiplied&lt;/em&gt; together to get new matrices.  For example, if you wanted to assign the position of objectC as the position of objectA + objectB:&lt;br&gt;&lt;pre&gt;matrixC = matrixB * matrixA
&lt;/pre&gt;So when you think of 'adding' values, convert that to 'multiplying' matrices.&lt;br&gt;But what if you want to 'subtract' values?  For example, you want the position of objectC to be the difference between objectA and objectB?  In this case you add (multiply) by the &lt;em&gt;inverseMatrix&lt;/em&gt;.&lt;br&gt;&lt;pre&gt;matrixC = matrixB * inverseMatrixA
&lt;/pre&gt;&lt;hr&gt;&lt;code&gt;dagNode&lt;/code&gt; node's matrix related attrs (all of these are available through any &lt;code&gt;transform&lt;/code&gt; based node):&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;u&gt;Local&lt;/u&gt; matrix data, relative to the nodes &lt;em&gt;parent&lt;/em&gt;:&lt;ul&gt;&lt;li&gt;&lt;code&gt;.matrix&lt;/code&gt; : Local transformation matrix for the dagNode. &lt;/li&gt;&lt;li&gt;&lt;code&gt;.inverseMatrix&lt;/code&gt;  :  Inverse of matrix attribute.  Multiplying by this value will place it at its parent.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Matrix data for the nodes &lt;u&gt;&lt;em&gt;parent&lt;/em&gt;&lt;/u&gt;:&lt;ul&gt;&lt;li&gt;&lt;code&gt;.parentMatrix&lt;/code&gt; : The parentMatrix instanced attribute represents the world-space transformation matrix for the parents of this dagNode. If the dagNode is a transform node and its inheritTransform attribute is false, then the parentMatrix is identity. &lt;/li&gt;&lt;li&gt;&lt;code&gt;.parentInverseMatrix&lt;/code&gt; : Inverse of parentMatrix instanced attribute.  Multiply the parent by this value to return it to origin.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Matrix data relative to the &lt;u&gt;&lt;em&gt;world&lt;/em&gt;&lt;/u&gt;:&lt;ul&gt;&lt;li&gt;&lt;code&gt;.worldMatrix&lt;/code&gt; :  The worldMatrix instanced attribute is the 4x4 transformation matrix that transforms the object to world-space. There is a world-space matrix for each unique path to the object. Eg. 'ball.worldMatrix[0]' identifies the world-space transformation matrix for the first instance of the object 'ball'. Each world-space transformation matrix is the result of post multiplying the 'matrix' attribute by corresponding 'parentMatrix' instanced attribute (i.e. worldMatrix[i] == matrix x parentMatrix[i]). Thus, the worldMatrix is the concatenation of the 'matrix' attribute of all the dagNodes along the path from the node up to the root of the dag hierarchy.&lt;ul&gt;&lt;li&gt;Basically:  &lt;code&gt;dagNode.worldMatrix = dagNode.matrix * dagNode.parentMatrix&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;.worldInverseMatrix&lt;/code&gt; : Inverse of worldMatrix instanced attribute.  Multiplying by this will place it at the world origin.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;transform&lt;/code&gt; node's matrix related attrs:&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;.xformMatrix&lt;/code&gt; :  Local transformation matrix. From the docs:  &quot;Contains the same information as the matrix attribute on dagNode but it is stored in a format that can be interpolated easily.&quot;.  Personally, I'm not sure what makes it more easy to interpolate.&lt;/li&gt;&lt;/ul&gt;It should be noted that on all these attrs you &lt;em&gt;can&lt;/em&gt; connect to or query their &lt;em&gt;outputs&lt;/em&gt;, but they &lt;em&gt;don't&lt;/em&gt; allow for input connections or modifications via &lt;code&gt;setAttr&lt;/code&gt;.&lt;br&gt;&lt;hr&gt;Notes on getting Matrix attr data:&lt;br&gt;&lt;blockquote&gt;Some attributes represent transformation matrices. Although these attributes are represented internally as 4x4 matrices, unfortunately, matrix attributes are not returned as MEL 4x4 matrix types. Instead, they are returned as an array of floats where the elements of the matrix are listed in row major order. For instance, &quot;matrix $m[4][4] = `getAttr ball.worldMatrix`;&quot; will not work. To obtain the value of a matrix attribute, you need something like &quot;float $m[16] = `getAttr ball.worldMatrix`;&quot;. &lt;br&gt;&lt;/blockquote&gt;These float arrays (for a 4x4 matrix) are indexed like this:&lt;br&gt;&lt;table class=&quot;twtable&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;5&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;6&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;7&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;evenRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;8&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;9&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;10&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;11&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;oddRow&quot;&gt;&lt;td align=&quot;center&quot;&gt;12&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;13&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;14&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;15&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;hr&gt;&lt;code&gt;xform&lt;/code&gt; command:&lt;br&gt;&lt;ul&gt;&lt;li&gt;It should be noted that when querying matrix &lt;em&gt;translation&lt;/em&gt; values (index 12, 13, &amp;amp; 14) Maya always returns them as cm values.  If your working units are something else, you'll need to convert them!&lt;/li&gt;&lt;li&gt;If the node ever had 'freeze transformations' (&lt;code&gt;makeIdentity&lt;/code&gt;) applied to it, it will throw off the worldspace matrix position.&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;// Copy the worldspace matrix from pCube1 to pCube2:
// Using 'getAttr' on the .worldspaceMatrix, it calculates all
// scale operations based on all parental nodes as well.
// This can cause the target .shear attrs to be effected.
float $m[16] = `getAttr pCube1.worldMatrix`;
xform  -matrix $m[0] $m[1] $m[2] $m[3] 
		$m[4] $m[5] $m[6] $m[7] 
		$m[8] $m[9] $m[10] $m[11] 
		$m[12]$m[13] $m[14] $m[15] pCube2;

// you could optionally use this to get the matrix, via xform:
float $m[16] = `xform -query -matrix pCube1`;
// Which queries the .xformMatrix attr (see above), but this only 
// tracks the local scale values, not any extra parental scale
// values:  .shear attrs are not effected.
&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Sets/returns the composite transformation matrix. *Note* the matrix is represented by 16 double arguments that are specified in row order. &lt;/li&gt;&lt;/ul&gt;&lt;hr&gt;&lt;strong&gt;Matrix Nodes&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;decomposeMatrix&lt;/code&gt; (standard Maya plugin):&lt;ul&gt;&lt;li&gt;See Mel Wiki notes &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#How can I have a node return the worldspace position of my object, offset in time?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#How can I have a node return the worldspace position of my object, offset in time?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;How can I have a node return the worldspace position of my object, offset in time?&quot;&gt;here&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;addMatrix&lt;/code&gt;&lt;ul&gt;&lt;li&gt;Add a list of matrices together.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;fourByFourMatrix&lt;/code&gt;&lt;ul&gt;&lt;li&gt;This node outputs a 4x4 matrix based on 16 input values. This output matrix attribute can be connected to any attribute that is type &quot;matrix&quot;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;holdMatrix&lt;/code&gt;&lt;ul&gt;&lt;li&gt;Cache a matrix.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;multMatrix&lt;/code&gt;&lt;ul&gt;&lt;li&gt;Multiply a list of matrices together.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;passMatrix&lt;/code&gt;&lt;ul&gt;&lt;li&gt;Multiply a matrix by a constant without caching anything&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;pointMatrixMult&lt;/code&gt;&lt;ul&gt;&lt;li&gt;The dependency graph node to multiply a point by a matrix.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;wtAddMatrix&lt;/code&gt;&lt;ul&gt;&lt;li&gt;Add a weighted list of matrices together.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/Nodes/dagPose.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/Nodes/dagPose.html&quot; target=&quot;_blank&quot;&gt;dagPose&lt;/a&gt;&lt;ul&gt;&lt;li&gt;Created via the &lt;code&gt;dagPose&lt;/code&gt; command, used to store matrix data as a pose.  Most often used during skinning operations.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Matrix Commands&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2010help/CommandsPython/dagPose.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2010help/CommandsPython/dagPose.html&quot; target=&quot;_blank&quot;&gt;dagPose&lt;/a&gt;&lt;ul&gt;&lt;li&gt;Used to store and query matrix data in a &lt;code&gt;dagPose&lt;/code&gt; node.  Most commonly used during skinning operations.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;pointMatrixMult&lt;/code&gt;   (mel script)&lt;ul&gt;&lt;li&gt;This script returns the multiplication of a point and a matrix as an array of 3 doubles.  It is a wrapper around the &lt;code&gt;pointMatrixMult&lt;/code&gt; node, which the script actually creates, modifies, gathers the return value, and then deletes.&lt;/li&gt;&lt;li&gt;Located: &lt;code&gt;C:/Program Files/Autodesk/Maya&amp;lt;version&amp;gt;&amp;gt;/scripts/others/pointMatrixMult.mel&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;For &lt;em&gt;Python&lt;/em&gt; related matrix commands see:  &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Working with matrices with Python&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Working with matrices with Python&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Working with matrices with Python&quot;&gt;Working with matrices with Python&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr&gt;Syntax for authoring an identity transformation matrix:&lt;br&gt;&lt;pre&gt;matrix $m[4][4] = &amp;lt;&amp;lt;1, 0, 0, 0;
                    0, 1, 0, 0;
                    0, 0, 1, 0;
                    0, 0, 0, 1&amp;gt;&amp;gt;;
&lt;/pre&gt;&lt;hr&gt;Printing 4x4 matrix data:&lt;br&gt;&lt;pre&gt;float $goo[] = `getAttr myNode.worldMatrix`;

for($i=1;$i&amp;lt;size($goo)+1;$i++)
	{
	print ($goo[$i-1] + &quot; &quot;);
	if($i%4==0)
		print(&quot;\n&quot;);
	}
1 0 0 0 
0 1 0 0 
0 0 1 0 
0 0 0 1
&lt;/pre&gt;Using &lt;code&gt;getAttr&lt;/code&gt; on a matrix attr will return back a float array.  But when you want to do matrix math, you have to use the &lt;code&gt;matrix&lt;/code&gt; variable type.  These funtions will convert back and forth between the two:&lt;br&gt;&lt;pre&gt;global proc matrix floatArrayToMatrix(float $m[]){
	if(size($m) != 16)
		error(&quot;Please pass in a float array with exactly 16 elements&quot;);
	matrix $mat[4][4] = &amp;lt;&amp;lt;$m[0], $m[1], $m[2], $m[3];
					$m[4], $m[5], $m[6], $m[7];
					$m[8], $m[9], $m[10], $m[11];  
					$m[12], $m[13], $m[14], $m[15]&amp;gt;&amp;gt;; 
	return $mat;
	}
&lt;/pre&gt;&lt;pre&gt;global proc float[] matrixToFloatArray(matrix $m){
	float $return[] = {};
	for($row=0; $row&amp;lt;4; $row++){
		for($column=0; $column&amp;lt;4; $column++)
			$return[size($return)] = $m[$row][$column];
		}
	return $return;
	}
&lt;/pre&gt;&lt;hr&gt;Match the worldspaceMatrix of objectB to objectA:&lt;br&gt;&lt;pre&gt;string $source = &quot;pCube1&quot;;
string $destination = &quot;pCube2&quot;;

float $m[16] = `getAttr ($source+&quot;.worldMatrix&quot;)`;
xform -worldSpace  -matrix $m[0] $m[1] $m[2] $m[3] 
		$m[4] $m[5] $m[6] $m[7] 
		$m[8] $m[9] $m[10] $m[11] 
		$m[12]$m[13] $m[14] $m[15] $destination;
&lt;/pre&gt;This will work, no matter what any parental groups have done to the nodes.  Sweet.&lt;br&gt;&lt;hr&gt;Another snippet:&lt;br&gt;Have a destination node match the position of a hierarchy of source nodes.  In this scene, &quot;pCube1&quot; is parented to &quot;group1&quot;.  The below code will match the worldspace matrix of &quot;pCube2&quot; to the postion of &quot;pCube1&quot; by multiplying the local matrices of &quot;group1&quot; and &quot;pCube1&quot; together.&lt;br&gt;&lt;pre&gt;string $sourceParent = &quot;group1&quot;;
string $sourceChild= &quot;pCube1&quot;;
string $destination = &quot;pCube2&quot;;

// query the local matrix of the parent and child
matrix $matrixSP[4][4] = floatArrayToMatrix(`getAttr ($sourceParent+&quot;.matrix&quot;)`);
matrix $matrixSC[4][4] = floatArrayToMatrix(`getAttr ($sourceChild+&quot;.matrix&quot;)`);
// Generate our new  destination matrix, order is important!
matrix $dPos[4][4] = $matrixSC * $matrixSP;

float $m[16] = matrixToFloatArray($dPos);

xform -worldSpace  -matrix $m[0] $m[1] $m[2] $m[3] 
		$m[4] $m[5] $m[6] $m[7] 
		$m[8] $m[9] $m[10] $m[11] 
		$m[12]$m[13] $m[14] $m[15] $destination;
// it worked.  Trust me.
&lt;/pre&gt;</description>
<category>TRANSFORMATION</category>
<category>VARIABLES</category>
<category>MATH</category>
<category>matrix</category>
<category>inverseMatrix</category>
<category>worldMatrix</category>
<category>worldInverseMatrix</category>
<category>parentMatrix</category>
<category>parentInverseMatrix</category>
<category>xformMatrix</category>
<category>xform</category>
<category>decomposeMatrix</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BMatrix%20info%5D%5D</link>
<pubDate>Fri, 20 Jan 2012 19:40:00 GMT</pubDate>
</item>
<item>
<title>Copyright Information</title>
<description>All information on this wiki is under the Apache Licence, v 2.0:&lt;br&gt;&lt;pre&gt;Copyright 2012 Eric Pavey

Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
&lt;/pre&gt;To understand how this licence works see &lt;a class=&quot;externalLink&quot; href=&quot;http://developer.kde.org/documentation/licensing/licenses_summary.html&quot; title=&quot;External link to http://developer.kde.org/documentation/licensing/licenses_summary.html&quot; target=&quot;_blank&quot;&gt;this overview&lt;/a&gt;.&lt;br&gt;But it pretty much means you can use the information on this wiki however you want, but I always appreciate credit where applicable.</description>
<category>copyright</category>
<category>apache</category>
<category>licence</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BCopyright%20Information%5D%5D</link>
<pubDate>Fri, 20 Jan 2012 19:31:00 GMT</pubDate>
</item>
<item>
<title>Welcome</title>
<description>&lt;div class=&quot;gradient&quot; style=&quot;position: relative; overflow-x: hidden; overflow-y: hidden; z-index: 0; &quot;&gt;&lt;div style=&quot;position: absolute; left: 0%; top: 0px; width: 101%; height: 100%; z-index: -1; background-color: rgb(255, 255, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 2%; top: 0px; width: 99%; height: 100%; z-index: -1; background-color: rgb(253, 253, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 4%; top: 0px; width: 97%; height: 100%; z-index: -1; background-color: rgb(252, 252, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 6%; top: 0px; width: 95%; height: 100%; z-index: -1; background-color: rgb(250, 250, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 8%; top: 0px; width: 93%; height: 100%; z-index: -1; background-color: rgb(249, 249, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 10%; top: 0px; width: 91%; height: 100%; z-index: -1; background-color: rgb(248, 248, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 12%; top: 0px; width: 89%; height: 100%; z-index: -1; background-color: rgb(246, 246, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 14%; top: 0px; width: 87%; height: 100%; z-index: -1; background-color: rgb(245, 245, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 16%; top: 0px; width: 85%; height: 100%; z-index: -1; background-color: rgb(244, 244, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 18%; top: 0px; width: 83%; height: 100%; z-index: -1; background-color: rgb(242, 242, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 20%; top: 0px; width: 81%; height: 100%; z-index: -1; background-color: rgb(241, 241, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 22%; top: 0px; width: 79%; height: 100%; z-index: -1; background-color: rgb(240, 240, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 24%; top: 0px; width: 77%; height: 100%; z-index: -1; background-color: rgb(238, 238, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 26%; top: 0px; width: 75%; height: 100%; z-index: -1; background-color: rgb(237, 237, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 28%; top: 0px; width: 73%; height: 100%; z-index: -1; background-color: rgb(235, 235, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 30%; top: 0px; width: 71%; height: 100%; z-index: -1; background-color: rgb(234, 234, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 32%; top: 0px; width: 69%; height: 100%; z-index: -1; background-color: rgb(233, 233, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 34%; top: 0px; width: 67%; height: 100%; z-index: -1; background-color: rgb(231, 231, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 36%; top: 0px; width: 65%; height: 100%; z-index: -1; background-color: rgb(230, 230, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 38%; top: 0px; width: 63%; height: 100%; z-index: -1; background-color: rgb(229, 229, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 40%; top: 0px; width: 61%; height: 100%; z-index: -1; background-color: rgb(227, 227, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 42%; top: 0px; width: 59%; height: 100%; z-index: -1; background-color: rgb(226, 226, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 44%; top: 0px; width: 57%; height: 100%; z-index: -1; background-color: rgb(225, 225, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 46%; top: 0px; width: 55%; height: 100%; z-index: -1; background-color: rgb(223, 223, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 48%; top: 0px; width: 53%; height: 100%; z-index: -1; background-color: rgb(222, 222, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 50%; top: 0px; width: 51%; height: 100%; z-index: -1; background-color: rgb(221, 221, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 52%; top: 0px; width: 49%; height: 100%; z-index: -1; background-color: rgb(217, 217, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 54%; top: 0px; width: 47%; height: 100%; z-index: -1; background-color: rgb(214, 214, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 56%; top: 0px; width: 45%; height: 100%; z-index: -1; background-color: rgb(210, 210, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 58%; top: 0px; width: 43%; height: 100%; z-index: -1; background-color: rgb(207, 207, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 60%; top: 0px; width: 41%; height: 100%; z-index: -1; background-color: rgb(204, 204, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 62%; top: 0px; width: 39%; height: 100%; z-index: -1; background-color: rgb(200, 200, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 64%; top: 0px; width: 37%; height: 100%; z-index: -1; background-color: rgb(197, 197, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 66%; top: 0px; width: 35%; height: 100%; z-index: -1; background-color: rgb(193, 193, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 68%; top: 0px; width: 33%; height: 100%; z-index: -1; background-color: rgb(190, 190, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 70%; top: 0px; width: 31%; height: 100%; z-index: -1; background-color: rgb(187, 187, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 72%; top: 0px; width: 29%; height: 100%; z-index: -1; background-color: rgb(183, 183, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 74%; top: 0px; width: 27%; height: 100%; z-index: -1; background-color: rgb(180, 180, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 76%; top: 0px; width: 25%; height: 100%; z-index: -1; background-color: rgb(176, 176, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 78%; top: 0px; width: 23%; height: 100%; z-index: -1; background-color: rgb(173, 173, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 80%; top: 0px; width: 21%; height: 100%; z-index: -1; background-color: rgb(170, 170, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 82%; top: 0px; width: 19%; height: 100%; z-index: -1; background-color: rgb(166, 166, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 84%; top: 0px; width: 17%; height: 100%; z-index: -1; background-color: rgb(163, 163, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 86%; top: 0px; width: 15%; height: 100%; z-index: -1; background-color: rgb(159, 159, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 88%; top: 0px; width: 13%; height: 100%; z-index: -1; background-color: rgb(156, 156, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 90%; top: 0px; width: 11%; height: 100%; z-index: -1; background-color: rgb(153, 153, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 92%; top: 0px; width: 9%; height: 100%; z-index: -1; background-color: rgb(149, 149, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 94%; top: 0px; width: 7%; height: 100%; z-index: -1; background-color: rgb(146, 146, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 96%; top: 0px; width: 5%; height: 100%; z-index: -1; background-color: rgb(142, 142, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 98%; top: 0px; width: 3%; height: 100%; z-index: -1; background-color: rgb(139, 139, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 100%; top: 0px; width: 1%; height: 100%; z-index: -1; background-color: rgb(136, 136, 255); &quot;&gt;&lt;/div&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#About mel wiki&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#About mel wiki&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;About mel wiki&quot;&gt;About mel wiki&lt;/a&gt; (go here first)&lt;br&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Instructions For Use&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Instructions For Use&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Instructions For Use&quot;&gt;Instructions For Use&lt;/a&gt; (go here second)&lt;br&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#History&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#History&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;History&quot;&gt;Check out the latest updates&lt;/a&gt; (go here third.  &lt;em&gt;Hit &lt;strong&gt;F5&lt;/strong&gt; to refresh your cache to see the latest stuff)&lt;/em&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gradient&quot; style=&quot;position: relative; overflow-x: hidden; overflow-y: hidden; z-index: 0; &quot;&gt;&lt;div style=&quot;position: absolute; left: 0%; top: 0px; width: 101%; height: 100%; z-index: -1; background-color: rgb(221, 221, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 2%; top: 0px; width: 99%; height: 100%; z-index: -1; background-color: rgb(219, 219, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 4%; top: 0px; width: 97%; height: 100%; z-index: -1; background-color: rgb(217, 217, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 6%; top: 0px; width: 95%; height: 100%; z-index: -1; background-color: rgb(215, 215, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 8%; top: 0px; width: 93%; height: 100%; z-index: -1; background-color: rgb(214, 214, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 10%; top: 0px; width: 91%; height: 100%; z-index: -1; background-color: rgb(212, 212, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 12%; top: 0px; width: 89%; height: 100%; z-index: -1; background-color: rgb(210, 210, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 14%; top: 0px; width: 87%; height: 100%; z-index: -1; background-color: rgb(209, 209, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 16%; top: 0px; width: 85%; height: 100%; z-index: -1; background-color: rgb(207, 207, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 18%; top: 0px; width: 83%; height: 100%; z-index: -1; background-color: rgb(205, 205, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 20%; top: 0px; width: 81%; height: 100%; z-index: -1; background-color: rgb(204, 204, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 22%; top: 0px; width: 79%; height: 100%; z-index: -1; background-color: rgb(202, 202, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 24%; top: 0px; width: 77%; height: 100%; z-index: -1; background-color: rgb(200, 200, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 26%; top: 0px; width: 75%; height: 100%; z-index: -1; background-color: rgb(198, 198, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 28%; top: 0px; width: 73%; height: 100%; z-index: -1; background-color: rgb(197, 197, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 30%; top: 0px; width: 71%; height: 100%; z-index: -1; background-color: rgb(195, 195, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 32%; top: 0px; width: 69%; height: 100%; z-index: -1; background-color: rgb(193, 193, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 34%; top: 0px; width: 67%; height: 100%; z-index: -1; background-color: rgb(192, 192, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 36%; top: 0px; width: 65%; height: 100%; z-index: -1; background-color: rgb(190, 190, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 38%; top: 0px; width: 63%; height: 100%; z-index: -1; background-color: rgb(188, 188, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 40%; top: 0px; width: 61%; height: 100%; z-index: -1; background-color: rgb(187, 187, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 42%; top: 0px; width: 59%; height: 100%; z-index: -1; background-color: rgb(185, 185, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 44%; top: 0px; width: 57%; height: 100%; z-index: -1; background-color: rgb(183, 183, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 46%; top: 0px; width: 55%; height: 100%; z-index: -1; background-color: rgb(181, 181, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 48%; top: 0px; width: 53%; height: 100%; z-index: -1; background-color: rgb(180, 180, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 50%; top: 0px; width: 51%; height: 100%; z-index: -1; background-color: rgb(178, 178, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 52%; top: 0px; width: 49%; height: 100%; z-index: -1; background-color: rgb(176, 176, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 54%; top: 0px; width: 47%; height: 100%; z-index: -1; background-color: rgb(175, 175, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 56%; top: 0px; width: 45%; height: 100%; z-index: -1; background-color: rgb(173, 173, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 58%; top: 0px; width: 43%; height: 100%; z-index: -1; background-color: rgb(171, 171, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 60%; top: 0px; width: 41%; height: 100%; z-index: -1; background-color: rgb(170, 170, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 62%; top: 0px; width: 39%; height: 100%; z-index: -1; background-color: rgb(168, 168, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 64%; top: 0px; width: 37%; height: 100%; z-index: -1; background-color: rgb(166, 166, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 66%; top: 0px; width: 35%; height: 100%; z-index: -1; background-color: rgb(164, 164, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 68%; top: 0px; width: 33%; height: 100%; z-index: -1; background-color: rgb(163, 163, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 70%; top: 0px; width: 31%; height: 100%; z-index: -1; background-color: rgb(161, 161, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 72%; top: 0px; width: 29%; height: 100%; z-index: -1; background-color: rgb(159, 159, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 74%; top: 0px; width: 27%; height: 100%; z-index: -1; background-color: rgb(158, 158, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 76%; top: 0px; width: 25%; height: 100%; z-index: -1; background-color: rgb(156, 156, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 78%; top: 0px; width: 23%; height: 100%; z-index: -1; background-color: rgb(154, 154, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 80%; top: 0px; width: 21%; height: 100%; z-index: -1; background-color: rgb(153, 153, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 82%; top: 0px; width: 19%; height: 100%; z-index: -1; background-color: rgb(151, 151, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 84%; top: 0px; width: 17%; height: 100%; z-index: -1; background-color: rgb(149, 149, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 86%; top: 0px; width: 15%; height: 100%; z-index: -1; background-color: rgb(147, 147, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 88%; top: 0px; width: 13%; height: 100%; z-index: -1; background-color: rgb(146, 146, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 90%; top: 0px; width: 11%; height: 100%; z-index: -1; background-color: rgb(144, 144, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 92%; top: 0px; width: 9%; height: 100%; z-index: -1; background-color: rgb(142, 142, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 94%; top: 0px; width: 7%; height: 100%; z-index: -1; background-color: rgb(141, 141, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 96%; top: 0px; width: 5%; height: 100%; z-index: -1; background-color: rgb(139, 139, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 98%; top: 0px; width: 3%; height: 100%; z-index: -1; background-color: rgb(137, 137, 255); &quot;&gt;&lt;/div&gt;&lt;div style=&quot;position: absolute; left: 100%; top: 0px; width: 1%; height: 100%; z-index: -1; background-color: rgb(136, 136, 255); &quot;&gt;&lt;/div&gt;&lt;strong&gt;Browse \ Search using:&lt;/strong&gt;&lt;br&gt;&lt;hr&gt;&lt;code&gt;&amp;lt;---&lt;/code&gt; Major &lt;strong&gt;&lt;em&gt;Categories&lt;/em&gt;&lt;/strong&gt; (or 'All Subjects') in the Left column&lt;br&gt;Key-word &lt;strong&gt;&lt;em&gt;Tags&lt;/em&gt;&lt;/strong&gt; in the Right column (press Ctrl+f to open your browser's search, makes it very easy) &lt;code&gt;---&amp;gt;&lt;/code&gt;&lt;br&gt;&lt;hr&gt;&lt;/div&gt;&lt;br&gt;&lt;sup&gt;Running &lt;a class=&quot;externalLink&quot; href=&quot;http://www.tiddlywiki.com&quot; title=&quot;External link to http://www.tiddlywiki.com&quot; target=&quot;_blank&quot;&gt;tiddlywiki&lt;/a&gt; v&lt;span&gt;2.4.0&lt;/span&gt;&lt;/sup&gt;&lt;br&gt;&lt;sup&gt;If you find this wiki useful, let the &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#WarpCat&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#WarpCat&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;WarpCat&quot;&gt;author&lt;/a&gt; know :-)&lt;/sup&gt;&lt;br&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Copyright Information&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Copyright Information&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Copyright Information&quot;&gt;Copyright Information&lt;/a&gt;&lt;/div&gt;</description>
<category>wiki</category>
<link>http://mayamel.tiddlyspot.com#Welcome</link>
<pubDate>Thu, 19 Jan 2012 19:32:00 GMT</pubDate>
</item>
<item>
<title>SideBarOptions</title>
<description>&lt;a href=&quot;javascript:;&quot; title=&quot;Close all displayed tiddlers (except any that are being edited)&quot; class=&quot;button&quot;&gt;close all&lt;/a&gt;&lt;a href=&quot;javascript:;&quot; title=&quot;Link to an URL that retrieves all the currently displayed tiddlers&quot; class=&quot;button&quot;&gt;permaview&lt;/a&gt;&lt;a href=&quot;javascript:;&quot; title=&quot;Create a new tiddler&quot; class=&quot;button&quot; accesskey=&quot;N&quot; newtitle=&quot;New Tiddler&quot; isjournal=&quot;false&quot; newfocus=&quot;title&quot; newtemplate=&quot;2&quot;&gt;new tiddler&lt;/a&gt;&lt;a href=&quot;javascript:;&quot; title=&quot;Save all tiddlers to create a new TiddlyWiki&quot; class=&quot;button&quot; accesskey=&quot;S&quot;&gt;save changes&lt;/a&gt;&lt;span refresh=&quot;content&quot; tiddler=&quot;TspotSidebar&quot;&gt;&lt;a href=&quot;javascript:;&quot; title=&quot;Save and Upload this TiddlyWiki in http://mayamel.tiddlyspot.com/index.html&quot; class=&quot;button&quot;&gt;save to web&lt;/a&gt;&lt;span&gt;&lt;a href=&quot;http://mayamel.tiddlyspot.com/download&quot; class=&quot;button&quot;&gt;download&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;javascript:;&quot; title=&quot;Change TiddlyWiki advanced options&quot; class=&quot;button&quot;&gt;options &#187;&lt;/a&gt;&lt;div class=&quot;sliderPanel&quot; cookie=&quot;chkSliderOptionsPanel&quot; style=&quot;display: none; &quot; refresh=&quot;content&quot; tiddler=&quot;OptionsPanel&quot;&gt;&lt;span refresh=&quot;content&quot; tiddler=&quot;TspotOptions&quot;&gt;tiddlyspot password:&lt;br&gt;&lt;input type=&quot;password&quot; option=&quot;pasUploadPassword&quot; class=&quot;pasOptionInput&quot; title=&quot;Upload Password&quot;&gt;&lt;input type=&quot;checkbox&quot; option=&quot;chkpasUploadPassword&quot; class=&quot;chkOptionInput&quot;&gt;Save this password on this computer&lt;br&gt;&lt;/span&gt;These &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'InterfaceOptions' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;InterfaceOptions&quot;&gt;InterfaceOptions&lt;/a&gt; for customising &lt;a href=&quot;javascript:;&quot; title=&quot;TiddlyWiki - YourName, Fri Apr 27 2007 14:33:00 GMT-0700 (Pacific Daylight Time)&quot; class=&quot;tiddlyLink tiddlyLinkExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;TiddlyWiki&quot;&gt;TiddlyWiki&lt;/a&gt; are saved in your browser&lt;br&gt;&lt;br&gt;Your username for signing your edits. Write it as a &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'WikiWord' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;WikiWord&quot;&gt;WikiWord&lt;/a&gt; (eg &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'JoeBloggs' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;JoeBloggs&quot;&gt;JoeBloggs&lt;/a&gt;)&lt;br&gt;&lt;br&gt;&lt;input option=&quot;txtUserName&quot; class=&quot;txtOptionInput&quot; title=&quot;Username for signing your edits&quot;&gt;&lt;br&gt;&lt;input type=&quot;checkbox&quot; option=&quot;chkSaveBackups&quot; class=&quot;chkOptionInput&quot; title=&quot;Keep backup file when saving changes&quot;&gt; &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'SaveBackups' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;SaveBackups&quot;&gt;SaveBackups&lt;/a&gt;&lt;br&gt;&lt;input type=&quot;checkbox&quot; option=&quot;chkAutoSave&quot; class=&quot;chkOptionInput&quot; title=&quot;Automatically save changes&quot;&gt; &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'AutoSave' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;AutoSave&quot;&gt;AutoSave&lt;/a&gt;&lt;br&gt;&lt;input type=&quot;checkbox&quot; option=&quot;chkRegExpSearch&quot; class=&quot;chkOptionInput&quot; title=&quot;Enable regular expressions for searches&quot;&gt; &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'RegExpSearch' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;RegExpSearch&quot;&gt;RegExpSearch&lt;/a&gt;&lt;br&gt;&lt;input type=&quot;checkbox&quot; option=&quot;chkCaseSensitiveSearch&quot; class=&quot;chkOptionInput&quot; title=&quot;Case-sensitive searching&quot;&gt; &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'CaseSensitiveSearch' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;CaseSensitiveSearch&quot;&gt;CaseSensitiveSearch&lt;/a&gt;&lt;br&gt;&lt;input type=&quot;checkbox&quot; option=&quot;chkAnimate&quot; class=&quot;chkOptionInput&quot; title=&quot;Enable animations&quot;&gt; &lt;a href=&quot;javascript:;&quot; title=&quot;The tiddler 'EnableAnimations' doesn't yet exist&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting&quot; refresh=&quot;link&quot; tiddlylink=&quot;EnableAnimations&quot;&gt;EnableAnimations&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;hr&gt;Also see &lt;a href=&quot;javascript:;&quot; title=&quot;This shadow tiddler provides access to several advanced options&quot; class=&quot;tiddlyLink tiddlyLinkNonExisting shadow&quot; refresh=&quot;link&quot; tiddlylink=&quot;AdvancedOptions&quot;&gt;AdvancedOptions&lt;/a&gt;&lt;/div&gt;</description>
<link>http://mayamel.tiddlyspot.com#SideBarOptions</link>
<pubDate>Wed, 18 Jan 2012 21:52:00 GMT</pubDate>
</item>
<item>
<title>API: Find all child attributes under a compound attribute</title>
<description>After much trial and error, I've whipped up the below code to query all the child attributes under a given compound attribute, and print their names \ types.&lt;br&gt;&lt;br&gt;This was complicated by a variety of factors:&lt;br&gt;&lt;ol&gt;&lt;li&gt;It took me a while to realize that compound attrs can also be array.  I hadn't quite grasped the differences between them:  Compound is a type, like float or string.  Array is a property of an attribute, like keyable, locked, hidden, etc.&lt;/li&gt;&lt;li&gt;I was able to query compound children, but I wasn't understanding how to query an array of compound attrs children.  This was further messed up by the fact the &lt;code&gt;MPlug.getExistingArrayAttributeIndices()&lt;/code&gt; method will return negative index values, which cause all sorts of problems.  Not sure why it does that, but skipping over them solves the problem.&lt;/li&gt;&lt;li&gt;Understanding the differences between logical and physical index arrays.  In a nutshell, you want to use logical most of the time...&lt;/li&gt;&lt;/ol&gt;For more info on those topics, please see this subject: &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#API: Attribute Creation &amp;amp; Usage&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#API: Attribute Creation &amp;amp; Usage&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;API: Attribute Creation &amp;amp; Usage&quot;&gt;API: Attribute Creation &amp;amp; Usage&lt;/a&gt;&lt;br&gt;&lt;br&gt;In our example we use a polygonal plane with four verts, called &lt;code&gt;pPlane1&lt;/code&gt; (but make reference to its shape node, &lt;code&gt;pPlaneShape1&lt;/code&gt;).&lt;br&gt;&lt;pre&gt;import maya.OpenMaya as om

# The node name, and attribute name, to query:
node = &quot;pPlaneShape1&quot; 
attr = &quot;uvSet&quot;

# Get an MObject by string name:
selList = om.MSelectionList()
selList.add(node)
mObject = om.MObject()
selList.getDependNode(0, mObject)

# Attach a function set to the shape and get the plug to start querying:
mFnDependencyNode = om.MFnDependencyNode(mObject)
rootPlug = mFnDependencyNode.findPlug(attr)

# Get all child plugs for our root, presuming it is a compound attr, since they're
# the only type that have 'children':
plugs = [rootPlug]
for plug in plugs:
    # If the type is compound, and it is also set to array:
    if plug.isCompound() and plug.isArray():
        # Find the logical indices of the array:
        logicalIndices = om.MIntArray()
        plug.getExistingArrayAttributeIndices(logicalIndices)
        for i in range(logicalIndices.length()):
            # getExistingArrayAttributeIndices() can return negative index values
            # for some reason, so we need to be sure to *not* deal with those,
            # since obviously bad things would happen....
            if logicalIndices[i] &amp;gt;= 0:
                # Now find the element plug of that index, which is a compound
                # type attribute:
                elementPlug = plug.elementByLogicalIndex(logicalIndices[i])
                # And query the children of that compound attr:
                for j in range(elementPlug.numChildren()):
                    plugs.append(elementPlug.child(j))
    # If it is compound, but not array:
    elif plug.isCompound():
        # Just get the children of that compound attr:
        for i in range(plug.numChildren()):
            plugs.append(plug.child(i))

for plug in plugs:
    attrObj = plug.attribute() # MObject
    print plug.name(), attrObj.apiTypeStr()
&lt;/pre&gt;Gives us this result:&lt;br&gt;&lt;pre&gt;pPlaneShape1.uvSet kCompoundAttribute
pPlaneShape1.uvSet[0].uvSetName kTypedAttribute
pPlaneShape1.uvSet[0].uvSetPoints kAttribute2Float
pPlaneShape1.uvSet[0].uvSetTweakLocation kTypedAttribute
pPlaneShape1.uvSet[0].uvSetPoints[0].uvSetPointsU kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[0].uvSetPointsV kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[1].uvSetPointsU kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[1].uvSetPointsV kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[2].uvSetPointsU kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[2].uvSetPointsV kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[3].uvSetPointsU kNumericAttribute
pPlaneShape1.uvSet[0].uvSetPoints[3].uvSetPointsV kNumericAttribute
&lt;/pre&gt;It should be noted that not all attrs are so verbose.  For example, if you set this and re-run it:&lt;br&gt;&lt;pre&gt;attr = &quot;pnts&quot;
&lt;/pre&gt;All it prints is:&lt;br&gt;&lt;pre&gt;pPlaneShape1.pnts kAttribute3Float
&lt;/pre&gt;Even though we know there is more than one point in the plane.  If you grab all the verts and component level, manually move them with the translate manip, and re-run it, it prints:&lt;br&gt;&lt;pre&gt;pPlaneShape1.pnts kAttribute3Float
pPlaneShape1.pnts[0].pntx kFloatLinearAttribute
pPlaneShape1.pnts[0].pnty kFloatLinearAttribute
pPlaneShape1.pnts[0].pntz kFloatLinearAttribute
pPlaneShape1.pnts[1].pntx kFloatLinearAttribute
pPlaneShape1.pnts[1].pnty kFloatLinearAttribute
pPlaneShape1.pnts[1].pntz kFloatLinearAttribute
pPlaneShape1.pnts[2].pntx kFloatLinearAttribute
pPlaneShape1.pnts[2].pnty kFloatLinearAttribute
pPlaneShape1.pnts[2].pntz kFloatLinearAttribute
pPlaneShape1.pnts[3].pntx kFloatLinearAttribute
pPlaneShape1.pnts[3].pnty kFloatLinearAttribute
pPlaneShape1.pnts[3].pntz kFloatLinearAttribute
&lt;/pre&gt;Which tells me that in some cases, the plugs don't exist until some type of user interaction.  Something even crazier I've found:  If instead of grabbing all the verts by hand and deleting them, if I instead run the command:&lt;br&gt;&lt;pre&gt;delete -constructionHistory;
&lt;/pre&gt;On the mesh, the attrs will appear as well.  It must be triggering some kind of massive &quot;you are dirty&quot; flag on all the plugs so they suddenly show up.... or something....&lt;br&gt;&lt;br&gt; I have yet to find a more elegant solution for this :(&lt;br&gt;&lt;hr&gt;Also see:&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#API: Find all attributes &amp;amp; plugs on a node&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#API: Find all attributes &amp;amp; plugs on a node&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;API: Find all attributes &amp;amp; plugs on a node&quot;&gt;API: Find all attributes &amp;amp; plugs on a node&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#How can I get a list of all the child multi-attrs, of a given attr name?&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#How can I get a list of all the child multi-attrs, of a given attr name?&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;How can I get a list of all the child multi-attrs, of a given attr name?&quot;&gt;How can I get a list of all the child multi-attrs, of a given attr name?&lt;/a&gt; (using the command engine, rather than the API)&lt;/li&gt;&lt;/ul&gt;</description>
<category>API</category>
<category>ATTRIBUTES</category>
<category>child</category>
<category>array</category>
<category>element</category>
<category>compound</category>
<category>OpenMaya</category>
<category>OpenMaya.MFnDependencyNode</category>
<category>OpenMaya.MFnDependencyNode.findPlug</category>
<category>OpenMaya.MPlug</category>
<category>OpenMaya.MPlug.isCompound</category>
<category>OpenMaya.MPlug.isArray</category>
<category>OpenMaya.MPlug.getExistingArrayAttributeIndices</category>
<category>OpenMaya.MPlug.elementByLogicalIndex</category>
<category>OpenMaya.MPlug.numChildren</category>
<category>OpenMaya.MPlug.child</category>
<category>OpenMaya.MPlug.attribute</category>
<category>OpenMaya.MObject</category>
<category>OpenMaya.MObject.apiTypeStr</category>
<category>delete</category>
<category>construction history</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BAPI%3A%20Find%20all%20child%20attributes%20under%20a%20compound%20attribute%5D%5D</link>
<pubDate>Fri, 13 Jan 2012 01:07:00 GMT</pubDate>
</item>
<item>
<title>Control Photoshop from Maya</title>
<description>(This is all based on a Windows system)&lt;br&gt;First, you need to get some type of com object solution working in Python for Maya:&lt;br&gt;&lt;ul&gt;&lt;li&gt;See my notes here: &lt;a class=&quot;externalLink&quot; href=&quot;http://mayamel.tiddlyspot.com#Getting pywin32 working in Maya&quot; title=&quot;External link to http://mayamel.tiddlyspot.com#Getting pywin32 working in Maya&quot; target=&quot;_blank&quot; refresh=&quot;link&quot; tiddlylink=&quot;Getting pywin32 working in Maya&quot;&gt;Getting pywin32 working in Maya&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;Once you have that package (or something similar) up and running, you can start having Maya talk to Photoshop.  Here's a simple example:&lt;br&gt;&lt;pre&gt;# Presuming you have the package installed....
import win32com.client

app = win32com.client.Dispatch(&quot;Photoshop.Application&quot;) # Application
psdFile = 'c:/temp/myPrettyPic.psd'
document = app.Open(psdFile) # Document

# For each layer in the psd:
for layerSet in document.LayerSets: # LayerSet in LayerSets, which PS calls 'groups'
    print layerSet.Name
    layerSet.Resize(50, 50)
    layerSet.Translate(128,128)

# Some optional fun:
#document.ResizeImage(64, 64)
#document.Save()
&lt;/pre&gt;How about some docs?  The root for all related scripting docs for multiple versions of Photoshop is here:&lt;br&gt;&lt;a class=&quot;externalLink&quot; href=&quot;http://www.adobe.com/devnet/photoshop/scripting.html&quot; title=&quot;External link to http://www.adobe.com/devnet/photoshop/scripting.html&quot; target=&quot;_blank&quot;&gt;http://www.adobe.com/devnet/photoshop/scripting.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;I would recomend taking a look at the &quot;&lt;strong&gt;VBScript Reference&lt;/strong&gt;&quot; for your version of Photoshop, compared to the JavaScript or AppleScript:  The VB seems to more closely match the Python bindings\syntax.&lt;br&gt;</description>
<category>SYSTEM</category>
<category>adobe</category>
<category>photoshop</category>
<category>com</category>
<category>win32com</category>
<category>image</category>
<category>psd</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BControl%20Photoshop%20from%20Maya%5D%5D</link>
<pubDate>Thu, 12 Jan 2012 18:07:00 GMT</pubDate>
</item>
<item>
<title>Scale one vector about another</title>
<description>While writing a scripted plugin node for manipulating UV's, I needed a way to 'scale them'.  The below functions work equally well in 2d or 3d (although the examples are in 2d).  They're based around the &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2011help/API/class_m_vector.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2011help/API/class_m_vector.html&quot; target=&quot;_blank&quot;&gt;OpenMaya.MVector&lt;/a&gt; class.&lt;br&gt;&lt;hr&gt;In this example, 'percent' is a single value, doing a uniform scale on the vector:&lt;br&gt;&lt;pre&gt;# Python code
import maya.OpenMaya as om

def scaleVector(vec, center, percent):
    &quot;&quot;&quot;
    Scale a given vector around a center-point, by a percent.

    Parameters:
    vec : OpenMaya.MVector : The vector to rotate.
    center : OpenMaya.MVector : The vector to rotate about.
    percent : float : The percent to scale the vector.

    Return: OpenMaya.MVector : The rotated vector.
    &quot;&quot;&quot;
    offsetA = vec - center # move relative to origin
    scaled = offsetA * percent # scale by the percent about the origin
    reset = scaled + center # offset back to orig position rel to center

    return reset
&lt;/pre&gt;&lt;pre&gt;vec = om.MVector(.25, .5)
center = om.MVector(.5,.5)
percent = .5
scaled = scaleVector(vec, center, percent)
print scaled.x, scaled.y
&lt;/pre&gt;&lt;pre&gt;0.375 0.5 # yes, this is correct :)
&lt;/pre&gt;&lt;hr&gt;In this example, scale is a vector, allowing for xy(z) scaling, or non-uniform scaling.&lt;br&gt;&lt;pre&gt;def scaleVector(vec, center, scale):
    &quot;&quot;&quot;
    Scale a given vector around a center-point, by another vector.

    Parameters:
    vec : OpenMaya.MVector : The vector to rotate.
    center : OpenMaya.MVector : The vector to rotate about.
    scale : OpenMaya.MVector : The vector defining the xyz scale values.

    Return: OpenMaya.MVector : The rotated vector.
    &quot;&quot;&quot;
    offsetA = vec - center
    scaled = om.MVector(offsetA.x * scale.x, offsetA.y * scale.y, offsetA.z * scale.z)
    reset = scaled + center

    return reset
&lt;/pre&gt;&lt;pre&gt;vec = om.MVector(.25, .5)
center = om.MVector(.5,.5)
scale = om.MVector(.5,.5)
scaled = scaleVector(vec, center, scale)
print scaled.x, scaled.y
&lt;/pre&gt;&lt;pre&gt;0.375 0.5 # yes, this is correct :)
&lt;/pre&gt;</description>
<category>MATH</category>
<category>vector</category>
<category>OpenMaya</category>
<category>OpenMaya.MVector</category>
<category>scale</category>
<category>2d</category>
<category>3d</category>
<category>uv</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BScale%20one%20vector%20about%20another%5D%5D</link>
<pubDate>Thu, 12 Jan 2012 17:24:00 GMT</pubDate>
</item>
<item>
<title>Rotate one 2d vector around another</title>
<description>While writing a scripted plugin node for manipulating UV's, I needed a way to 'rotate them'.  Since this is a 2d transformation, I came up with the below function.  It's based around the &lt;a class=&quot;externalLink&quot; href=&quot;http://download.autodesk.com/us/maya/2011help/API/class_m_vector.html&quot; title=&quot;External link to http://download.autodesk.com/us/maya/2011help/API/class_m_vector.html&quot; target=&quot;_blank&quot;&gt;OpenMaya.MVector&lt;/a&gt; class.&lt;br&gt;&lt;pre&gt;# Python code
from math import radians
import maya.OpenMaya as om

def rotateVector(vec, center, angle):
    &quot;&quot;&quot;
    Rotate a given 2d vector around a center-point, by a number of degrees.

    Parameters:
    vec : OpenMaya.MVector : The vector to rotate.
    center : OpenMaya.MVector : The vector to rotate about.
    angle : float : The angle in degrees (counter-clockwise is positive).

    Return: OpenMaya.MVector : The rotated vector.
    &quot;&quot;&quot;
    rads = radians(angle) # convert angle to radians
    offsetA = vec - center # move relative to origin
    rotated = offsetA.rotateBy(om.MVector.kZaxis, rads) # Rotate around origin
    reset = rotated + center # offset back to orig position rel to center
    
    return reset
&lt;/pre&gt;&lt;pre&gt;vec = om.MVector(.25, .5)
center = om.MVector(.5, .5)
angle = 90
rotated = rotateVector(vec, center, angle)
print rotated.x, rotated.y
&lt;/pre&gt;&lt;pre&gt;0.5 0.25 # yes, this is correct ;)
&lt;/pre&gt;</description>
<category>MATH</category>
<category>OpenMaya</category>
<category>OpenMaya.MVector</category>
<category>OpenMaya.MVector.rotateBy</category>
<category>2d</category>
<category>rotate</category>
<category>uv</category>
<category>vector</category>
<link>http://mayamel.tiddlyspot.com#%5B%5BRotate%20one%202d%20vector%20around%20another%5D%5D</link>
<pubDate>Thu, 12 Jan 2012 17:22:00 GMT</pubDate>
</item>
</channel>
</rss>
