My Showreel




Download High-definition video of the Demo Reel.


http://www.4shared.com/file/107172102/3a8046f8/Rk_RIGnMEL.html

Scripts

There were times I found myself pulling my hair out with frustration due to weird and unacceptable errors in Maya and sometimes even dozing off while repeating the same task over and over again. Well.... knowing MEL just did the trick. Anyway I m uploading a few of my scripts i wrote to ease up my work flow. Use them to save some time and a few remaining hair...... U'll definitely need those to deal with ur marital issues...!!

Script: Unlock OverrideColor

Error: The attribute 'Control.overrideColor' is locked or connected and cannot be modified.

This is an error shown in MAYA when we try to change the color of a control object( Nurbs or Polygons ) using the Drawing Overrides feature in the Attribute Editor
of a Rig.
Though its not that common that we get this error but if u do then here is the solution.

Mel Window:


Script:

global proc colorOverrideUI()

{

if(`window -exists colorOverride` )
deleteUI colorOverride;

window -title "Unlock OverrideColor" -width 280 colorOverride;
columnLayout myColumn1;

separator -style "none" -h 15 sep_1;
colorIndexSliderGrp -label "Select Color" -min 2 -max 24 -value 17 mycolorIndexSliderGrp;

separator -style "none" -h 15 sep_2;

button -label "GO" -width 425 -command co mybutton;

separator -style "none" -h 10 sep_3;

text -align "left" -label " Note: Use this Script only when there is an error during Drawing Overrides.\n\n Example - ' The attribute 'Control_L_FK_ElbowShape.overrideColor' is locked or \n connected and cannot be modified. '. \n\n Rakesh K Karkera \n tylerdurtan@gmail.com" mytext;

separator -style "none" -h 10 sep_4;

showWindow colorOverride;
}


global proc co()
{
int $color_slider=`colorIndexSliderGrp -q -value mycolorIndexSliderGrp`;
$color = $color_slider-1;

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

string $shape[];
string $layer[];
string $colorNode;

for ($node in $list)
{

$shape = `listRelatives -f -s $node`;

if (size($shape) == 0)
{

$colorNode = $node;
}
else
{

$colorNode = $shape[0];

}

}

$layer = `listConnections -t displayLayer $colorNode`;


if (size($layer) != 0)
{
disconnectAttr ($layer[0] + ".drawInfo") ($colorNode + ".drawOverride");

setAttr ($colorNode + ".overrideEnabled") 1;
setAttr ($colorNode + ".overrideColor") $color;
}
print "Color override complete.";
}

How To Use: Select the control object, then select the color from the Color Slider and hit "GO".

When To Use: Use this script only when there is an error as it repairs the override connections by breaking it. This script does not work when there is no error.

Mirror Control Objects

Well this one is a time saver. After making those creative and fancy controls to control ur rig, re-doing it again on the opposite side is a little boring. This script does the trick.

Mel Window:


Script:

global proc rakesh_MirrorObjects()
{


if(`window -exists rakesh_MirrorObjectsUI`)
deleteUI rakesh_MirrorObjectsUI;


window -title " Mirror Control Objects " -sizeable 1 rakesh_MirrorObjectsUI;
menuBarLayout myMenubar;
menu -label "\nHelp";

columnLayout -adj 1 myColumn;
text -label" \n " myTex;
button -label " Mirror " -command mirror myButton;
text -label" \n " myTe;
textFieldGrp
-label "Search For"
-text "_L_" myTextFieldGrp_1;
textFieldGrp
-label "Replace With"
-text "_R_" myTextFieldGrp_2;
text -label" \n " ;
button -label " Mirror After Freeze Transformation " -command mirrorAfterFreezeTrans myButton1;
text -label" \n " ;
text -label" Rakesh K Karkera " myText;
text -label" tylerdurtan@gmail.com " myid;
separator -style "in" mySeparator;
text -label" \n " myspace;

showWindow rakesh_MirrorObjectsUI;


}

