Animation to Curve SDK MEL SCRIPT

string $curves[] = `listConnections -type "animCurve"`;
for ($curve in $curves){
   connectAttr -f controllerName.AttributeNiceName ($curve+".input");
}
print $curves

Pretty simple SDK creator. Animate and create keys like normal. With a set driven key that was created, make sure the upper and lower limits of the animation are the bounds of the SDK. Replace the ControllerName.AttributeNiceName with the controller's name and the nice name of the Attribute to transfer the animation onto a Set Driven Key. 

Animation to Curve SDK

string $curves[] = `listConnections -type "animCurve"`;
for ($curve in $curves){
   connectAttr -f controllerName.AttributeNiceName ($curve+".input");
}
print $curves

Pretty simple SDK creator. Animate and create keys like normal. With a set driven key that was created, make sure the upper and lower limits of the animation are the bounds of the SDK. Replace the ControllerName.AttributeNiceName with the controller's name and the nice name of the Attribute to transfer the animation onto a Set Driven Key. 

Animation to Curve SDK MEL SCRIPT

string $curves[] = `listConnections -type "animCurve"`;
for ($curve in $curves){
   connectAttr -f controllerName.AttributeNiceName ($curve+".input");
}
print $curves

Match Transforms

//Match Transform

string $MTsel[] = `ls -sl`;

string $source = $MTsel[0];
string $target = $MTsel[1];

float $m[16] = `getAttr ($source+".worldMatrix")`;
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] $target;

Matches Transfroms based on world matrix location to world space

Animation to Curve SDK MEL SCRIPT

string $curves[] = `listConnections -type "animCurve"`;
for ($curve in $curves){
   connectAttr -f controllerName.AttributeNiceName ($curve+".input");
}
print $curves

Pretty simple SDK creator. Animate and create keys like normal. With a set driven key that was created, make sure the upper and lower limits of the animation are the bounds of the SDK. Replace the ControllerName.AttributeNiceName with the controller's name and the nice name of the Attribute to transfer the animation onto a Set Driven Key. 

Obj Reimporter

//OBJ export and import tool. Helps fix bad polygon geometry

loadPlugin objExport;

showWindow;
if (`window -exists PolyCleanWindow`)
    deleteUI PolyCleanWindow;

window 
    -widthHeight 120 140 
    -title "Poly Clean" 
    PolyCleanWindow;

 

columnLayout -rowSpacing 2 -adj 1 -cat "both" 2;
    text -label "                                        Off    On" -align "left";
    radioCollection;
    radioButtonGrp -l "Preserve Normals" -numberOfRadioButtons 2 -l1" "  -l2 " " -cw 2 25 -sl 2 -cat 2 "left" 0 -cw3 120 30 30 NormalVal ;
    button -label "Scene" -w 90 -command sceneExportButton;
    button -label "Selection" -w 90 -command selectionExportButton;

string $fileList[] =`getFileList -fld "C:/"`;
for ($myFileListItem in $fileList)
{
    if($myFileListItem == "Temp")
    {
        print "We have a Temp directory \n";
    }
    else
    {
        sysFile -makeDir "C:/Temp";
    }
}
;

proc sceneExportButton()
{
string $scenePolymesh[] = `ls -et mesh`;
select $scenePolymesh;
pickWalk -d up;
string $scenePolymeshName[] = `ls -sl`;

for ($myScenePolymeshName in $scenePolymeshName)
{
select $myScenePolymeshName;
file -op ("groups=0;ptgroups=0;materials=0;smoothing=0;normals=" +(`radioButtonGrp -q -sl NormalVal` - 1)) -typ "OBJexport" -pr -es ("C:/Temp/" + $myScenePolymeshName);
select $myScenePolymeshName;
doDelete;
file -import -type "OBJ" -ra true -options "mo=1"  -pr -loadReferenceDepth "all" ("C:/Temp/" + $myScenePolymeshName + ".obj");
rename ($myScenePolymeshName + "_Mesh") $myScenePolymeshName;
sysFile -delete ("C:/Temp/" + $myScenePolymeshName + ".obj");
}
;

}
proc selectionExportButton()
{
if ( size( `ls -sl` ) > 0 )
{
string $polymesh[] = `ls -sl -et mesh`;
for ($myPolymesh in $polymesh)
{
select $myPolymesh;
pickWalk -d up;
}
string $polymeshName[] = `ls -sl`;

for ($myPolymeshName in $polymeshName)
{
select $myPolymeshName;
file -op ("groups=0;ptgroups=0;materials=0;smoothing=0;normals=" + (`radioButtonGrp -q -sl NormalVal` - 1)) -typ "OBJexport" -pr -es ("C:/Temp/" + $myPolymeshName);
select $myPolymeshName;
doDelete;
file -import -type "OBJ" -ra true -options "mo=1"  -pr -loadReferenceDepth "all" ("C:/Temp/" + $myPolymeshName + ".obj");
rename ($myPolymeshName + "_Mesh") $myPolymeshName;
 sysFile -delete ("C:/Temp/" + $myPolymeshName + ".obj");
}
}
else
{
print "Nothing Selected";
};
;

}

