/**@file na_snapMake_UI.mel v1.0.0
@brief given animator control find out what the fk and ik nodes that need snapping
to one another using multiply divide inputs and an added attribute to animator control connected to md node
@author Nathaniel O. Anozie (ogbonnawork at gmail dot com)
@bug doesn't work on say ikfk_elbow snapping to either ik or fk
@note date created: Apr 24 2012
@note date last modified: Apr 24 2012
@note source na_ui.mel
@note Modify at your own risk
@note --
*/
global string $gl_anim = "gl_anim";
global string $gl_dupAnim = "gl_dupAnim";
global string $gl_moveType_1 = "gl_moveType_1";
global string $gl_moveType_2 = "gl_moveType_2";
global string $gl_moveType_3 = "gl_moveType_3";
global proc na_snapMake_UI()
{
global string $gl_anim;
global string $gl_dupAnim;
//setup up title for gui
string $titleWindow = "na_snap.mel Snapping";
string $mainWindowName = "mainWindow";
na_window($mainWindowName,$titleWindow, 430, 180);
//set up format for gui
string $form = `formLayout -numberOfDivisions 50 "form layout"`;
na_textFieldGrp($form, $mainWindowName,"anim", 5, -10, $gl_anim);
na_textFieldGrp($form, $mainWindowName,"where to move", 30, -10, $gl_dupAnim);
na_checkBox($form, $mainWindowName,"translation", 70, 60,"moveType_pickTypeOn_cmd(1)","moveType_pickTypeOff_cmd(1)");
na_checkBox($form, $mainWindowName,"rotation", 70, 170,"moveType_pickTypeOn_cmd(2)","moveType_pickTypeOff_cmd(2)");
na_checkBox($form, $mainWindowName,"scale", 70, 280,"moveType_pickTypeOn_cmd(3)","moveType_pickTypeOff_cmd(3)");
na_button($form, $mainWindowName,"ok", 120, 180,"button","na_snapMake_cmd");
showWindow $mainWindowName;
}
/**widget commands
*/
global proc moveType_pickTypeOn_cmd(int $type)
{
global string $gl_moveType_1;
global string $gl_moveType_2;
global string $gl_moveType_3;
//widget command string
string $moveType_pickType_on_str = "on";
if($type == 1){ $gl_moveType_1 = $moveType_pickType_on_str; }
if($type == 2){ $gl_moveType_2 = $moveType_pickType_on_str; }
if($type == 3){ $gl_moveType_3 = $moveType_pickType_on_str; }
}
global proc moveType_pickTypeOff_cmd(int $type)
{
global string $gl_moveType_1;
global string $gl_moveType_2;
global string $gl_moveType_3;
//widget command string
string $moveType_pickType_off_str = "off";
if($type == 1){ $gl_moveType_1 = $moveType_pickType_off_str; }
if($type == 2){ $gl_moveType_2 = $moveType_pickType_off_str; }
if($type == 3){ $gl_moveType_3 = $moveType_pickType_off_str; }
}
/**ui command
*/
global proc na_snapMake_cmd()
{
global string $gl_anim;
global string $gl_dupAnim;
global string $gl_moveType_1;
global string $gl_moveType_2;
global string $gl_moveType_3;
//main variables used by script
string $anim = "";
string $dupAnim = "";
int $moveType[] = {};
//get main variables
$anim = `textFieldGrp -query -text $gl_anim`;
$dupAnim = `textFieldGrp -query -text $gl_dupAnim`;
//widget command string
string $moveType_pickType_on_str = "on";
if( `strcmp $gl_moveType_1 $moveType_pickType_on_str` == 0 ){ $moveType[size($moveType)] = 1; }
if( `strcmp $gl_moveType_2 $moveType_pickType_on_str` == 0 ){ $moveType[size($moveType)] = 2; }
if( `strcmp $gl_moveType_3 $moveType_pickType_on_str` == 0 ){ $moveType[size($moveType)] = 3; }
//main command
na_snapMake($anim,$dupAnim,$moveType);
}