global proc mirror()
{

string $selectedObject[]= `ls -sl`;
string $searchFor= `textFieldGrp -q -text myTextFieldGrp_1`;
string $replaceWith= `textFieldGrp -q -text myTextFieldGrp_2`;
for( $eachObject in $selectedObject )
{
select -r $eachObject;


float $translateValues[]=`xform -q -ws -rp $eachObject`;

float $translateValues_IF[]=`xform -q -ws -t $eachObject`;
float $rotateValues[]=`xform -q -ws -rotation $eachObject`;

if( $translateValues_IF[0]==0 && $translateValues_IF[1]==0 && $translateValues_IF[2]==0
&& $rotateValues[0]==0 && $rotateValues[1]==0 && $rotateValues[2]==0 )
{
confirmDialog -title "Alert" -message "The values of the Control Objects have been Frozen already. Click on the \"Mirror After Freeze Transformation \" button below."
-button "Re-Do";
break;
}
else
{
duplicate -name ($eachObject+"_mirrored") $eachObject;
string $duplicatedObject[]= `ls -sl`;

float $translateValues[]=`xform -q -ws -rp $eachObject`;
float $rotateValues[]=`xform -q -ws -rotation $eachObject`;

float $scaleX = `getAttr ($eachObject+".sx")`;
float $scaleY = `getAttr ($eachObject+".sy")`;
float $scaleZ = `getAttr ($eachObject+".sz")`;

float $new_translateXVal = - $translateValues[0];

float $new_rotateYVal = 180 + $rotateValues[1];
float $new_rotateZVal = 180 - $rotateValues[2];

float $new_scaleX = - $scaleX;
float $new_scaleY = - $scaleY;
float $new_scaleZ = - $scaleZ;

setAttr ($duplicatedObject[0]+ ".tx") $new_translateXVal;

setAttr ($duplicatedObject[0]+ ".ty") $translateValues[1];

setAttr ($duplicatedObject[0]+ ".tz") $translateValues[2];

setAttr ($duplicatedObject[0]+ ".rx") $rotateValues[0];

setAttr ($duplicatedObject[0]+ ".ry") $new_rotateYVal;

setAttr ($duplicatedObject[0]+ ".rz") $new_rotateZVal;

setAttr ($duplicatedObject[0]+ ".sx") $new_scaleX;

setAttr ($duplicatedObject[0]+ ".sy") $new_scaleY;

setAttr ($duplicatedObject[0]+ ".sz") $new_scaleZ;

makeIdentity -apply true -t 0 -r 0 -s 1 -n 0 $duplicatedObject[0];


searchReplaceNames $searchFor $replaceWith "hierarchy";

searchReplaceNames "_mirrored" " " "hierarchy";

}
}

}

global proc mirrorAfterFreezeTrans()
{

string $selectedObject[]= `ls -sl`;
string $searchFor= `textFieldGrp -q -text myTextFieldGrp_1`;
string $replaceWith= `textFieldGrp -q -text myTextFieldGrp_2`;
for( $eachObject in $selectedObject )
{
select -r $eachObject;

float $translateValues_IF[]=`xform -q -ws -t $eachObject`;
float $rotateValues[]=`xform -q -ws -rotation $eachObject`;

if( $translateValues_IF[0]!=0 && $translateValues_IF[1]!=0 &&$translateValues_IF[2]!=0
&&$rotateValues[0]!=0 &&$rotateValues[1]!=0 &&$rotateValues[2]!=0 )

{
confirmDialog -title "Alert" -message "The values of the Control Objects has'nt been Frozen. Click on the \"Mirror \" button above."
-button "Re-Do";
break;
}
else

{
duplicate -name ($eachObject+"_mirrored") $eachObject;
string $duplicatedObject[]= `ls -sl`;



move 0 0 0 ($duplicatedObject[0]+".scalePivot") ;
setAttr ($duplicatedObject[0]+ ".sx") -1;

CenterPivot;
makeIdentity -apply true -t 0 -r 0 -s 1 -n 0 $duplicatedObject[0];

CenterPivot;
searchReplaceNames $searchFor $replaceWith "hierarchy";

searchReplaceNames "_mirrored" " " "hierarchy";

}
}

}