showWindow;

For when Delete History is just not cutting it. This exports the selected mesh as an obj and reimports it. Completely cleans geometry to a basic state. Can be used on the entire scene or a selection. 

Animation to Curve SDK MEL SCRIPT

string $curves[] = `listConnections -type "animCurve"`;
for ($curve in $curves){
   connectAttr -f controllerName.AttributeNiceName ($curve+".input");
}
print $curves

Pretty simple SDK creator. Animate and create keys like normal. With a set driven key that was created, make sure the upper and lower limits of the animation are the bounds of the SDK. Replace the ControllerName.AttributeNiceName with the controller's name and the nice name of the Attribute to transfer the animation onto a Set Driven Key. 

Vertex Weighting Copy

//Copy one point weight to another//

// get just the object name from selection://


string $selObj[] = `ls -o -sl`;


// get the vert name//
string $selPt[] = `ls -os`;


//get selection size
int $myPointCount = size($selPt);


// find our skindCluster://
string $scls = `findRelatedSkinCluster ($selObj[0])`;

for ($i = 1; $i <= ($myPointCount - 1); $i ++)
{

    //Get the influences and paste the weight to the second selected point//
    string $sourceInfluences[] = `skinPercent  -q -t  $scls $selPt[0]`;
    string $targetInfluences[] = `skinPercent  -q -t  $scls $selPt[$i]`;
    string $diffInfluences[] = stringArrayRemove($sourceInfluences, $targetInfluences);
    
    for ($myDiffInfluences in $diffInfluences)
    {
        skinPercent  -tv $myDiffInfluences 0 $scls $selPt[$i] ;
    }
    ;
    
    for ($mySourceInfluence in $sourceInfluences)
    {
        float $influenceWeight = `skinPercent  -t $mySourceInfluence -q $scls $selPt[0]`;
                skinPercent  -tv $mySourceInfluence $influenceWeight $scls $selPt[$i] ;
        refresh;
        skinPercent  -tv $mySourceInfluence $influenceWeight $scls $selPt[$i] ;
        refresh;
        skinPercent  -tv $mySourceInfluence $influenceWeight $scls $selPt[$i] ;
        refresh;
        skinPercent  -tv $mySourceInfluence $influenceWeight $scls $selPt[$i] ;
        refresh;
    }
}
    print "Point weight copied";
;

Copies the weight from the selected vertices and passes the influence to other vertices 

Sequence Batch Baking for Texture Baking

//Sequence batch baking

