//source na_ui.mel
//Acknowledgement scriptspot dot com I learned about global variables
//globals gl_joint, gl_ik_joint, gl_fk_joint, gl_type
global string $gl_joint="gl_joint";
global string $gl_ikJoint="gl_ikJoint";
global string $gl_fkJoint="gl_fkJoint";
global string $gl_type="gl_type";
global string $gl_settingControl="gl_settingControl";
global string $gl_attr="gl_attr";
global string $gl_nodePrefix="gl_nodePrefix";
/**ui
*/
global proc fk_ik_pickUI()
{
global string $gl_joint;
global string $gl_ikJoint;
global string $gl_fkJoint;
global string $gl_type;
global string $gl_settingControl;
global string $gl_attr;
global string $gl_nodePrefix;
//setup up title for gui
string $titleWindow = "na_pick.mel Add fk/ik to enum";
string $mainWindowName = "fkIkChoice";
na_window($mainWindowName,$titleWindow, 320, 225);
//set up format for gui
string $form = `formLayout -numberOfDivisions 50 "form layout"`;
//add ui elements like textfields,buttons, and/or radio buttons
na_textFieldGrp($form, $mainWindowName,"joint", 5, -80, $gl_joint);
na_textFieldGrp($form, $mainWindowName,"ik", 25, -80, $gl_ikJoint);
na_textFieldGrp($form, $mainWindowName,"fk", 45, -80, $gl_fkJoint);
na_textFieldGrp($form, $mainWindowName,"control", 65, -80, $gl_settingControl);
na_textFieldGrp($form, $mainWindowName,"fk ik attribute", 85, -80, $gl_attr);
na_textFieldGrp($form, $mainWindowName,"prefix", 105, -80, $gl_nodePrefix);
na_button($form, $mainWindowName,"ok", 165, 5,"button","fk_ik_pick_cmd");
string $collection = `radioCollection`;
na_radioButton($form, $mainWindowName,"translate", 145, 100,"fk_ik_pickType_cmd(0)",$collection);
na_radioButton($form, $mainWindowName,"rotate", 145, 170,"fk_ik_pickType_cmd(1)",$collection);
}
global proc fk_ik_pickType_cmd(int $type)
{
global string $gl_type;
if($type == 0){ $gl_type = "translate"; }
else{ $gl_type = "rotate"; }
}
/**ui command
*/
global proc fk_ik_pick_cmd()
{
global string $gl_joint;
global string $gl_ikJoint;
global string $gl_fkJoint;
global string $gl_type;
global string $gl_settingControl;
global string $gl_attr;
global string $gl_nodePrefix;
string $joint="";
string $fk_joint="";
string $ik_joint="";
string $type="";
string $control ="";
string $attr="";
string $prefix="";
$joint = `textFieldGrp -query -text $gl_joint`;
$fk_joint = `textFieldGrp -query -text $gl_fkJoint`;
$ik_joint = `textFieldGrp -query -text $gl_ikJoint`;
$type = $gl_type;
$control = `textFieldGrp -query -text $gl_settingControl`;
$attr = `textFieldGrp -query -text $gl_attr`;
$prefix = `textFieldGrp -query -text $gl_nodePrefix`;
na_pick($joint, $fk_joint, $ik_joint, $type, $control, $attr, $prefix);
}