How To Use: Select the control object and hit the relevant button on the window.

Note: This Script works only in the YZ-Axis.

Advanced Twist Control

Alright, here is a confusing concept for the beginners. Though the theory of the advanced twist is slightly complicated to comprehend, the result is just smooth. Anyways, here is my script.

Mel Window:


Script:

global proc rk_advanceTwistControl()

{
if(`window -exists rk_advanceTwistControlUI`)
deleteUI rk_advanceTwistControlUI;

window -title " Advanced Twist Controls " -maximizeButton 0 rk_advanceTwistControlUI;
menuBarLayout myMenubar;
menu -label "\nHelp";
menu -label "\nEdit" myResetmenu ;
menuItem -label "Reset" -command rk_advanceTwistControl myMenuitem;
formLayout myformLayout;
//-----------------------------------------------------------------------------------
text -label " Joints " jointsText;
textScrollList -height 50 my_jointsTSL;

//-----------------------------------------------------------------------------------
text -label " IK Spline Handle" ikHandleText;
textScrollList -height 25 my_ikHandleTSL;

//-----------------------------------------------------------------------------------

text -label " Control Objects" myControlsText;
textScrollList -height 50 my_ConObjectsTSL;

//-----------------------------------------------------------------------------------

button -label " Joints " -command jointProcedure joints_button;
button -label " IK Spline Handle " -command ikHandleProcedure IKSpline_button;
button -label " Control Objects " -command controlsProcedure conObjects_button;

//-----------------------------------------------------------------------------------------

button -label " Go " -command go go_button;

//---------------------------------------------------------------
text -label " Rakesh K Karkera " myName;
text -label " tylerdurtan@gmail.com " myid;

formLayout -edit

-attachForm jointsText left 5
-attachForm jointsText top 5
-attachPosition jointsText right 0 30

-attachForm my_jointsTSL left 5
-attachControl my_jointsTSL top 2 jointsText
-attachPosition my_jointsTSL right 0 30
//-----------------------------------------------------------------------------------
-attachControl ikHandleText left 5 jointsText
-attachForm ikHandleText top 5
-attachPosition ikHandleText right 0 60

-attachControl my_ikHandleTSL left 5 my_jointsTSL
-attachControl my_ikHandleTSL top 2 ikHandleText
-attachPosition my_ikHandleTSL right 0 61
//-----------------------------------------------------------------------------------

-attachControl myControlsText left 5 ikHandleText
-attachForm myControlsText top 5
-attachPosition myControlsText right 0 90

-attachControl my_ConObjectsTSL left 6 my_ikHandleTSL
-attachControl my_ConObjectsTSL top 2 myControlsText
-attachPosition my_ConObjectsTSL right 0 98

//---------------------------------------------------------------------------------
-attachForm joints_button left 9
-attachControl joints_button top 15 my_jointsTSL
-attachPosition joints_button right 0 28

-attachControl IKSpline_button left 25 joints_button
-attachControl IKSpline_button top 40 my_ikHandleTSL
-attachPosition IKSpline_button right 0 59


-attachControl conObjects_button left 28 IKSpline_button
-attachControl conObjects_button top 15 my_ConObjectsTSL
-attachPosition conObjects_button right 0 97
//-------------------------------------------------------------------------------------
-attachForm go_button left 30
-attachControl go_button top 20 IKSpline_button
-attachForm go_button right 30

//--------------------------------------------------------------------------------------

-attachPosition myName left 0 38
-attachControl myName top 30 go_button
-attachPosition myName right 0 95


-attachPosition myid left 1 36
-attachControl myid top 0 myName
-attachPosition myid right 0 95

//----------------------------------------------------------------------------
myformLayout;

showWindow rk_advanceTwistControlUI;

}

global proc jointProcedure()

{
textScrollList -edit -removeAll my_jointsTSL;
string $selectedJoints[]= `ls -sl -head 2 ` ;

for( $eachJoint in $selectedJoints)


{
textScrollList -edit -append $eachJoint my_jointsTSL;
}

}

