Mel - Maya Embedded Language

Windows are a nice way to package your MELscripts. Using windows allows the user to input / change data used by your MELscripts on the fly. They can also be useful for making list of commonly used commands. If we did not use a window to process our procedures the user would have to either type in the variables value when calling the procedure or they would have to edit the variables value in the MELscript before using it.

-windows
-creating windows

This is the core of writing a window. Every window must start with this command

      window windowName;

In order to have the window show you must call this command. Call this command after you have writing everything you want to go into your window.

      showWindow windowName;


-deleting old windows.

In order to open a window again. you need to delete the window. Place this code before the window command.

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



-positioning windows.

Use the following formats to position and size your windows

      window -width *** windowName;
      window -height *** windowName;
      window -widthheight *** *** windowName;
      window -topEdge *** windowName;
      window -leftEdge *** windowName;
      window -topLeftCorner *** windowName;




-popup windows

      promptDialog
      confirmDialog


******************************************************************************************************
                          The example below creates a fully functional window
******************************************************************************************************

{
	string $my[] = `ls -sl`;
	
	int $mysize = size($my);
	
	if ($mysize > 1)
	error ("please select only one obj");
	if ($mysize < 1)
	error ("please select an obj");
	
	string $myattX = $my[0] + ".sx";
	string $myattY = $my[0] + ".sy";
	string $myattZ = $my[0] + ".sz";
	
	window myWin1;
	columnLayout;
	attrFieldSliderGrp -min 0 -max 10 -at $myattX;
	attrFieldSliderGrp -min 0 -max 10 -at $myattY;
	attrFieldSliderGrp -min 0 -max 10 -at $myattZ;
	showWindow myWin1;
}
<Top>