<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Brian Escribano - MEL &amp; Python Tricks</title>
    <link>http://brian.meljunky.com/</link>
    <description>Technical Setup Artist</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.2-beta5 - http://www.s9y.org/</generator>
    <pubDate>Wed, 28 May 2008 03:54:22 GMT</pubDate>

    <image>
        <url>http://brian.meljunky.com/templates/meljunky/img/s9y_banner_small.png</url>
        <title>RSS: Brian Escribano - MEL &amp; Python Tricks - Technical Setup Artist</title>
        <link>http://brian.meljunky.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Python: curveOffset</title>
    <link>http://brian.meljunky.com/index.php?/archives/50-Python-curveOffset.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/50-Python-curveOffset.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=50</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=50</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    
Was challenged two weeks to write a script that selects all odd or even CVs of a nurbs curve. Kind of a speed challenge, but was distracted during the writing of the script so what should of taken less then 10 minutes to write turned into 20 minutes.

&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea cols=&quot;48&quot; wrap=&quot;off&quot; readonly=&quot;true&quot; rows=&quot;7&quot; style=&quot;width: 400px; height: 133px;&quot;&gt;#Created by Brian Escribano, www.meljunky.com 
import maya.cmds as cmds
def  curveOffset( ):
    selection = cmds.ls(selection=True)    
    curve = selection[0].split(&#039;.&#039;)[0]
    selCV = selection[0][ selection[0].find(&#039;[&#039;)+1 : selection[0].find(&#039;]&#039;) ]
    numSpans = cmds.getAttr( curve + &#039;.spans&#039; )
    degree = cmds.getAttr( curve + &#039;.degree&#039; )
    form = cmds.getAttr( curve + &#039;.form&#039;)
    numCVs   = numSpans + degree;
    if ( form == 2 ): 
        numCVs -= degree
    
    try:
        state = int(selCV) % 2
    except:
        state = 0
        selCV = numCVs + 1

    if state == 0:
        selList = range(0, numCVs-1, 2) # evens
    else:
        selList = range(1, numCVs, 2) # odds

    for sel in selList:
        if sel != int(selCV):
            cmds.select( curve + &#039;.cv[&#039; + str(sel) + &#039;]&#039;, toggle=True)
&lt;/textarea&gt;&lt;/font&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 27 May 2008 21:54:00 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/50-guid.html</guid>
    
</item>
<item>
    <title>Python: parentCurve</title>
    <link>http://brian.meljunky.com/index.php?/archives/52-Python-parentCurve.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/52-Python-parentCurve.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=52</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=52</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    
&lt;p&gt;parentCurve function allows for quick parenting of nurbs curve&#039;s shape node to a given list or selection.&lt;br /&gt;&lt;br /&gt;Keyword Arguments:&lt;br /&gt;normal=(1,0,0) #Sets the normal direction of the makeNurbsCurve, default to X&lt;br /&gt;radius=0.5 #Adjust the radius of the curve&lt;br /&gt;color=None #Change the color of the curve, choices are [1-31]&lt;br /&gt;selList=None #The list of nodes to make the adjustments. Default will be the current selection&lt;/p&gt;&lt;p /&gt;
&lt;div align=&quot;center&quot;&gt;&lt;textarea cols=&quot;48&quot; wrap=&quot;off&quot; readonly=&quot;true&quot; rows=&quot;7&quot; style=&quot;width: 400px; height: 133px;&quot;&gt;#Created by Brian Escribano, www.meljunky.com 
import maya.cmds as cmds
def parentCurve(normal=(1,0,0), radius=0.5, color=None, selList=None):
    circleList = []
    if not selList:
        selList = cmds.ls(selection=True)
    for node in selList:
        circle = cmds.circle(c=[0, 0, 0],nr=[0, 1, 0], sw=360, r=1, d=3, ut=0, tol=0.01, s=8, ch=1)
        shapes = cmds.listRelatives(circle[0], shapes=True)
        cmds.parent(circle[0], node)
        cmds.makeIdentity(circle[0], apply=False, t=1, r=1, s=1, n=0)
        cmds.parent(shapes[0], node, r=1, s=1)
        cmds.delete(circle[0])        
        cmds.setAttr( circle[1] + &#039;.normalX&#039;, normal[0] )
        cmds.setAttr( circle[1] + &#039;.normalY&#039;, normal[1] )
        cmds.setAttr( circle[1] + &#039;.normalZ&#039;, normal[2] )
        cmds.setAttr( circle[1] + &#039;.radius&#039;, radius )
        if color:
            cmds.setAttr( shapes[0] + &#039;.overrideEnabled&#039;, 1)
            cmds.setAttr( shapes[0] + &#039;.overrideColor&#039;, color )
        circleList.append( shapes[0] )
    return circleList&lt;/textarea&gt;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Tue, 27 May 2008 21:51:56 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/52-guid.html</guid>
    
</item>
<item>
    <title>Python: groupAbove</title>
    <link>http://brian.meljunky.com/index.php?/archives/51-Python-groupAbove.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/51-Python-groupAbove.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=51</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=51</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    
&lt;p&gt;This short function will create a group node above the nodes in a given list. If no list is provided then the selection is used. Has the ability for search and replace. The group node will be placed in the same position, to zero out the controls of translation and rotation. Will also adjust the parenting as needed.&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;width: 400px; height: 133px; &quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;48&quot;&gt;#Created by Brian Escribano, www.meljunky.com 
import maya.cmds as cmds
def groupAbove( search, replace, selList=None ):
    #Grab current selection
    if not selList:
        selList = cmds.ls(selection=True)
    for node in selList:
        groupName = node.replace(search, replace)
        group = cmds.group(world=True, empty=True, name=groupName)
        cmds.parent(group, node)
        cmds.makeIdentity(group, apply=False, t=1, r=1, s=1, n=0)
        cmds.parent(group, w=True)
    
        #determine parent
        parents = cmds.listRelatives(node, parent=True)
        if parents != None:
            cmds.parent(group, parents[0])
        cmds.parent(node, group)

&lt;/textarea&gt;&lt;/font&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face=&quot;times new roman,times,serif&quot;&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;For example: groupAbove(&#039;CTRL&#039;, &#039;GRP&#039;) will create a group node with the named change by the search and replace keyword.&lt;/p&gt;&lt;p&gt;One limitation of MEL over Python is the inability to setup default
keyword arguments in functions (procedures). For MEL to create
reusability for a procedure to work with a selection or a custom array
will take multiple commands or procedure.
&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://brian.meljunky.com/index.php?/archives/51-Python-groupAbove.html#extended&quot;&gt;Continue reading &quot;Python: groupAbove&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 27 May 2008 20:29:43 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/51-guid.html</guid>
    
</item>
<item>
    <title>Arguments return values using MEL</title>
    <link>http://brian.meljunky.com/index.php?/archives/41-Arguments-return-values-using-MEL.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/41-Arguments-return-values-using-MEL.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=41</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;In Python when the following is executed:&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&lt;br /&gt;import maya.OpenMaya as OpenMaya&lt;br /&gt;selection = OpenMaya.MSelectionList()&lt;br /&gt;OpenMaya.MGlobal.getActiveSelectionList( selection )&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face=&quot;verdana,arial,helvetica,sans-serif&quot;&gt;An instance of the class MSelectionList is created and is called &#039;selection&#039;. The empty &#039;selection&#039; is passed to the funtion getActiveSelectionList of the class MGlobal which populates &#039;selection&#039; with the active selection list.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;The following example will use MEL to pass an empty array to a procedure which in turn will populate it. Without using a return statement.&lt;/p&gt;&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;proc addColor(string $result[]){&lt;br /&gt; string $colorList[] = {&amp;quot;Cyan&amp;quot;, &amp;quot;Yellow&amp;quot;, &amp;quot;Magenta&amp;quot;, &amp;quot;Black&amp;quot;};&lt;br /&gt; for ( $color in $colorList){&lt;br /&gt;  $result[size($result)] = $color;&lt;br /&gt; }&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;string $ink[] = {};&lt;br /&gt;addColor( $ink );&lt;br /&gt;print $ink;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face=&quot;verdana,arial,helvetica,sans-serif&quot;&gt;The results of $ink is:&lt;br /&gt;Cyan&lt;br /&gt;Yellow&lt;br /&gt;Magenta&lt;br /&gt;Black&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Don&#039;t have to use a loop to return the results. Setting $colorList to $result will do the same thing. Wanted to show that something can be done to the array before the results are &amp;quot;returned&amp;quot;.   &lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 07 Mar 2008 11:39:05 -0700</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/41-guid.html</guid>
    
</item>
<item>
    <title>Convert Dynamic</title>
    <link>http://brian.meljunky.com/index.php?/archives/29-Convert-Dynamic.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/29-Convert-Dynamic.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=29</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=29</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;Copies the translation and rotation to a new object. Useful for converting dynamic object tranformation to keyframe. Will need to &amp;quot;Simplify Curve&amp;quot; since their will be keyframes on X number of frames.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;WIDTH: 400px; HEIGHT: 133px&quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;48&quot;&gt; 
/*
convertDynamic
Copies the translation and rotation to a new object. Useful for converting dynamic object tranformation 
to keyframe. Will need to &amp;quot;Simplify Curve&amp;quot; since their will be keyframes on X number of frames.
Accepts 5 arguements:
	string $dynObj - Dynamic object
        string $newObj - New object that will be keyframe
        int $startFrame - Start keyframe
        int $endFrame - End Keyframe
        int $byFrame - Increment frame by x value. 1 will equal every frame
Sample: convertDynamic (&amp;quot;nurbsSphere1&amp;quot;, &amp;quot;nurbsSphere2&amp;quot;, 1, 480, 20);
Created by Brian Escribano
Website: www.melJunky.com
Email: brian@meljunky.com
Version 1.0: October 15, 2007
*/
global proc convertDynamic (string $dynObj, string $newObj, int $startFrame, int $endFrame, int $byFrame){
	float $translate[], $rotate[];
	for ($frame=$startFrame ;$frame&amp;lt;=$endFrame; $frame += $byFrame){
		currentTime $frame;
		$translate = `getAttr ($dynObj + &amp;quot;.t&amp;quot;)`;
		$rotate = `getAttr ($dynObj + &amp;quot;.r&amp;quot;)`;
		xform -t $translate[0] $translate[1] $translate[2] $newObj;
		xform -ro $rotate[0] $rotate[1] $rotate[2] $newObj;
		setKeyframe -at translate $newObj;
		setKeyframe -at rotate $newObj;
	}
}

}
&lt;/textarea&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Download MEL Script: &lt;a title=&quot;dynamicToKeyframe.mel&quot; href=&quot;http://brian.meljunky.com/index.php?/plugin/dlfile_5&quot; target=&quot;_blank&quot;&gt;dynToKeyframe.mel&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 15 Oct 2007 21:08:07 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/29-guid.html</guid>
    
</item>
<item>
    <title>Welcome to MELTricks</title>
    <link>http://brian.meljunky.com/index.php?/archives/22-Welcome-to-MELTricks.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/22-Welcome-to-MELTricks.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=22</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=22</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p align=&quot;left&quot;&gt;Tips and Tricks that did not find their way into my scripts.. or had they? The formatted code will be perserved if you copy text from the field. The MEL file is available for download.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 27 Aug 2007 11:54:05 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/22-guid.html</guid>
    
</item>
<item>
    <title>Custom PickWalk</title>
    <link>http://brian.meljunky.com/index.php?/archives/19-Custom-PickWalk.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/19-Custom-PickWalk.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=19</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=19</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;The script allows pick walking based off an array using hot keys that the user will define. The hotkeys will call the procedure pickWalk2(&amp;quot;up&amp;quot;) to move up in the array or pickWalk2(&amp;quot;down&amp;quot;) to move down the aray. Change the array to the order of controls that you want selected when the custom pickwalk is enabled.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;WIDTH: 400px; HEIGHT: 133px&quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;61&quot;&gt; 
global proc pickWalk2 (string $walk){
int $j;
string $pickWalk[] = {&amp;quot;circle1CTRL&amp;quot;, &amp;quot;circle2CTRL&amp;quot;, &amp;quot;circle3CTRL&amp;quot;, &amp;quot;circle4CTRL&amp;quot; };
string $sel[] = `ls -sl`;
$count = stringArrayCount($sel[0], $pickWalk);
if ($count &amp;gt; 0){
	for ($i=0; $i &amp;lt; size($pickWalk); $i++){
		if ($sel[0] == $pickWalk[$i]){
			if ($walk == &amp;quot;up&amp;quot;){
				$j = $i + 1;
				if ($j == size($pickWalk)) $j = 0;
				select $pickWalk[$j];
				break;
			}//end if up
			else{
				$j = $i - 1;
                                if ($j == -1) $j = `size($pickWalk)`-1;
   				select $pickWalk[$j];
				break;
			}//end else
		}//end if
	}//end for
}//end if
}//end global proc
&lt;/textarea&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Download MEL Script: &lt;a title=&quot;pickWalk.mel&quot; href=&quot;http://brian.meljunky.com/index.php?/plugin/dlfile_25&quot; target=&quot;_blank&quot;&gt;pickWalk.mel&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 25 Aug 2007 09:53:45 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/19-guid.html</guid>
    
</item>
<item>
    <title>Stretchy IK</title>
    <link>http://brian.meljunky.com/index.php?/archives/18-Stretchy-IK.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/18-Stretchy-IK.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=18</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=18</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;The script creates a node based stretchy IK system based of the distance of the children distance from its parent. That means the joint will lock straight before the stretch begins.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;WIDTH: 400px; HEIGHT: 133px&quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;48&quot;&gt; 
/*
ikStretch
Create a node based ik stretch for joint chains
Accepts 3 arguements:
        $rootJnt - root joint of ik chain
        $ctrl - The control object that transform the ik handle
        $prefix - prefix used to describe the type of chain i.e. lf_arm
Created by Brian Escribano
Website: www.melJunky.com
Email: brian@meljunky.com
Version 1.0: June 3, 2006
*/
global proc ikStretch (string $rootJnt, string $ctrl, string $prefix){
 //Determine Children
 string $midJnt[] = `listRelatives -type joint $rootJnt`;
 string $endJnt[] = `listRelatives -type joint $midJnt`;
 //Create and parent group nodes
 string $aimGrp = `group -em -n ($prefix + &amp;quot;_distAim_ikGRP&amp;quot;) -p $rootJnt`;   //temp parent to move group to rootJnt
 string $pntGrp = `group -em -n ($prefix + &amp;quot;_distPnt_ikGRP&amp;quot;) -p $aimGrp`;
 //Aim/point constraint the aimGrp/pntGrp to the ctrl
 aimConstraint -offset 0 0 0 -weight 1 -aimVector 1 0 0 -upVector 0 1 0 -worldUpType &amp;quot;vector&amp;quot; -worldUpVector 0 1 0 $ctrl $aimGrp;
 pointConstraint -offset 0 0 0 -weight 1 $ctrl $pntGrp;
 //get distance of pntGrp, min and end
 //float $pntGrpDist = `getAttr ($pntGrp + &amp;quot;.translateX&amp;quot;)`;
 float $midJntDist = `getAttr ($midJnt[0] + &amp;quot;.translateX&amp;quot;)`;
 float $endJntDist = `getAttr ($endJnt[0] + &amp;quot;.translateX&amp;quot;)`;
 float $distance = abs($midJntDist) + abs($endJntDist);
 //creaye multiply divide node
 string $mdNode = `createNode -n ($prefix + &amp;quot;_mp_UTL&amp;quot;) multiplyDivide`;
 setAttr ($mdNode + &amp;quot;.operation&amp;quot;) 2;
 connectAttr -f ($pntGrp + &amp;quot;.translateX&amp;quot;) ($mdNode + &amp;quot;.input1X&amp;quot;);
 setAttr ($mdNode + &amp;quot;.input2X&amp;quot;) $distance;
 //create condition
 string $cnNode = `createNode -n ($prefix + &amp;quot;_cn_UTL&amp;quot;) condition`;
 setAttr ($cnNode + &amp;quot;.operation&amp;quot;) 3;
 setAttr ($cnNode + &amp;quot;.secondTerm&amp;quot;) 1;
 connectAttr -f ($mdNode + &amp;quot;.outputX&amp;quot;) ($cnNode + &amp;quot;.firstTerm&amp;quot;);
 connectAttr -f ($mdNode + &amp;quot;.outputX&amp;quot;) ($cnNode + &amp;quot;.colorIfTrueR&amp;quot;);
 //connect scale
 connectAttr -f ($cnNode + &amp;quot;.outColorR&amp;quot;) ($rootJnt + &amp;quot;.scaleX&amp;quot;);
 connectAttr -f ($cnNode + &amp;quot;.outColorR&amp;quot;) ($midJnt[0] + &amp;quot;.scaleX&amp;quot;);
 //parent aimGrp to a pad node to preserve translation on aimGrp when parenting
 string $stretchGrp = `group -em -w -n ($prefix + &amp;quot;_stretch_ikGRP&amp;quot;)`;
 parent $aimGrp $stretchGrp;
}
&lt;/textarea&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Download MEL Script: &lt;a title=&quot;ikStretch.mel&quot; href=&quot;http://brian.meljunky.com/index.php?/plugin/dlfile_24&quot; target=&quot;_blank&quot;&gt;ikStretch.mel&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 25 Aug 2007 09:51:13 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/18-guid.html</guid>
    
</item>
<item>
    <title>Stretchy Back IK</title>
    <link>http://brian.meljunky.com/index.php?/archives/17-Stretchy-Back-IK.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/17-Stretchy-Back-IK.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=17</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=17</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;The script creates a node based stretchy back IK system based of the distance of the curveInfo node. If you did not create one, one will be provided.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;WIDTH: 400px; HEIGHT: 133px&quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;44&quot;&gt; 
/*
ikBackStretch
Create a node based ik back stretch for joint chains. If no curveInfo is created script will generate one
Accepts 3 arguements:
        $jnts[] - list of joints can be `ls -sl` when calling procedure while joints selected
        $curve[] - name of curve for ik spline
        $type - 1 min stretch is equal to 1
                !1 (non one value, like 0) Stretch can go below 1
Created by Brian Escribano
Website: www.melJunky.com
Email: brian@meljunky.com
Version 1.0: June 4, 2006
*/

global proc ikBackStretch (string $jnts[], string $curve, int $type)
{
  float $crvDistance;
  string $eval;
  //determin if their is a curve info node already exists
  string $curveShape[] = `listRelatives -s $curve`;
  string $curveInfo[] = `listConnections -t curveInfo $curveShape[0]`;

  if (size($curveInfo) == 0)
        $curveInfo[0] = `arclen -ch 1 $curve`;

  $crvDistance = `getAttr ($curveInfo[0] + &amp;quot;.arcLength&amp;quot;)`;
  string $mdNode = `createNode -n ($curve + &amp;quot;_mp_UTL&amp;quot;) multiplyDivide`;
  setAttr ($mdNode + &amp;quot;.operation&amp;quot;) 2;
  connectAttr -f ($curveInfo[0] + &amp;quot;.arcLength&amp;quot;) ($mdNode + &amp;quot;.input1X&amp;quot;);
  setAttr ($mdNode + &amp;quot;.input2X&amp;quot;) $crvDistance;
  
  if ($type == 1)
  {
        //create condition
        string $cnNode = `createNode -n ($curve + &amp;quot;_cn_UTL&amp;quot;) condition`;
        setAttr ($cnNode + &amp;quot;.operation&amp;quot;) 3;
        setAttr ($cnNode + &amp;quot;.secondTerm&amp;quot;) 1;
        connectAttr -f ($mdNode + &amp;quot;.outputX&amp;quot;) ($cnNode + &amp;quot;.firstTerm&amp;quot;);
        connectAttr -f ($mdNode + &amp;quot;.outputX&amp;quot;) ($cnNode + &amp;quot;.colorIfTrueR&amp;quot;);
        //connect scale
        for ($eval in $jnts){
              connectAttr -f ($cnNode + &amp;quot;.outColorR&amp;quot;) ($eval + &amp;quot;.scaleX&amp;quot;);
        }
  }
  else{
        for ($eval in $jnts){
              connectAttr -f ($mdNode + &amp;quot;.outputX&amp;quot;) ($eval + &amp;quot;.scaleX&amp;quot;);
        }
  }
}
&lt;/textarea&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Download MEL Script: &lt;a title=&quot;ikBackStretch.mel&quot; href=&quot;http://brian.meljunky.com/index.php?/plugin/dlfile_23&quot; target=&quot;_blank&quot;&gt;ikBackStretch.mel&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 25 Aug 2007 09:49:06 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/17-guid.html</guid>
    
</item>
<item>
    <title>Color Override</title>
    <link>http://brian.meljunky.com/index.php?/archives/16-Color-Override.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/16-Color-Override.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=16</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=16</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;This script allows the coloration of shape and most transform nodes. View the header for more information &lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;WIDTH: 400px; HEIGHT: 133px&quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;47&quot;&gt; 
/*
colorOverride
Disconnects the overrideColor from the layer if available and applies the color given
Accepts 2 arguements:
        $list[] - Nodes that will have their color changed. Transform nodes will be evaluated 
                to color a shape node if available. `ls -sl` can be used to color the selection
        $color - values are based of Colors preference, index 1. (Window -&amp;gt; Settings/Preferences -&amp;gt; Colors...Tab(Active))
                examples: 6 blue, 13 Red, 14 Green, 17 Yellow
Created by Brian Escribano
Website: www.melJunky.com
Email: brian@meljunky.com
Version 1.0: June 7, 2006
*/
//This script is desiged to change the colorover fuction to a given color

global proc colorOverride (string $list[], int $color){
        string $shape[], $layer[], $colorNode;
        
        for ($node in $list){
        //determine shape node
        $shape = `listRelatives -f -s $node`;
        if (size($shape) == 0){
                //transform only
                $colorNode = $node;
        }else{
                //shape node
                $colorNode = $shape[0];
        }
        //determine layer
        $layer = `listConnections -t displayLayer $colorNode`;
        //disconnect layer if exists
        if (size($layer) != 0)
                disconnectAttr  ($layer[0] + &amp;quot;.drawInfo&amp;quot;) ($colorNode + &amp;quot;.drawOverride&amp;quot;);

        setAttr ($colorNode + &amp;quot;.overrideEnabled&amp;quot;) 1;
        setAttr ($colorNode + &amp;quot;.overrideColor&amp;quot;) $color;
        }
        print &amp;quot;Color override complete.&amp;quot;;
}
&lt;/textarea&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Download MEL Script: &lt;a title=&quot;colorOverride.mel&quot; href=&quot;http://brian.meljunky.com/index.php?/plugin/dlfile_21&quot; target=&quot;_blank&quot;&gt;colorOverride.mel&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 25 Aug 2007 09:31:47 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/16-guid.html</guid>
    
</item>
<item>
    <title>multiDriverSDK</title>
    <link>http://brian.meljunky.com/index.php?/archives/15-multiDriverSDK.html</link>
            <category>MEL &amp; Python Tricks</category>
    
    <comments>http://brian.meljunky.com/index.php?/archives/15-multiDriverSDK.html#comments</comments>
    <wfw:comment>http://brian.meljunky.com/wfwcomment.php?cid=15</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://brian.meljunky.com/rss.php?version=2.0&amp;type=comments&amp;cid=15</wfw:commentRss>
    

    <author>nospam@example.com (Brian Escribano)</author>
    <content:encoded>
    &lt;p&gt;This script create a network of utilities that will connect two attributes using ethier a multiplyDivide of plusMinusAverage node. The operation can be changed. A Set Driven Key is set up between the output and the driven. The values are change using a float arrays.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;font face=&quot;Courier New, Courier, mono&quot;&gt;&lt;textarea style=&quot;WIDTH: 400px; HEIGHT: 133px&quot; rows=&quot;7&quot; readonly=&quot;true&quot; wrap=&quot;off&quot; cols=&quot;43&quot;&gt; 
/*
multiDriverSDK
Connects two drivers through a given operation and connects the output to a driven with the given float values
Accepts 6 arguements:
	string $driver1 - name of the first driver and attr. For example &amp;quot;mySphere.tx&amp;quot;
	string $driver2 - name of the second driver and attr. For example &amp;quot;myCube.tx&amp;quot;
	string $equation - Type of operation. Avaliable operations are multiply, divide, power, sum, subtract, average
	float $driverValue[] - float range for the sdk using an array. Can include as many sdk as needed.
	float $drivenValue[] - Same as above. Need to be the same size array
	string $driven - name of the first driven and attr. For example &amp;quot;mySphere.tx&amp;quot;
Created by Brian Escribano
Website: www.melJunky.com
Email: brian@meljunky.com
Version 1.0: June 12, 2006
*/

global proc multiDriverSDK (string $driver1, string $driver2, string $equation, float $driverValue[], float $drivenValue[], string $driven){

	string $nodeType, $nodeName, $suffix, $nodeOutput;
	int $opperation;

	//Determin node type to create
	if ($equation == &amp;quot;multiply&amp;quot; || $equation == &amp;quot;divide&amp;quot; || $equation == &amp;quot;power&amp;quot;){
        	$suffix = &amp;quot;_md_UTL&amp;quot;;
        	$nodeOutput = &amp;quot;.outputX&amp;quot;;
		if ($equation == &amp;quot;multiply&amp;quot;)
			$opperation = 1;
		if ($equation == &amp;quot;divide&amp;quot;)
			$opperation = 2;
		if ($equation == &amp;quot;power&amp;quot;)
			$opperation = 3;
        $nodeName = `createNode multiplyDivide -name ($driven + $suffix)`;
	connectAttr -f $driver1 ($nodeName + &amp;quot;.input1X&amp;quot;);
	connectAttr -f $driver2 ($nodeName + &amp;quot;.input2X&amp;quot;);
	}

	if ($equation == &amp;quot;sum&amp;quot; || $equation == &amp;quot;subtract&amp;quot; || $equation == &amp;quot;average&amp;quot;){
		$suffix = &amp;quot;_pma_UTL&amp;quot;;
		$nodeOutput = &amp;quot;.output1D&amp;quot;;
		if ($equation == &amp;quot;sum&amp;quot;)
			$opperation = 1;
		if ($equation == &amp;quot;subtract&amp;quot;)
			$opperation = 2;
		if ($equation == &amp;quot;average&amp;quot;)
			$opperation = 3;
	$nodeName = `createNode plusMinusAverage -name ($driven + $suffix)`;
	connectAttr -f $driver1 ($nodeName + &amp;quot;.input1D[0]&amp;quot;);
	connectAttr -f $driver2 ($nodeName + &amp;quot;.input1D[1]&amp;quot;);
	}

	//Set the operation
        setAttr ($nodeName + &amp;quot; .operation&amp;quot;) $opperation;

	for ($i=0; $i&amp;lt;size($drivenValue); $i++){
		setDrivenKeyframe -dv $driverValue[$i] -v $drivenValue[$i] -cd ($nodeName + $nodeOutput) $driven;
 	}
 	//print out that script is complete
 	print (&amp;quot;MultiDriverSDK is complete.&amp;quot;);

}
&lt;/textarea&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Download MEL Script: &lt;a title=&quot;multiDriversSDK.mel&quot; href=&quot;http://brian.meljunky.com/index.php?/plugin/dlfile_20&quot; target=&quot;_blank&quot;&gt;multiDriversSDK.mel&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 24 Aug 2007 12:12:00 -0600</pubDate>
    <guid isPermaLink="false">http://brian.meljunky.com/index.php?/archives/15-guid.html</guid>
    
</item>

</channel>
</rss>