global proc ikHandleProcedure()

{

textScrollList -edit -removeAll my_ikHandleTSL;

string $selectedIK[]=`ls -sl -head 1`;

textScrollList -edit -append $selectedIK[0] my_ikHandleTSL;
}

global proc controlsProcedure()
{
textScrollList -edit -removeAll my_ConObjectsTSL;

string $selectedControls[]=`ls -sl -head 2`;
string $selectedJoints[]= `textScrollList -q -allItems my_jointsTSL`;

int $i;
for($i=0; $i<=1; $i++)
{
textScrollList -edit -append $selectedControls[$i] my_ConObjectsTSL;

select -r $selectedControls[$i];
move 0 0 0 ;
rotate 0 0 0 ;
group -relative -name ($selectedControls[$i]+"_grp" );

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

parentConstraint $selectedJoints[$i] $grouped[0];
select -r ($grouped[0]+"_parentConstraint1");
delete;
}
}
global proc go()

{
string $selectedikHandle[]= `textScrollList -q -allItems my_ikHandleTSL`;

string $selectedconObjects[]= `textScrollList -q -allItems my_ConObjectsTSL`;

setAttr ($selectedikHandle[0]+".dTwistControlEnable") 1;

setAttr ($selectedikHandle[0]+".dWorldUpType") 4;

string $wrldUpObject = $selectedconObjects[0];
string $wrldUpObject2 = $selectedconObjects[1];
string $splnIKHandle = $selectedikHandle[0];
connectAttr -f ($wrldUpObject + ".worldMatrix") ($splnIKHandle+".dWorldUpMatrix");
connectAttr -f ($wrldUpObject2 + ".worldMatrix") ($splnIKHandle+".dWorldUpMatrixEnd");
}

Where To Use: Advance twist is commonly used in the spine of a bi-ped rig. After attaching the ikSpline handle to the spine, attaching the controls to its advance twist gives a very smooth rotation action in a certain direction.

How To Use: After creating the skeleton and attaching the ikSpline handle to the bi-ped character, create two control curves as shown in picture 1 below. In my case i have just created two nurbs circles but u can create your fancy curves. Remember to keep them near the origin as shown in the picture.


Then attach the joints, ikSpline handle and conrols to the Mel Window by selecting and hitting on their respective buttons as shown below in picture 2.


Finally click on 'GO'. The advanced twist is thus activated and by rotating the controls in the X- Axis direction we can see a smooth rotation down the spine as shown in picture below.

Stretchy Spine

This is probably the most sought out theory for any advanced rig. The stretchy concept is popularly used for spine and limbs of a bi-ped character and sometimes in rigging machines. This script is generally aimed at creating stretchy spine and can also be used for machines which are similar in joint creation as a spine.
Stretchy spines are commonly created by using expressions but I've used render nodes instead as it works much faster than expressions. Well, expressions or render nodes.... for a end user i don't think it makes much difference.

Mel Window:


Script:

