string $d=`internalVar -usd`;
string $dialog = `loadUI -uiFile ($d+"/test.ui")`;
showWindow $dialog;
Now select the code and hit CTRL+Enter to execute it. congratullation, your interface will be opened. But wait a minute, we still can see the spin box and that's not good. We don't need it. Now how can we hide it in QT? The answer is simple, select it in QT designer and in property editor change the hight and wide to 1 ! This way we hide it from others in view port. The picture below shows the same UI in Maya with a little change in place for some elements. As you can see, changing the dial and horizontal slider changes the text of the line edit control. Now you can use textField command and refer to these controls to query the text and put it in integer values. What if you need float values when sliding the slider? The answer is simple, you can change the command in -dc. Change the min and max value to 0 and 100 and add /100 after #1. Now openning UI in Maya and dragging horizontal slider, you can see that the text box will show you float number between 0 and 1 ! (I didn't do this step in picture below but I hide the spin box, the one you see is the double spin box that do nothing until you connect it to something.)

Now what if I want to make my UI dockable? Add the code below after your current code in script editor.
string $layout1=`paneLayout -cn "single" -p $gMainWindow`;
dockControl -aa "all" -a "right" -fl off -con $layout1 -l "MainWindow";
control -e -p $layout1 $dialog;
Now select your code and hit CNTL+Enter to execute it. Congratullation. Now you have a dockable UI that works in Maya. Now you can go and add your own controls and make your progress in Maya. If you had any question ask me by email to ali <at> cgfx3d <dot> com.
Have fun.
Author: css_maya
Submitted: 2010-05-04 13:15:19 UTC
Tags:
Software: Maya
Views: 87,643
Related Items
-
designer stool with sculpted seat 3D Model
$24.99 (USD) -
Designer Italian Armchair 3D Model
$29.00 (USD) -
iPod MP3 player collection for Maya 3D Model
$49.00 (USD) -
aXYZ design - AMan0001-Wa / 3D Human for superior visualizations 3D Model
$18.00 (USD) -
aXYZ design - AMan0001-Wa2 / 3D Human for superior visualizations 3D Model
$18.00 (USD) -
aXYZ design - AMan0002-St / 3D Human for superior visualizations 3D Model
$18.00 (USD) -
aXYZ design - AMan0002-Wa / 3D Human for superior visualizations 3D Model
$18.00 (USD) -
aXYZ design - AMan0003-St / 3D Human for superior visualizations 3D Model
$18.00 (USD) -
aXYZ design - AMan0003-St2 / 3D Human for superior visualizations 3D Model
$18.00 (USD)









