Welcome to 1st vertical a personal
blog about design and other stuff !

Saturday, 9 March 2013

Squash and Stretch Video for GUI

The video for using the Squash and Stretch Ball  GUI
can be found at the following link on vimeo.com


Squash and Stretch MEL GUI

Here is a short MEL script to create an automated Squash and Stretch Ball in Maya.

A video will accompany this on Vimeo.
The script is intended for non commercial use only!
Load the following text into the Script Editor in maya and execute it
Use the Squash and Bend attributes in the Channel Box to make it work.
(MMB right to left)
Enjoy !!

// Created by Tony Smith for student training and non commercial use only 
// Please credit me if used any training context or use 09-03-2013 Tony Smith

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

window -title "ballcreate"
-widthHeight  220 310
-maximizeButton  off

rowColumnLayout -nc 8 keyableRCL;

button -label "ball" -w 75-c "BallcreateGroup()";

showWindow ballcreate;

global proc BallcreateGroup() 

sphere -n ball -p 0 1 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 8 -ch 1;
circle -n ball_ctrl -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1;
addAttr -ln "Squash"  -at double  |ball_ctrl;
setAttr -e-keyable true |ball_ctrl.Squash;
addAttr -ln "bend"  -at double  |ball_ctrl;
setAttr -e-keyable true |ball_ctrl.bend;
select -r ball ;
nonLinear -type squash  -lowBound 0 -highBound 1 -startSmoothness 0 -endSmoothness 0 -maxExpandPos 0.5 -expand .5 -factor 0;
setAttr "squash1Handle.translateY" 0;
setAttr "squash1Handle.scaleZ" 2;setAttr "squash1Handle.translateY" 0;
setAttr "squash1Handle.scaleX" 2;
setAttr "squash1Handle.scaleY" 2;
setAttr "squash1Handle.scaleZ" 2;
setAttr "squash1.factor" 0;
select -r ball ;setAttr "squash1.factor" 0;
nonLinear -type bend  -lowBound 0 -highBound 1 -curvature 0;
setAttr "bend1Handle.rotateY" 90;
setAttr "bend1Handle.scaleX" 5;
setAttr "bend1Handle.scaleY" 5;
setAttr "bend1Handle.scaleZ" 5;
select -r squash1Handle bend1Handle ball;
select -tgl ball_ctrl ;
select -r ball_ctrl ;
connectAttr -force ball_ctrl.Squash squash1.factor;
connectAttr -force ball_ctrl.bend bend1.curvature;
select -cl  ;
select -r squash1Handle bend1Handle ball ;
createDisplayLayer -name "DONOTTOUCH" -number 1 -nr;
select -cl  ;
select -r squash1Handle bend1Handle ;
setAttr "bend1Handle.visibility" 0;
setAttr "squash1Handle.visibility" 0;
select -cl  ;