global proc rk_stretchySpine()
{

if(`window -exists rk_stretchySpineUI`)
deleteUI rk_stretchySpineUI;

window -title " Stretchy Spine " -maximizeButton 0 rk_stretchySpineUI;
menuBarLayout myMenubar;
menu -label "\nHelp";
menu -label "\nEdit" myResetmenu ;
menuItem -label "Reset" -command rk_stretchySpine myMenuitem;
formLayout myformLayout;

//-------------------------------------------------------------------------------
text -label " Joints " jointsText;
textScrollList -height 111 my_jointsTSL;


text -label " Spline Curve " splineCurveText;
textScrollList -height 25 my_SplineCurveTSL;

//--------------------------------------------

button -label " Attach Spline Curve " -command splineCurveProcedure splineCurve_button;

//-----------------------------------------------


text -label " Switch Control ( Optional ) " switchControlText;
textScrollList -height 25 switchControlTSL;

//-----------------------------------------------

button -label " Attach Switch Control " -command switchControlProcedure switchControl_button;

button -label " Attach Joints " -command joints_buttonProcedure joints_button;

//------------------------------------------------

textFieldGrp -label "Name of the Character {Optional) " -text "Character" -adjustableColumn2 1 -adjustableColumn 1 mySpinetextFieldGrp;

button -label " GO " -command go_procedure final_button;


text -label " Rakesh K Karkera " myName;
text -label " tylerdurtan@gmail.com " myid;
//-------------------------------------------------------------------------------
formLayout -edit

-attachForm jointsText left 5
-attachForm jointsText top 4
-attachPosition jointsText right 0 45

-attachForm my_jointsTSL left 5
-attachControl my_jointsTSL top 2 jointsText
-attachPosition my_jointsTSL right 0 45

-attachControl splineCurveText left 15 jointsText
-attachForm splineCurveText top 4
-attachForm splineCurveText right 8


-attachControl my_SplineCurveTSL left 15 my_jointsTSL
-attachControl my_SplineCurveTSL top 2 splineCurveText
-attachForm my_SplineCurveTSL right 8


-attachControl splineCurve_button left 25 jointsText
-attachControl splineCurve_button top 6 my_SplineCurveTSL
-attachForm splineCurve_button right 20

-attachControl switchControlText left 15 jointsText
-attachControl switchControlText top 15 splineCurve_button
-attachForm switchControlText right 8

-attachControl switchControlTSL left 15 jointsText
-attachControl switchControlTSL top 2 switchControlText
-attachForm switchControlTSL right 8


-attachControl switchControl_button left 25 jointsText
-attachControl switchControl_button top 6 switchControlTSL
-attachForm switchControl_button right 20

-attachForm joints_button left 15
-attachControl joints_button top 7 my_jointsTSL
-attachControl joints_button right 35 switchControl_button


-attachForm mySpinetextFieldGrp left 0
-attachControl mySpinetextFieldGrp top 15 joints_button
-attachForm mySpinetextFieldGrp right 5

-attachForm final_button left 40
-attachControl final_button top 15 mySpinetextFieldGrp
-attachForm final_button right 40


-attachPosition myName left 0 38
-attachControl myName top 18 final_button
-attachPosition myName right 0 95


-attachPosition myid left 1 36
-attachControl myid top 0 myName
-attachPosition myid right 0 95

//---------------------------------------------------------------------
myformLayout;

showWindow rk_stretchySpineUI;
}

global proc joints_buttonProcedure()

{
textScrollList -edit -removeAll my_jointsTSL;
string $selectedJoints[]= `ls -sl ` ;

for( $eachJoint in $selectedJoints)
{
textScrollList -edit -append $eachJoint my_jointsTSL;
}
}
global proc splineCurveProcedure()

{
textScrollList -edit -removeAll my_SplineCurveTSL;
string $selectedCurve[]= `ls -sl ` ;
int $size_selectedCurve= size($selectedCurve);

if( $size_selectedCurve>= 2)
{

confirmDialog -title "Alert" -message "U have selected more than 1 object"
-button "Redo" ;
}

else
{
for( $eachCurve in $selectedCurve)


{
textScrollList -edit -append $eachCurve my_SplineCurveTSL;
}

}
}
global proc switchControlProcedure()