//Error trap for selecting only one object.
int $selectedObjCount = size(`ls -sl`);
if ($selectedObjCount != 1 )
    {
        warning "Make sure that only 1 object is selected";
    }
    else
    {
    //Get selected object name    
    string $textFieldName[] = `ls -sl`;
    
    //Create GUI
    if (`window -exists sequenceBatchBakeWindow`)
    deleteUI sequenceBatchBakeWindow;
    window -w 330 -h 160 -t "Sequence Batch Bake" sequenceBatchBakeWindow ;
    formLayout mainForm ;
    text -l "Output File Name" txFileName ;
    textField -tx ($textFieldName[0] + "BatchBake") outputFileName ;
    text -l "Start Frame" txStartFrame;
    textField -tx (`playbackOptions -q -ast`) startFrame ;
    text -l "End Frame" txEndFrame;
    textField -tx (`playbackOptions -q -aet`) endFrame; 
    button -l "Go!" -c ("sequenceBB();") SBBApplyButton ;
    formLayout -e
    -af txFileName "left" 10
    -af txFileName "top" 13 
    -ac outputFileName "left" 10 txFileName
    -af outputFileName "right" 10
    -af outputFileName "top" 10 
    -ac txStartFrame "top" 13 txFileName
    -af txStartFrame "left" 10
    -ac startFrame "left" 10 txStartFrame
    -ac startFrame "top" 5 outputFileName
    -ac txEndFrame "top" 10 txStartFrame
    -af txEndFrame "left" 10
    -ac endFrame "left" 16 txEndFrame
    -ac endFrame "top" 5 startFrame
    -af SBBApplyButton "left" 8
    -af SBBApplyButton "right" 8
    -af SBBApplyButton "bottom" 8
    mainForm ;
    showWindow ;
    
    proc sequenceBB()
    {
    //Get work space plus texture bake sub directories
    string $myCurrentWorkspace = `workspace -q -rd`;
    //print ("My workspace is " + $myCurrentWorkspace + "\n");
    
    //Add texture bake sub directories
    string $interimLMdir = ($myCurrentWorkspace + "renderData/mentalray/lightMap/");
    //print ($interimLMdir + "\n");
    string $currentLMdir;
    
    //Get object name
    string $selectedBakeObj[] = `ls -sl`;
    for ($myBakeObj in $selectedBakeObj)
        {
            //Format name for texture baking
            string $myBakeObjShapes[] = `listRelatives -s $myBakeObj`;
            string $compiledName = ("|" + $myBakeObj + "|" + $myBakeObjShapes[0]);
            
            //Get Shading group 
            string $selectedSG[] = `listConnections -type "shadingEngine" $myBakeObjShapes[0]`;
            
            //Get the texture bake set name
            string $bakeSetName[] = `listConnections -type "textureBakeSet" $myBakeObjShapes[0]`;   
            
            //Error trap for having only one material applied to the object.
            int $selectedSGCount = size($selectedSG);
            if ($selectedSGCount != 1 )
                {
                    warning "Make sure that only 1 material is applied to the object";
                }
                else
                {
                //Get total frame count
                int $startFrameVal = `textField -q -tx startFrame`;
                int $endFrameVal = `textField -q -tx endFrame`;
                int $totalFrameRange = ($endFrameVal - $startFrameVal);
                
                //BakeTexture for each frame
                //Set to first frame
                currentTime -edit $startFrameVal;
                refresh;
                for ($i=0; $i<($totalFrameRange+1); $i++)
                    {
                        string $textureBake[] = `convertLightmap  -camera persp -sh -bo $bakeSetName[0] $selectedSG[0] $compiledName` ;
                        //print ($textureBake[0] + "\n");
                
                        //Rename baked texture
                        //Finalize source output file name
                        string $currentLMdir = ($interimLMdir +  $textureBake[0] + ".tga");
                        //print ($currentLMdir + "\n");   
                        //Finalize destination output file name
                        string $finalOutputName = ($interimLMdir + `textField -q -tx outputFileName` + "." + $i + ".tga");
                        //print ($finalOutputName + "\n");   
                        //Rename the file
                        sysFile -rename $finalOutputName $currentLMdir ; 
                        //print ($currentLMdir + "\n");
                        NextFrame;        
                    }
                  
                }
            }
        }
    }

I used this script that would help create my toon look for my Gepetto piece. Needs to have Mental Ray. Used to bake animated lighting onto UV's for a frame range. Pretty simple, pretty handy if you are going to create a stylized lighting scenario. 

Attach Reference to Plane

//Attach reference to a plane

//Get texture
string $refImageSelection[] = `fileDialog2 -fm 4`;
string $myRefImage;
for ($myRefImage in $refImageSelection)
{
    //Create the file node and assign the texture
    select -cl  ;
    string $newTextureNode = `createRenderNodeCB -as2DTexture "" file ""` ;
    setAttr -type "string" ($newTextureNode + ".fileTextureName") $myRefImage;

    //Get picture dimensions
    string $xSize = `getAttr ( $newTextureNode + ".outSizeX")`;
    string $ySize = `getAttr ( $newTextureNode + ".outSizeY")`;
    
    //Convert dimesions to floats and ints scaled down by 10 percent
    float $xSizeFloatTemp = $xSize;
    float $xSizeFloat = ($xSizeFloatTemp * .01);
    int $xSizeABS = `abs $xSizeFloat`;
    float $ySizeFloatTemp = $ySize;
    float $ySizeFloat = ($ySizeFloatTemp * .01);
    int $ySizeABS = `abs $ySizeFloat`;
    
    //Create the plane with found dimensions
    string $referencePlane[] =`polyPlane -w $xSizeFloat -h $ySizeFloat -sx $xSizeABS -sy $ySizeABS -ax 0 0 1 -cuv 1 -ch 1`;
    
    //Create a material for the reference plane
    string $refPlaneMat =`shadingNode -asShader lambert`;
    
    //Connect texture to the material
    connectAttr -f ($newTextureNode + ".outColor") ($refPlaneMat + ".color");
    
    //Connect the material to the reference plane
    select -cl  ;
    select $referencePlane[0];
    hyperShade -assign $refPlaneMat;
    select -cl  ;
}

Creates an image plane from Geometry.