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.
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.
parentCurve function allows for quick parenting of nurbs curve's shape node to a given list or selection.
Keyword Arguments: normal=(1,0,0) #Sets the normal direction of the makeNurbsCurve, default to X radius=0.5 #Adjust the radius of the curve color=None #Change the color of the curve, choices are [1-31] selList=None #The list of nodes to make the adjustments. Default will be the current selection
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.
For example: groupAbove('CTRL', 'GRP') will create a group node with the named change by the search and replace keyword. 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.
Read a detailed example...
In Python when the following is executed:
import maya.OpenMaya as OpenMaya selection = OpenMaya.MSelectionList() OpenMaya.MGlobal.getActiveSelectionList( selection ) An instance of the class MSelectionList is created and is called 'selection'. The empty 'selection' is passed to the funtion getActiveSelectionList of the class MGlobal which populates 'selection' with the active selection list. 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. proc addColor(string $result[]){ string $colorList[] = {"Cyan", "Yellow", "Magenta", "Black"}; for ( $color in $colorList){ $result[size($result)] = $color; } } string $ink[] = {}; addColor( $ink ); print $ink; The results of $ink is: Cyan Yellow Magenta Black Don'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 "returned".
Copies the translation and rotation to a new object. Useful for converting dynamic object tranformation to keyframe. Will need to "Simplify Curve" since their will be keyframes on X number of frames. Download MEL Script: dynToKeyframe.mel
|
|
Saturday, August 25. 2007
| |
The script allows pick walking based off an array using hot keys that the user will define. The hotkeys will call the procedure pickWalk2("up") to move up in the array or pickWalk2("down") to move down the aray. Change the array to the order of controls that you want selected when the custom pickwalk is enabled. Download MEL Script: pickWalk.mel
|
|
Saturday, August 25. 2007
| |
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. Download MEL Script: ikStretch.mel
|
|
Saturday, August 25. 2007
| |
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. Download MEL Script: ikBackStretch.mel
|
|
Saturday, August 25. 2007
| |
This script allows the coloration of shape and most transform nodes. View the header for more information Download MEL Script: colorOverride.mel
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.
Download MEL Script: multiDriversSDK.mel
|