{
textScrollList -edit -removeAll switchControlTSL;
string $selectedSwitch[]= `ls -sl ` ;
int $size_selectedSwitch= size($selectedSwitch);


if( $size_selectedSwitch>= 2)
{

confirmDialog -title "Alert" -message "U have selected more than 1 object"
-button "Redo" ;

}

else
{
for( $eachSwitch in $selectedSwitch)


{
textScrollList -edit -append $eachSwitch switchControlTSL;

select -r $eachSwitch;

addAttr -longName Stretchy_Spine_Switch
-defaultValue 0.0
-minValue 0
-maxValue 1
-keyable 1;

}

}

}
global proc go_procedure()
{
string $switch_TSL[] = ` textScrollList -q -allItems switchControlTSL`;
int $switch_size= size($switch_TSL);

if($switch_size <= 0)
{

string $text_charName = `textFieldGrp -q -text mySpinetextFieldGrp`;

string $char_Name = ($text_charName+"_Spine");

//----------------------------------------------------------
// puts the curve in the list
string $curve_inTSL[] = `textScrollList -q -allItems my_SplineCurveTSL`;
//select the curve
select -r $curve_inTSL;
// the arclength value sent to the float variable
float $arclength =` arclen $curve_inTSL `;
// run an arc length and store the name of the node in the string
string $curve_arcLength= `arclen -ch 1`;

//select the distane shape of the node( not sure i need it)
select -r $curve_arcLength ;

//-----------------------------------------------------------

string $stretchy_Mul_Div = `shadingNode -asUtility -name ($char_Name+"_mul_divide") multiplyDivide`;

//select -r $stretchy_Mul_Div ;

setAttr ($stretchy_Mul_Div+".operation") 2;

connectAttr -force ($curve_arcLength+".arcLength") ($stretchy_Mul_Div+".input1X");

setAttr ($stretchy_Mul_Div+".input2X") $arclength;

//----------------------------------------------------------

string $stretchy_condition = `shadingNode -asUtility -name ($char_Name+"_cndNode") condition`;
//select -r condition1 ;
setAttr ($stretchy_condition+".operation") 3;

connectAttr -force ($curve_arcLength+".arcLength") ($stretchy_condition+".firstTerm");

setAttr ($stretchy_condition+".secondTerm") $arclength;

connectAttr -force ($stretchy_Mul_Div+".outputX") ($stretchy_condition+".colorIfTrueR");

//----------------------------------------------------------

string $joints_in_TSL[] = ` textScrollList -q -allItems my_jointsTSL`;

for( $eachObject in $joints_in_TSL)
{
connectAttr -force ($stretchy_condition+".outColorR") ($eachObject+".scaleX");
}

}

else

{

string $text_charName = `textFieldGrp -q -text mySpinetextFieldGrp`;

string $char_Name = ($text_charName+"_Spine");

//----------------------------------------------------------
// puts the curve in the list
string $curve_inTSL[] = `textScrollList -q -allItems my_SplineCurveTSL`;
//select the curve
select -r $curve_inTSL;
// the arclength value sent to the float variable
float $arclength =` arclen $curve_inTSL `;
// run an arc length and store the name of the node in the string
string $curve_arcLength= `arclen -ch 1`;

//select the distane shape of the node( not sure i need it)
select -r $curve_arcLength ;

//-----------------------------------------------------------
string $stretchy_Mul_Div = `shadingNode -asUtility -name ($char_Name+"_mul_divide") multiplyDivide`;

//select -r $stretchy_Mul_Div ;

setAttr ($stretchy_Mul_Div+".operation") 2;

connectAttr -force ($curve_arcLength+".arcLength") ($stretchy_Mul_Div+".input1X");

setAttr ($stretchy_Mul_Div+".input2X") $arclength;

//----------------------------------------------------------

string $stretchy_condition = `shadingNode -asUtility -name ($char_Name+"_cndNode") condition`;
//select -r condition1 ;
setAttr ($stretchy_condition+".operation") 3;

connectAttr -force ($curve_arcLength+".arcLength") ($stretchy_condition+".firstTerm");

setAttr ($stretchy_condition+".secondTerm") $arclength;

connectAttr -force ($stretchy_Mul_Div+".outputX") ($stretchy_condition+".colorIfTrueR");

//----------------------------------------------------------

string $switch_condition = `shadingNode -asUtility -name ($char_Name+"_switch_cndNode") condition`;

//setAttr ($switch_condition+".operation") 3;

connectAttr -force ($switch_TSL[0]+".Stretchy_Spine_Switch") ($switch_condition+".firstTerm");

setAttr ($switch_condition+".secondTerm") 1;

connectAttr -force ($stretchy_condition+".outColorR") ($switch_condition+".colorIfTrueR");

string $joints_in_TSL[] = ` textScrollList -q -allItems my_jointsTSL`;

for( $eachObject in $joints_in_TSL)
{
connectAttr -force ($switch_condition+".outColorR") ($eachObject+".scaleX");
}
}
}

How To Use: