PDA

View Full Version : MEL - Maya UI Building


Pages : 1 [2]

splinta
05-13-2010, 09:38 AM
Hi

So I feel really stupid about this but here goes anyway. I'm building a UI with MEL. Now the structure and layout I can do now problem. The only thing that I can't figure out is how to connect input information. For example if I have a intSliderGrp, how do I pull the values out of it and plug it into somewhere else.

Here's an example of my script, please help.

global proc showMyWindow()
{
if ( `window -exists myWindow` ) {
deleteUI myWindow;
}
window
-title "Multiple texture bake"
-resizeToFitChildren true
-width 300
myWindow;

columnLayout;

columnLayout -adjustableColumn true -rowSpacing 8;
text -label "Setup render settings to required render specs";
button -label "Render Globals"
-command unifiedRenderGlobalsWindow;
setParent ..;
setParent ..;




columnLayout;
text -l "Texture Resolution";
intSliderGrp -label "Width"
-value 1024
-field true
-minValue 512 -maxValue 4096
-fieldMinValue 512 -fieldMaxValue 4096
textureWidth;
intSliderGrp -label "Height"
-value 1024
-field true
-minValue 512 -maxValue 4096
-fieldMinValue 512 -fieldMaxValue 4096
textureHeight;



setParent ..;
setParent ..;


showWindow myWindow;
}

showMyWindow();

ewerybody
05-13-2010, 10:15 AM
hi @splinta: You just query the named controls. Beware that control names are always global! That means... I could well think that someone else or any control in Maya comes up with the name "textureWidth". So I'd always suggest to name things like "splinta_textureWidth" "splinta_textureHeight" ... you get me.

now in your "run-command" you'd just call:
$width = `intSliderGrp -q -value textureWidth`;

If you want to pass a value to another control or even put it in optionVars I always use the change or drag command on creation with the #-operator that passes the current value into the command string:

intSliderGrp -changeCommand "optionVar -iv splinta_textureWidth #1;" textureWidth;

or

intSliderGrp -dragCommand "intField -e -v #1 splinta_extraTextureHeightControl" textureHeight;

or

intSliderGrp -dragCommand "myCommandThatDoesSomethingWithTheValueOnDrag #1" textureHeight;

global proc myCommandThatDoesSomethingWithTheValueOnDrag (int $value)
{
print $value;
}

instead of #1 you could always put in "intSliderGrp -q -v nameOfControl". But in the moment you create it it knows its name so #1 is possible. Even you would't have to know its name that way!

splinta
05-13-2010, 10:36 AM
Thanks ewerybody (http://forums.cgsociety.org/member.php?u=43738)

That really cleared things up. All the stuff I've read just assumes that I would know how to do it.

:D

splinta
05-14-2010, 07:22 AM
hi @splinta: You just query the named controls. Beware that control names are always global! That means... I could well think that someone else or any control in Maya comes up with the name "textureWidth". So I'd always suggest to name things like "splinta_textureWidth" "splinta_textureHeight" ... you get me.

now in your "run-command" you'd just call:
$width = `intSliderGrp -q -value textureWidth`;

If you want to pass a value to another control or even put it in optionVars I always use the change or drag command on creation with the #-operator that passes the current value into the command string:

intSliderGrp -changeCommand "optionVar -iv splinta_textureWidth #1;" textureWidth;

or

intSliderGrp -dragCommand "intField -e -v #1 splinta_extraTextureHeightControl" textureHeight;

or

intSliderGrp -dragCommand "myCommandThatDoesSomethingWithTheValueOnDrag #1" textureHeight;

global proc myCommandThatDoesSomethingWithTheValueOnDrag (int $value)
{
print $value;
}

instead of #1 you could always put in "intSliderGrp -q -v nameOfControl". But in the moment you create it it knows its name so #1 is possible. Even you would't have to know its name that way!

Ok cool. So I've got 2 more questions: 1. Do I have to define my variables in every proc or will they run through the whole script?
2. Will the variables only be activated / defined once the proc is called?

The reason I'm asking is because I have a variable: string $selection = `ls - sl`; in a procedure that runs when I click a button when I run the script, I get an error saying :

Error: sting $selection = `ls -sl`;
//
// Error: line 41.19: "$selection" is an undeclared variable. //

Very confused!!

NaughtyNathan
05-14-2010, 08:45 AM
variables only exist inside the scope they are declared in, and in MEL, scope is started with a { and ended with a }.

for example:

global proc something()
{ // this is the start of a new scope!
string $var = "hello!";
string $sel[] = `ls -sl`;
for ($obj in $sel)
{ // this is the start of another new scope!!
string $newName = ($obj+"_new");
print ($newName+"\n");
} // this is the END of the most recent scope!
// the variable "$newName" no longer exists!
} // this is the end of the proc scope!
// now NO variables exist (apart from any that are global!)



if you want your procs to refer to variables defined OUTSIDE of them you should ideally pass them in as parameters:

global proc something(string $sel[])
{
for ($obj in $sel)
{
string $newName = ($obj+"_new");
print ($newName+"\n");
}
}

:nathaN

splinta
05-17-2010, 10:00 AM
thanks every1 for the help.

learning slowly but surely. can any1 tell me how can I call up the material that is assigned to an object? For renaming but it needs to be open ended, i.e. no matter what material or name. I found a way to do it by making another material but selecting 1 from an object is proving difficult. I tried a pick walk approach but with no luck.

Pyrokinesis
05-17-2010, 11:49 AM
Try checking the connections. Open up the hyper graph and graph all connections. This will tell you what your node is connected to and how.

splinta
05-17-2010, 12:43 PM
Try checking the connections. Open up the hyper graph and graph all connections. This will tell you what your node is connected to and how.

Hi
I attached an example of what I'm trying to achieve. I understand the flow of the nodes but how to put it into code is a mystery. The other part is that I need the Mel to be independent of naming as the names will not always be the same. Was thinking of using variables from this purpose unless there is another way of doing it. What I have managed to achieve is renaming the original object and its shape.

splinta
05-17-2010, 01:50 PM
Hi all!
I am newbe on mel. This is simple i would like to tear off a window panel with a camera in the scene, it is a camera for the face of a character, any idea? Thanks

Hi try this:

window;
panelayout;
modelPanel -cam perspective; // or whatever camera name you have
showWindow;



for info on each command type "help" then the command in script Editor for the flags

ewerybody
05-17-2010, 02:34 PM
... I need the Mel to be independent of naming as the names will not always be the same. Was thinking of using variables from this purpose unless there is another way of doing it...He Splinta! Variables are great! :D

you don't know how often this question already arised? Does it have to be Mel?
here (http://forums.cgsociety.org/showpost.php?p=6470023&postcount=5) we posted a python solution. But okok here (http://forums.cgsociety.org/showthread.php?f=89&t=841689) its with Mel as well.

But actually this is not much about UI peeps ;] open up a new thread if you have specific non UI things please!! This thread was actually more about insights and tips than questions.

ChristerMN
05-20-2010, 05:49 PM
I am trying to make a window with 2 buttons that you can click that either gives you a car or a bike, then you input a start frame and an end frame of how long you want your animation to be, but i need a way to communicate what the user inputs as a start frame and as an end frame so that there are keyframes in place and the car/bike is moving forward until the specified end frame.

=LuxX=
06-17-2010, 11:21 AM
Hi all Im trying to make a second tab in my script but i keep getting the error:
ModelEdMenu modelEditor1;

// Error: line 225: Object is not a child: MyWindow|tabLayout //


now the funny thing is ... line 225 is empty :)
on line 226 there is

$tabEen;


ill past my script here.. ( i left all the unimportand stuff out so this wont be to long to read)

if some one knows where i did something wrong.. please help :)

if ( `window -exists MyWindow` )
{ deleteUI MyWindow; }
window -s 0 -t "controls" MyWindow;



string $tabs = `tabLayout -innerMarginWidth 0 -innerMarginHeight 0 tabLayout"`;

string $tabEen= `formLayout -numberOfDivisions 100 "settings"`;

/////////////////////////////////
/////////////////////////////////VIEUWS

string $vieuwScreen = `modelEditor -displayAppearance smoothShaded -cam front -dtx on -gr off -alo on -nc off -pm on`;

string $camsettings = `text "CAMERA settings"`;
string $wireshade =`button -label "Wireframe"
-command ("modelEditor -edit -displayAppearance wireframe " + $vieuwScreen)`;
string $Flatshade = `button -label "Flat Shaded"
-command ("modelEditor -edit -displayAppearance smoothShaded " + $vieuwScreen)`;


radioCollection;

string $persCam = `radioButton -label "Perspective"
-cc ("modelEditor -edit -cam persp " + $vieuwScreen)`;

string $frontCam = `radioButton -label "Side"
-cc ("modelEditor -edit -cam front " + $vieuwScreen)`;

string $topCam = `radioButton -label "Top"
-cc ("modelEditor -edit -cam top " + $vieuwScreen)`;

string $sideCam = `radioButton -label "Front"
-cc ("modelEditor -edit -cam side " + $vieuwScreen)`;

string $BackCam = `radioButton -label "Back"
-cc ("modelEditor -edit -cam Back " + $vieuwScreen)`;



string $ImgLogoBottom = `image -image "S:/Ani Program/BMP/LogoBottem.bmp" -w 1700 -h 50`;

setParent..;

/////////////////////////////////
/////////////////////////////////TAB 2

string $tabTwee = `formLayout "Movement"`;

string $ImgTurnDown = `image -image "S:/Ani Program/BMP/turnDownArrow.bmp" -w 80 -h 50`;

setParent..;

/////////////////////////////////
///////////////////////////////// FORMLAYOUT

formLayout -edit

here i have the complete form stuff of tab 1

$tabEen;

////////////////////////////////////
////////////////////////////////////TAB2

formLayout -edit

-af $ImgTurnDown "top" 500
-af $ImgTurnDown "left" 200

$tabTwee;

tabLayout -edit -tabLabel $tabEen "Settings" -tabLabel $tabTwee "Movement"

$tabs;

showWindow;

NaughtyNathan
06-17-2010, 02:32 PM
Hey LuxX, always make sure you don't just look at the LAST error message Maya returns as it may simply be due to an earlier error. The code you posted has a syntax error on line 6 (a " at the end of the line that shouldn't be there).

string $tabs = `tabLayout -innerMarginWidth 0 -innerMarginHeight 0 tabLayout"`;


If you remove and fix this and re-run it it all works fine.
:nathaN

=LuxX=
06-17-2010, 03:09 PM
Thnx mate for your response... but that is not the problem. when i change it i still get an error.

// Error: line 230: Object is not a child: MyWindow|tabLayout //

I tryed to learn this from a other script someone wrote but he has:
string $tabs = `tabLayout -innerMarginWidth 0 -innerMarginHeight 0 "tabLayout"`;

with the " "?

well for today i've had it.. tomorrow i'll have a fresh look at it :)

thnx again tho

NaughtyNathan
06-17-2010, 04:40 PM
well it works fine for me, so the error must be in the bits of code you didn't post..?
:nathaN

=LuxX=
06-18-2010, 07:12 AM
This is my full code.. ( without the procs they are writen global) or could it be that 1 of those procs is wrong ( they do work )

ive read this over and over but cant find any missing ; " () or what ever...


/////////////////////////////////
/////////////////////////////////WINDOW / TAB 1

if ( `window -exists MyWindow` )
{ deleteUI MyWindow; }
window -s 0 -t "controls" MyWindow;

string $tabs = `tabLayout -innerMarginWidth 0 -innerMarginHeight 0 "tabLayout"`;
string $tabEen= `formLayout "settings"`;

/////////////////////////////////
/////////////////////////////////CHECK IF BOAT IS THERE, IF NOT IT WILL BE IMPORTED

importproc;

/////////////////////////////////
/////////////////////////////////IMPORT MODULES THIS CAN BE TOPSIDES JACKETS OR ANYTHING ELSE.

string $impModule = `button -l "Import Module" -c ImportingModule`;

/////////////////////////////////
/////////////////////////////////IMPORT SEABED THIS GIVES YOU THE OPPERTUNITY TO PUT A SEABED IN YOUR SCENE

string $impSeabed = `button -l "Import Seabed" -c importSeabed`;

/////////////////////////////////

/////////////////////////////////IMPORT OCEAN GIVE YOU THE OPERTUNITY TO IMPORT OCEANS THERE ARE DIFFERENT OCEANS FOR DIFFERENT LOCATIONS

string $impOcean = `button -l "Import Ocean" -c importOcean`;

/////////////////////////////////
/////////////////////////////////SET HEIGHT OF THE WATERLEVEL

string $OceanHeight =`floatFieldGrp -l "Ocean height" -cc "OceanHeightProc()" -extraLabel "m"`;

/////////////////////////////////
/////////////////////////////////SET THE HEIGHT OF THE SEABED

string $SeabedHeight= `floatFieldGrp -label "Seabed height" -cc "SeabedHeightProc()" -extraLabel "m"`;

/////////////////////////////////
/////////////////////////////////HOOKS

string $menutje = `optionMenu -label "Hooks" -changeCommand "-select #1"`;

menuItem -label "Mhook";
menuItem -label "Aux_1";
menuItem -label "Aux_2";
menuItem -label "Lip_block";

/////////////////////////////////
/////////////////////////////////CRANE LIFT

string $craneAngleLtext = `text -l "Crane angle"`;
string $BoomAngleLtext = `text -l "Boom angle"`;
string $craneLifttext = `text -l "Lift"`;

string $floatFieldLiftCrane = `floatField -minValue -360 -maxValue 360 -cc " floatLiftCrane()"`;

/////////////////////////////////
/////////////////////////////////BOOM LIFT

string $floatFieldLiftBoom = `floatField -minValue -5 -maxValue 78.68 -cc "floatLiftBoom()"`;

/////////////////////////////////
/////////////////////////////////ANIMATION TIME

float $sliderValue[];
string $tijdField = `floatFieldGrp -l "Animation time in sec"
-cc "currentTime (#1 + \"sec\");playbackOptions -edit -max (#1 + \"sec\");"` ;

/////////////////////////////////
/////////////////////////////////CRANE SET

string $craneSettext = `text -l "Set"`;
string $floatFieldSetCrane = `floatField -minValue -360 -maxValue 360 -cc " floatSetCrane()"`;

/////////////////////////////////
/////////////////////////////////BOOM SET

string $floatFieldSetBoom = `floatField -minValue -5 -maxValue 78.68 -cc "floatSetBoom()"`;

/////////////////////////////////
/////////////////////////////////BUTTONS

string $playMov = `button - l "PLAY/STOP" -c "playButtonForward"`;
string $rewMov = `button -l "REWIND" -c "playButtonStart"`;
string $player = `button -l "Create movie" -c "performPlayblast 3"`;
string $cancel = `button -l "cancel" -c -cl `;
string $undoer = `button -l "Undo" -c Undo `;

/////////////////////////////////
/////////////////////////////////VIEUWS

string $vieuwScreen = `modelEditor -displayAppearance smoothShaded -cam front -dtx on -gr off -alo on -nc off -pm on`;

string $camsettings = `text "CAMERA settings"`;
string $wireshade =`button -label "Wireframe"
-command ("modelEditor -edit -displayAppearance wireframe " + $vieuwScreen)`;

string $Flatshade = `button -label "Flat Shaded"
-command ("modelEditor -edit -displayAppearance smoothShaded" +$vieuwScreen)`;

radioCollection;

string $persCam = `radioButton -label "Perspective"
-cc ("modelEditor -edit -cam persp " + $vieuwScreen)`;

string $frontCam = `radioButton -label "Side"
-cc ("modelEditor -edit -cam front " + $vieuwScreen)`;

string $topCam = `radioButton -label "Top"
-cc ("modelEditor -edit -cam top " + $vieuwScreen)`;

string $sideCam = `radioButton -label "Front"
-cc ("modelEditor -edit -cam side " + $vieuwScreen)`;

string $BackCam = `radioButton -label "Back"
-cc ("modelEditor -edit -cam Back " + $vieuwScreen)`;

 

string $ImgLogoBottom = `image -image "S:/Ani Program/BMP/LogoBottem.bmp" -w 1700 -h 50`;

setParent..;

/////////////////////////////////
/////////////////////////////////TAB 2

string $tabTwee = `formLayout "Movement"`;
string $ImgTurnDown = `image -image "S:/Ani Program/BMP/turnDownArrow.bmp" -w 80 -h 50`;
string $ImgTurnUp = `image -image "S:/Ani Program/BMP/turnDownArrow.bmp" -w 80 -h 50`;
string $ImgArrowleft = `image -image "S:/Ani Program/BMP/Left_arrow.bmp" -w 50 -h 50`;
string $ImgArrowRight = `image -image "S:/Ani Program/BMP/right_arrow.bmp" -w 50 -h 50`;
string $ImgArrowUp = `image -image "S:/Ani Program/BMP/up_arrow.bmp" -w 50 -h 50`;
string $ImgArrowDown = `image -image "S:/Ani Program/BMP/Down_arrow.bmp" -w 50 -h 50`;

setParent..;

/////////////////////////////////
///////////////////////////////// FORMLAYOUT

formLayout -edit

-attachForm $tabs "top" 0
-attachForm $tabs "left" 0

-attachForm $tabs "bottom" 0
-attachForm $tabs "right" 0

-attachForm $craneAngleLtext "top" 55
-attachForm $craneAngleLtext "left" 50

-attachForm $BoomAngleLtext "top" 85
-attachForm $BoomAngleLtext "left" 50

-attachForm $floatFieldLiftCrane "top" 50
-attachForm $floatFieldLiftCrane "left" 110

-attachForm $floatFieldLiftBoom "top" 80
-attachForm $floatFieldLiftBoom "left" 110

-attachForm $craneLifttext "top" 35
-attachForm $craneLifttext "left" 130

-attachForm $craneSettext "top" 35
-attachForm $craneSettext "left" 200

-attachForm $floatFieldSetCrane "top" 50
-attachForm $floatFieldSetCrane "left" 180

-attachForm $floatFieldSetBoom "top" 80
-attachForm $floatFieldSetBoom "left" 180

-af $tijdField "top" 10
-af $tijdField "left" 20

-attachForm $playMov "bottom" 50
-attachForm $playMov "right" 90

-attachForm $rewMov "bottom" 50
-attachForm $rewMov "right" 30

-attachForm $undoer "bottom" 50
-attachForm $undoer "right" 170

-attachForm $player "bottom" 100
-attachForm $player "right" 90

-attachForm $cancel "bottom" 100
-attachForm $cancel "right" 30

-attachForm $camsettings "top" 200
-attachForm $camsettings "left" 5

-attachForm $vieuwScreen "top" 110
-attachForm $vieuwScreen "left" 110

-attachForm $vieuwScreen "bottom" 110
-attachForm $vieuwScreen "right" 310

-attachForm $wireshade "top" 360
-attachForm $wireshade "left" 5

-attachForm $Flatshade "top" 390
-attachForm $Flatshade "left" 5

-attachForm $persCam "top" 220
-attachForm $persCam "left" 5

-attachForm $topCam "top" 240
-attachForm $topCam "left" 5

-attachForm $frontCam "top" 260
-attachForm $frontCam "left" 5

-attachForm $sideCam "top" 280
-attachForm $sideCam "left" 5

-attachForm $BackCam "top" 300
-attachForm $BackCam "left" 5

-attachForm $impModule "top" 80
-attachForm $impModule "left" 1610

-af $OceanHeight "top" 140
-af $OceanHeight "right" 0

-attachForm $impOcean "top" 140
-attachForm $impOcean "left" 1610

-af $SeabedHeight "top" 110
-af $SeabedHeight "right" 0

-attachForm $impSeabed "top" 110
-attachForm $impSeabed "left" 1610

-attachForm $menutje "top" 80
-attachForm $menutje "right" 50

-af $ImgLogoBottom "bottom" 30
-af $ImgLogoBottom "left" 0

$tabEen;

////////////////////////////////////
////////////////////////////////////TAB2

formLayout -edit

-af $ImgTurnDown "top" 200
-af $ImgTurnDown "left" 500

-af $ImgTurnUp "top" 700
-af $ImgTurnUp "left" 700

-af $ImgArrowleft "top" 450
-af $ImgArrowleft "left" 250

-af $ImgArrowRight "top" 450
-af $ImgArrowRight "right" 250

-af $ImgArrowUp "top" 200
-af $ImgArrowUp "left" 500

-af $ImgArrowDown "bottom" 200
-af $ImgArrowDown "left" 500

$tabTwee;

tabLayout -edit
-tabLabel $tabEen "Settings"
-tabLabel $tabTwee "Movement"
$tabs;

showWindow;

NaughtyNathan
06-18-2010, 09:33 AM
LuxX, the error is in your formLayout.

You've created a top level tabLayout called $tabs, then you created two children of this tabLayout, formLayouts: $tabEen and $tabTwee.

Your error is that you have tried to layout $tabs inside the formLayout $tabEen. This is clearly invalid as the tabLayout $tabs is the parent of $tabEen.

You need to remove the four lines:

-attachForm $tabs "top" 0
-attachForm $tabs "left" 0

-attachForm $tabs "bottom" 0
-attachForm $tabs "right" 0
if you wanted the parent tabLayout to be formLayout-ed to the window edges you would need to create a brand new formLayout above the tabLayout and add these deleted lines at the end, but it's probably not necessary as the tabLayout should automatically fill the window in the absence of any higher layout directives.

Also, if you are going to make your windows NON-sizeable (-s 0), make sure you specify an initial window size!! your code creates a window nearly 2000 pixels wide on my setup! :D

:nathaN

=LuxX=
06-18-2010, 10:40 AM
hi nathan,

it worked :) thnx for the help. i get what you explained to me. stupid i didnt find that my self :P ... ( but that s what you get when you try to learn from other scripts .. you also copy the wrong things :P )

and the stuff with the 2000 pixels could be right.. since i use a full HD screen and i want the window to be at the max of my screen. ( like full screen )
So i gues thats why its also that big when you open it?

but still thnx allot .. now i finaly can fill in the second tab.

ArrantSquid
07-19-2010, 07:31 AM
I'm not sure how many folks or studios have made the jump to Maya 2011, but one of the things that frustrated me going into 2011 was making UI's with QT. I'd never used it before and while setting it up was simple enough, none of the accessible interface items was listed in the Maya Help. So I threw together a quick tutorial on how Maya interfaces with QT's .ui file and how the Mel commands can be accessed through it. It's not exhaustive by any means, but I figured it may help someone else out who's trying to start as I was.

http://bit.ly/98NutD

If there are errors on anything, please let me know. I tested it thoroughly, but when you're in the groove you miss stuff. Hope it helps someone.

Mcatchan
07-19-2010, 01:22 PM
Hi i was about to make a new thread then i saw this about UI so I figured the answer to my question might be interesting in this post. I made a short script to create some rotations to simulate some wind in tree leaves,

proc applyExpressionToSelection(){
string $sel[] = `ls -sl`;
for($object in $sel){
expression -s ("float $timeStamp = sin (time * .8) * 1.5; " +
$object + ".rotateZ = $timeStamp") -o $object -ae 1 -uc all;
}
}
applyExpressionToSelection();

that worked nicely then i realised to be able to make this a little more random it would be nice to change the values time is multiplied by, also this being directed at ppl who never use mel, i made a little UI, (my first attempt at scripting one but then things got a little too complicated); After a lot of trial and error I found a very similar script to what i'm trying to do at the bottom of : http://forums.cgsociety.org/archive/index.php/t-153797.html and worst case I could just use that instead, but I'd like to know why my script isn't working if anyone can help me out, the problems seems to be I can't efficiently use the values from my sliders in the expression creation... but i don't understand where I got it wrong. I determined this piece of code works fine if I declare the variables with the following value :


proc applyExpressionToSelection(){
float $speed_factor = 2;
float $rotation_float = 2;
string $sel[] = `ls -sl`;
for($object in $sel){
expression -s ($object + ".rotateZ = sin (time *" + $speed_factor + ")*" + $rotation_float + ";") -o $object -ae 1 -uc all;
}
};

However that means I'm stuck with value 2 and 2, so here is the whole code with the UI if anyone knows what I didn't do right, I'd be grateful for the help. All I get is // Error: but I don't know from what ...


//expression creation rotateZ with sin(time) and some multipliers

global proc applyExpressionWind()
{
float $speed_factor;
float $rotation_float;

$speed_factor = `floatSliderGrp -q -v speedFactor` ;
$rotation_float = `floatSliderGrp -q -v rotationFloat` ;

string $sel[] = `ls -sl`;

for($obj in $sel){
expression -s ($obj + ".rz = sin(time *" + $speed_factor + ")*" + $rotation_float + ";") -o $obj -ae 1 -uc all;
}
};



//UI

global proc windTree_UI()
{


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

$all_selected_objects =`ls -selection`;

window -widthHeight 300 200 -resizeToFitChildren 1 -title "Wind in trees" treewindow;

columnLayout -adjustableColumn true;


$obj_name_text =
`textField
-editable 0
-width 400
-text $all_selected_objects `;

separator -height 20 -width 120;

text -label "Choose two time multipliers, try keep the values between 0.5 and 5.0";

$speedFactor =
`floatSliderGrp
-minValue -5
-maxValue 5
-fieldMinValue -5
-fieldMaxValue 5
-field 1
-label "Speed"
`;

$rotationFloat =
`floatSliderGrp
-value 1.0
-minValue 1.0
-fieldMinValue 1.0
-field 1
-label "Rotation"
`;

separator -height 20 -width 120;

$execution_button=
`button
-label "Execute!"
-command " applyExpressionWind();"`;


$button_close=
`button -label "Close" -command "deleteUI treewindow"`; showWindow;

};

Edit : I figured out what was wrong after modifying many things, and considering the amount of time spent on this I'll post the answer here for anyone who has the same problem


the section with the sliders is now written as :

floatSliderGrp
-minValue -5
-maxValue 5
-fieldMinValue -5
-fieldMaxValue 5
-field 1
-label "Speed"
speedFactor;

floatSliderGrp
-value 1.0
-minValue 1.0
-fieldMinValue 1.0
-field 1
-label "Rotation"
rotationFloat;

The rest of the code is the same.

Xinos
11-25-2010, 07:34 PM
I'm sorry if this has been asked already, but I haven't found any real solution to this.
In Maya version 2009 and older, is there a good way of automatically setting the window height based on the content of the gui? I use collapsaeble frameLayouts, so I want the window to shrink when they are collapsed. Also a check of this kind would be useful for overriding windowPrefs.mel

In 2011 this is not a problem as it adjusts window height automatically. But there's another problem and that is that I get different heights from the frameLayouts in 2009 and 2011, so I can't use that to add and subtract from the window height. Unless I have some kind of version checker, but I don't know how to do that. Don't want to split it into two scripts either, but I might have to?

Buexe
11-25-2010, 07:50 PM
I am afraid there is no easz solution to this, you can use the "about" command to check the maya version.

ArrantSquid
11-25-2010, 11:12 PM
Not sure about the former of your issues, but a version checker is fairly easy.


if (getApplicationVersionAsFloat() <= 2009){
print "Do stuff for 2009 versions and lower";
}else{
print "Do stuff for anything over 2009";
}

Andrei2k
11-27-2010, 10:50 AM
Here's an example for equal to a version (5) between two versions or a range and greater than:

string $version = `about -v`;
string $versionBuffer[];

tokenize $version "." $versionBuffer;

$version = $versionBuffer[0] + "." + $versionBuffer[1];

float $versionFloat;

if ($versionFloat == 5.0)

$doThis = 6;

else if ($versionFloat >= 7.0 && $versionFloat <= 2010.0)

$doThis = 5;

else if ($versionFloat >= 2011)

$doThis = 3;

return $operationType;

Xinos
12-14-2010, 08:33 PM
Thanks! I decided the easiest way to do this was to just set window size to changeable when in 2009 or bellow. Too much work trying to calculate what the correct window size should be.

I have a more specific UI question if you don't mind. My script has an interface like this:
global proc Demo(){
if(`window -exists DemoUI`){
deleteUI DemoUI;
}

window -s 1 -title ("Demo") DemoUI;
frameLayout -label "Super Frame" MainFrameLayout;
columnLayout MainColumn;

//Frame 1
frameLayout -label "Layout 1" -collapsable 1 layoutUVM;
columnLayout ;
rowLayout -cw2 108 108 -numberOfColumns 2;
button -label "One" -width 108 UpButton;
button -label "Two" -width 108 DownButton;
setParent ..;
rowLayout -cw2 108 108 -numberOfColumns 2;
button -label "Three" -width 108 LeftButton;
button -label "Four" -width 108 RightButton;
setParent ..;
setParent ..;
setParent ..;

//Frame 2
frameLayout -label "layout 2" -collapsable 1;
columnLayout ;
rowLayout -cw2 108 108 -numberOfColumns 2;
button -label "One" -width 108 UpButton;
button -label "Two" -width 108 DownButton;
setParent ..;
rowLayout -cw2 108 108 -numberOfColumns 2;
button -label "Three" -width 108 LeftButton;
button -label "Four" -width 108 RightButton;
setParent ..;
setParent ..;
setParent ..;

//Frame 3
frameLayout -label "layout 3" -collapsable 1;
columnLayout ;
rowLayout -cw2 108 108 -numberOfColumns 2;
button -label "One" -width 108 UpButton;
button -label "Two" -width 108 DownButton;
setParent ..;
rowLayout -cw2 108 108 -numberOfColumns 2;
button -label "Three" -width 108 LeftButton;
button -label "Four" -width 108 RightButton;
setParent ..;
setParent ..;
setParent ..;
showWindow DemoUI;
}
Demo();

What I can't figure out is how to vertically split the window into two rows, so i have all of these rowLayouts and buttons on the left side, and other things such as an attached panel to the right. Like the hyperShade is split with a list of shaders on the left and then the workspace to the right.

NaughtyNathan
12-14-2010, 09:00 PM
Erik, you need to use a paneLayout or more likely a formLayout.
:nathaN

Xinos
12-16-2010, 03:31 PM
I got it working now, but only in m2011. In 2009 the same script complains about my first framelayout having too many children.. :-\

ruchitinfushion
01-04-2011, 02:32 PM
Can i get tuts for Nokia QT to make UI for Maya ?
Thanx in Adv

fantasizer
01-20-2011, 07:40 AM
I've got a tool jc.menu (http://sites.google.com/site/cgriders/jc/menu) which can let you create menu without writing code.

bnrayner
01-28-2011, 10:11 PM
I have been trying to create a python maya UI with a file browse directory button... is there a preferred command to do this?

perhaps textFieldButtonGrp()?
or attrNavigationControlGrp()?
or something else?

bnrayner
01-28-2011, 10:31 PM
I have been trying to create a python maya UI with a file browse directory button... is there a preferred command to do this?

perhaps textFieldButtonGrp()?
or attrNavigationControlGrp()?
or something else?

jiyongman
01-31-2011, 10:12 AM
Anybody knows how to get the shader icon image from hypershade or attribute editor???

Or is there any way to get a snap shot of it???

We already know we could get some image from view port using playblast command

but this is beyond it.

Please help, or give any fresh idea to get there..

goleafsgo
01-31-2011, 11:52 PM
Anybody knows how to get the shader icon image from hypershade or attribute editor???

Or is there any way to get a snap shot of it???

We already know we could get some image from view port using playblast command

but this is beyond it.

Please help, or give any fresh idea to get there..

I think the &quot;saveSwatchesCmd&quot; in the devkit does what you want. It creates a swatchDisplayPort and then saves an image of it. This might only work in Maya 2011 though...

jiyongman
02-01-2011, 04:07 AM
Is it the only way????

My maya version is 2009, you know...

(if this is just for personal use, I could upgrade to 2011, but it's not..)

Thanks for your reply though,

this information will help me some day in the future :)


I think the &quot;saveSwatchesCmd&quot; in the devkit does what you want. It creates a swatchDisplayPort and then saves an image of it. This might only work in Maya 2011 though...

jiyongman
02-11-2011, 02:15 AM
I tried to put layoutDialog window to desired position but only to fail.

I think layoutDialog has very limited options to control..

For example, in order to control the size of it, I had to use the 'formLayout size flag'..

About the position however, I'm still not able to deal with it.

Help me guys, please!!!

Ps. the reason why I try to control the position is, it's because it appears in different position in Maya 2011 compare to version 2009.

cgbeige
02-11-2011, 02:56 AM
just a note for Mac users that I just made an OS X Service to pass selected text to Maya, in any Cocoa based text editor (BBEdit, TextEdit, Textwrangler, Coda, etc).

http://polygonspixelsandpaint.tumblr.com/post/3226414038

Requires OS X 10.6 and above

nottoshabi
02-11-2011, 03:14 AM
I tried to put layoutDialog window to desired position but only to fail.

I think layoutDialog has very limited options to control..

For example, in order to control the size of it, I had to use the 'formLayout size flag'..

About the position however, I'm still not able to deal with it.

Help me guys, please!!!

Ps. the reason why I try to control the position is, it's because it appears in different position in Maya 2011 compare to version 2009.


I have a lot of issues with scripts that wont work or display properly in 2011. I think most of the code was rewritten for 2011. If some one from AutoDesk could shine in with info as to what was rewritten or how to fix or work around the issues would be great. As for your problem i was not able to find the solution ether.

ewerybody
02-12-2011, 08:39 AM
layoutDialog probably works like the other dialogs promptDialog and confirmDialog: you can't make it appear at a certain position. It always pops up in the middle of the top Maya window.

And the size thing is just normal. Istn't it described that way in the docs (http://download.autodesk.com/us/maya/2009help/CommandsPython/layoutDialog.html) already? :D you are doing it right!

I have no experience with 2011 so far. Alas!

jiyongman
02-16-2011, 12:38 AM
Thank you for your reply nottoshabi, ewerybody~:)

jiyongman
02-21-2011, 05:36 AM
Hey guys,

I got one Normalized Normal Vector(Average) << 0.47548, 0.80906, -0.345457 >> using polyNormalPerVertex command.

I want rotation values from above to match an object's rotation.

Someone told me I could do it using acos, and asin after projecting on a plane, but I don't understand what it means.

Could anyone expain this specifically? (of course, an example will help a lot!!

For your information, I'm really bad at math)

Or, is any other ideas to accomplish what I want??


Ps. sorry for posting that has nothing to do with UI thing, but I post this here because I see some guys very experienced here, and I hope they will see this article.

ewerybody
02-21-2011, 08:05 AM
Ps. sorry for posting that has nothing to do with UI thing, but I post this here because I see some guys very experienced here, and I hope they will see this article.Thats no excuse for misusing the forum. Open a thread. Thats what its for!

jiyongman
02-22-2011, 12:24 AM
Thats no excuse for misusing the forum. Open a thread. Thats what its for!

You're right, sorry for the mess :)

thematt
02-23-2011, 10:41 AM
edit: remove post 'cause wrong section..sorry

Geuse
02-28-2011, 01:35 PM
I want to add a tabLayout to my window to add more functions to my script. Seems simple enough, but I just can't get it to work properly!
Been trying to figure it out for too long and rewrtiting it. Started from scratch a bunch of times but I just can't seem to get it right so hopefully there's someone who could help me out here?!


if (`window -q -ex alignWin`)
{
deleteUI alignWin;
}

window -w 230 -h 60 -t "Dag's Align UI" alignWin;

string $masterForm = `formLayout`;
string $mainCol = `columnLayout -adj 1`;

setParent $masterForm;

string $mainForm = `formLayout`;
setParent $masterForm;




rowLayout -numberOfColumns 3
row2;
setParent $mainCol;








separator -h 10 -st none;

$avg = `checkBoxGrp
-cal 1 center
-l "Average"
-v1 0
-on1 ""
-of1 ""
`;


separator -h 10 -st none;
setParent row2;



setParent $mainCol;

setParent $mainForm;







string $btn1 = `button -l ("X")
-c ""`;

string $btn2 = `button -l ("Y")
-c ""`;

string $btn3 = `button -l ("Z")
-c ""`;

string $btn4 = `button -l ("-X")
-c ""`;

string $btn5 = `button -l ("-Y")
-c ""`;

string $btn6 = `button -l ("-Z")
-c ""`;

string $btn7 = `button -l ("planarize")
-c ""`;


int $rowHeight = 33;
int $border = 5;

formLayout -e

-af $mainCol "top" 0

-af $mainCol "left" 0
-af $mainCol "right" 0

-ac $mainForm "top" 0 $mainCol
-af $mainForm "bottom" 0
-af $mainForm "left" 0
-af $mainForm "right" 0

$masterForm;


formLayout -e

//Row 1

-af $btn1 "top" 0
-ap $btn1 "bottom" 0 $rowHeight
-af $btn1 "left" 0
-ap $btn1 "right" 0 33

-af $btn2 "top" 0
-ap $btn2 "bottom" 0 $rowHeight
-ap $btn2 "left" 0 33
-ap $btn2 "right" 0 66

-af $btn3 "top" 0
-ap $btn3 "bottom" 0 $rowHeight
-ap $btn3 "left" 0 66
-af $btn3 "right" 0


//Row 2
-ac $btn4 "top" 0 $btn2
-ap $btn4 "bottom" 0 ($rowHeight*2)
-af $btn4 "left" 0
-ap $btn4 "right" 0 33

-ac $btn5 "top" 0 $btn2
-ap $btn5 "bottom" 0 ($rowHeight*2)
-ap $btn5 "left" 0 33
-ap $btn5 "right" 0 66

-ac $btn6 "top" 0 $btn2
-ap $btn6 "bottom" 0 ($rowHeight*2)
-ap $btn6 "left" 0 66
-af $btn6 "right" 0


//Row 3
-ap $btn7 "top" 0 70
-af $btn7 "bottom" 0
-af $btn7 "left" 0
-af $btn7 "right" 0
$mainForm;

window -e -w 585 -h 175 alignWin;
showWindow alignWin;

NaughtyNathan
02-28-2011, 02:52 PM
what's the problem exactly Geuse? adding a tabLayout is really no different to adding any other layout..?
:nathaN
if (`window -q -ex alignWin`)
deleteUI alignWin;
window -w 230 -h 60 -t "Dag's Align UI" alignWin;

string $masterForm = `formLayout`;
// I dunno where you want this... lets just put it on main layout above tabs?
string $avg = `checkBoxGrp -cal 1 center -l "Average" -v1 0`;
string $tab = `tabLayout`;
// now we have a parent tabLayout, add it's child layouts (one for each tab)
string $alignForm = `formLayout`;
string $btn1 = `button -l ("X") -c ""`;
string $btn2 = `button -l ("Y") -c ""`;
string $btn3 = `button -l ("Z") -c ""`;
string $btn4 = `button -l ("-X") -c ""`;
string $btn5 = `button -l ("-Y") -c ""`;
string $btn6 = `button -l ("-Z") -c ""`;
string $btn7 = `button -l ("planarize") -c ""`;
setParent ..; // close the align formLayout
string $helpForm = `formLayout`;
string $helpField = `scrollField -text "some help text.. or whatever..."`;
setParent ..; // close the help formLayout
setParent ..; // close the tabLayout
setParent ..; // close the main formLayout
// set the tab names:
tabLayout -e -tli 1 "Alignment" -tli 2 "Help" $tab;
// now all our UI is created, set our form attachments:
int $rowHeight = 33;
int $border = 5;
// attach the tab layout to the whole window form:
formLayout -e
-af $avg "top" $border
-af $avg "left" $border
-af $avg "right" $border
-an $avg "bottom"
-ac $tab "top" $border $avg
-af $tab "left" 0
-af $tab "right" 0
-af $tab "bottom" 0
$masterForm;
// sort out the align layout:
formLayout -e
//Row 1
-af $btn1 "top" 0
-ap $btn1 "bottom" 0 $rowHeight
-af $btn1 "left" 0
-ap $btn1 "right" 0 33
-af $btn2 "top" 0
-ap $btn2 "bottom" 0 $rowHeight
-ap $btn2 "left" 0 33
-ap $btn2 "right" 0 66
-af $btn3 "top" 0
-ap $btn3 "bottom" 0 $rowHeight
-ap $btn3 "left" 0 66
-af $btn3 "right" 0
//Row 2
-ac $btn4 "top" 0 $btn2
-ap $btn4 "bottom" 0 ($rowHeight*2)
-af $btn4 "left" 0
-ap $btn4 "right" 0 33
-ac $btn5 "top" 0 $btn2
-ap $btn5 "bottom" 0 ($rowHeight*2)
-ap $btn5 "left" 0 33
-ap $btn5 "right" 0 66
-ac $btn6 "top" 0 $btn2
-ap $btn6 "bottom" 0 ($rowHeight*2)
-ap $btn6 "left" 0 66
-af $btn6 "right" 0
//Row 3
-ap $btn7 "top" 0 70
-af $btn7 "bottom" 0
-af $btn7 "left" 0
-af $btn7 "right" 0
$alignForm;
// finally sort out the help layout
formLayout -e
-af $helpField "top" 0
-af $helpField "left" 0
-af $helpField "right" 0
-af $helpField "bottom" 0
$helpForm;
window -e -w 585 -h 175 alignWin;
showWindow alignWin;

Geuse
02-28-2011, 03:01 PM
Aaaa. SO Fu**ing sweet of you!!
Thank You!

Yes I just couldn't understand it. Shouldn't be that much of a problem, but couldn't get it right. I'm gonna look through the code and see what I should've done.

thank you!

Oh, and what would be the correct way of altering the layouts to put the checkbox in the same window as the buttons?
I don't understand it fully and still can't get it to look correct =/

Geuse
02-28-2011, 05:38 PM
well. I fiddled with it a bit more and got it almost as I wanted, but somehow I managed to put the buttons and textbox in opposite tabs =/ and I can't figure out where it went so wrong and this was the only way to be clear of any errors! =/

much obliged...

PS. Is there a quick way of making the average checkbox stretch horisontally with the window?


if (`window -q -ex alignWin`) {
deleteUI alignWin;
}
window -w 230 -h 60 -t "Dag's Align UI" alignWin;
string $Form = `formLayout`;
string $tab = `tabLayout`;
string $helpForm = `formLayout`;
string $helpField = `scrollField -text "some help text.. or whatever"`;
setParent $tab;
string $masterForm = `formLayout`;
string $mainCol = `columnLayout -adj 1`;
setParent..;
string $mainForm = `formLayout`;
rowLayout -numberOfColumns 3
row2;
setParent $mainCol;

separator -h 10 -st none;
$avg = `checkBoxGrp
-cal 1 center
-l "Average"
-v1 0
-on1 ""
-of1 ""
`;

separator -h 10 -st none;
setParent $mainForm;
string $btn1 = `button -l ("X")
-c "dag_alignMain \"+\" \"x\""`;
string $btn2 = `button -l ("Y")
-c "dag_alignMain \"+\" \"y\""`;

string $btn3 = `button -l ("Z")
-c "dag_alignMain \"+\" \"z\""`;
string $btn4 = `button -l ("-X")
-c "dag_alignMain \"-\" \"x\""`;

string $btn5 = `button -l ("-Y")
-c "dag_alignMain \"-\" \"y\""`;

string $btn6 = `button -l ("-Z")
-c "dag_alignMain \"-\" \"z\""`;
string $btn7 = `button -l ("planarize")
-c ""`;

tabLayout -e -tli 1 "Alignment" -tli 2 "Help" $tab;
int $rowHeight = 33;
int $border = 5;
formLayout -e
-af $tab "top" $border
-af $tab "left" 0
-af $tab "right" 0
-af $tab "bottom" 0
$Form;
formLayout -e

-af $mainCol "top" 0
-af $mainCol "left" 0
-af $mainCol "right" 0

-ac $mainForm "top" 0 $mainCol
-af $mainForm "bottom" 0
-af $mainForm "left" 0
-af $mainForm "right" 0

$masterForm;

formLayout -e
//Row 1
-af $btn1 "top" 0
-ap $btn1 "bottom" 0 $rowHeight
-af $btn1 "left" 0
-ap $btn1 "right" 0 33

-af $btn2 "top" 0
-ap $btn2 "bottom" 0 $rowHeight
-ap $btn2 "left" 0 33
-ap $btn2 "right" 0 66

-af $btn3 "top" 0
-ap $btn3 "bottom" 0 $rowHeight
-ap $btn3 "left" 0 66
-af $btn3 "right" 0
//Row 2
-ac $btn4 "top" 0 $btn2
-ap $btn4 "bottom" 0 ($rowHeight*2)
-af $btn4 "left" 0
-ap $btn4 "right" 0 33
-ac $btn5 "top" 0 $btn2
-ap $btn5 "bottom" 0 ($rowHeight*2)
-ap $btn5 "left" 0 33
-ap $btn5 "right" 0 66
-ac $btn6 "top" 0 $btn2
-ap $btn6 "bottom" 0 ($rowHeight*2)
-ap $btn6 "left" 0 66
-af $btn6 "right" 0
//Row 3
-ap $btn7 "top" 0 70
-af $btn7 "bottom" 0
-af $btn7 "left" 0
-af $btn7 "right" 0
$mainForm;
formLayout -e
-af $helpField "top" 0
-af $helpField "left" 0
-af $helpField "right" 0
-af $helpField "bottom" 0
$helpForm;
window -e -w 585 -h 175 alignWin;
showWindow alignWin;

marcovn
03-10-2011, 03:09 PM
Hi,
I would like to alter the maya UI in a way like the attached picture:
In the red circle, you can see different editors in a tabbed manner. Before I dig deeper to find out what UI-scripts have to be altered and how, I wanted to ask if it is possible to do (and where to begin).
An easier way could be to add some buttons on the right corner like they did it with the grapheditor (green circle). Here I only had success to alter the function of an existing button of the grapheditor (now calls hypershade instead of dopesheet) but i was unable to add another button nor all buttons to the hypershad window.
Any help appreciated
Marco

ewerybody
03-11-2011, 01:52 PM
I'd doubt that something like that would be possible: But I actually don't know about Maya 2011s Qt interface so far.

Traditionally the Main view has from 1 to 4 embedded panels. So the panel controls appear at each panels top.

At the picture you have the top panels and the bottom one separated by the tabs... but Wait! Couldn't you create a custom panel that has a tabLayout and further panels in the single tabs?... but that would be a panel in a panel... I'don't know if that works. You'd have a panel control menu for your custom tab panel too!

Anyway: Why not layouts like that? Layouts are not tabs but you'd have them at the left sidePanel.

Kobes
03-29-2011, 12:28 PM
Gday all.

Quick question regarding UI. I'm writing a script at the moment and I want to add a file browser in the UI, like a texture file node has, where you browse for the image. The way I thought you would go about it is by using a textFieldButtonGrp and then have the button open a fileDialog. However I'm unsure on how to get the file that I select in the fileDialog to appear in the text Field after I click ok.

Any help would be greatly appreciated. Cheers Jake

NaughtyNathan
03-29-2011, 02:50 PM
don't forget the search feature Jake. searching the programming forum for "fileDialog" gives you two or three examples of exactly this issue.

http://forums.cgsociety.org/showthread.php?f=89&t=965196&highlight=fileDialog

:nathaN

ArrantSquid
03-29-2011, 05:07 PM
It's also going to depend on the version of Maya you're using. Maya 2011 deprecated fileDialog so if you're using that you'll need to use fileDialog2 instead. If you want to see an example of both grab this script - http://animateshmanimate.com/downloads/rigs_n_scripts/#quickPlayblast it has examplea for both in it. I'm on my phone so apologies for not just providing the actual code.

Kobes
03-29-2011, 11:41 PM
Thanks Nathan and Pneu. Funnily enough I already had a proc written like in the link you gave.

global proc js_mapBrowserUpdate (string $map) {
string $fileLocation[] = `fileDialog2 -dialogStyle 2 -fileMode 1`;
textFieldButtonGrp -e -text $fileLocation $map;
}


My problem was not calling the proc with an arguement properly in the -command flag of the button.

Cheers Jake

ArrantSquid
03-30-2011, 12:14 AM
Well glad any assistance i provided (if any) was helpful. :)

sdinesh86
03-31-2011, 08:18 AM
Hello,

here is my first attempt towards MEL scripting

i have done a quick Blueprint Manager to ease in the task of setting up planes shaders etc for Vehicle / character Modelling.

i am still learning so there might be a few issues here and there but will solve those, once i get good idea and reference on MEL.

jiyongman
04-18-2011, 11:21 AM
Hi guys,

I'm trying to make my own UI for Opening and Saving Scenes and having a plan to use it instead of original one during my current personal project.

I'm going to utilize textScrollList function with one window and some layouts in order to explorer the project folders for maya scenes.

But I faced two big problems soon.


Firstly, I can't block backgrounds and keep my own explorer window on top, like the original file browser window.


Secondly, I don't know if there's a way or trick to accept ESC key input to cancel the window just like the original one.


Please help me~


Python code trick would also be welcome!

jiyongman
04-18-2011, 11:25 AM
Anyone know why 'layout -q -p someLayout' doesn't work at all in Maya 2008???

It works fine in Maya 2009 & 2011, but in 2008 it doensn't return anything at all.

(There's no error messages, though)



Second question is,

Is there a way to get the type of a certain UI??

I sometimes want to know if it's a control, or a layout,

in some cases, if it's just a tabLayout or a shelfTabLayout with no trashcan icon.

goleafsgo
04-18-2011, 12:57 PM
Firstly, I can't block backgrounds and keep my own explorer window on top, like the original file browser window.

layoutDialog is probably what you are looking for. It provides a modal dialog that you can add your own UI layout to.

jiyongman
04-18-2011, 04:51 PM
Your answer proved two facts!

I'm an idiot and you're a genius! Ha

(so far layoutDialog was my favorite when my scripting, you know..)


It's truly helpful, thanks a million!!

goleafsgo
04-18-2011, 04:57 PM
Your answer proved two facts!

I'm an idiot and you're a genius! Ha

(so far layoutDialog was my favorite when my scripting, you know..)


It's truly helpful, thanks a million!!
I'm not sure it proves all that :-)

ewerybody
04-19-2011, 01:51 PM
Second question is,

Is there a way to get the type of a certain UI??This is quite a delicate question :/ there is this command: objectTypeUI (http://download.autodesk.com/us/maya/2009help/Commands/objectTypeUI.html). Problem is: it works on behalf the derived control classes of Mayas UI commands. That means it returns stuff that no one can understand. For instance all grouped controls like floatFieldGrp or floatSliderGrp return "rowGroupLayout" which is not a MEL command.

Now there is a crappy way to bypass this: look if the control with the name exists! And this is a script that does this and more:
http://goodsoul.de/mel/objectTypeUI2.mel

But beware!!: Maya 2009 and 2010 tend to crash Maya completely when you ask if a rowGroup exists thats not there! So better test it with an empty scene.
If there wouldn't be this severe bug it would actually be a nice script :/

jiyongman
04-20-2011, 01:03 AM
I can't access to the link TT, please check it~

Your other advices are very helpful, thank you so much!!!


Ah, by the way, do you know where the icon file is, in Maya 2011??

(like mayares.dll file from older versions)

ewerybody
04-21-2011, 06:02 PM
TT (http://www.urbandictionary.com/define.php?term=TT)? all links checked. Works here :shrug:
icon file in Maya 2011? :shrug: Nope. No 2011 used yet.
I'm sorry.

jiyongman
04-22-2011, 12:34 AM
TT (http://www.urbandictionary.com/define.php?term=TT)? all links checked. Works here :shrug:
icon file in Maya 2011? :shrug: Nope. No 2011 used yet.
I'm sorry.

Now the link works!

thanks;)

jiyongman
05-16-2011, 07:32 AM
Hi all!

Anyone knows how to stop the shelfButton echoing all the command lines everytime I click on it?

Unlike other button controls in Maya, a shelfButton shows what it does just like the "Echo All Commands" option turned on.

It's very annoying and not looking good.

Simple examples on this.


1.

window;
shelfLayout;
button
-c "polySphere";
showWindow;




2.

window;
shelfLayout;
shelfButton
-c "polySphere"
-i "smallTrash.xpm";
showWindow;



The second one spits "polySphere;" on and on and on!


What do I do with this!?!

NaughtyNathan
05-16-2011, 09:26 AM
Anyone knows how to stop the shelfButton echoing all the command lines everytime I click on it?
why on earth does it matter? But if you really don't want the shelf button to spam your history simply write proper procedures and call those from your shelf buttons. This is what you should really be doing anyway, putting too much code on shelf buttons is not a particularly safe or efficient way to work.
:nathaN

rschauhancg
06-14-2011, 07:33 PM
I wrote a tutorial for creating simple Maya UI using Python and QT Designer.

Check it out:
www.ivoxelstudios.com/blog/ (http://www.ivoxelstudios.com/blog/)

jiyongman
06-21-2011, 06:04 AM
Hi Nathan, thanks for your reply,
It's very late to say this, though :)

You're right, that's not that big problem but it just bothered me and I wanted to know if there are some guys who solved this wisely, that's all :))


Anyway, for this time, I faced another problem.

I often use 'progressWindow' UI on heavy scripts, because there's no way for me to find out how much jobs are left without it.

(As you know, 'print' command doesn't print messages out right away during the job.)

But the problem is, often progressWindow doesn't update both its messages and the progress line at all on very heavy jobs.

(rendering frame by frame script, for example)

I tested several times editing the interval for progress Window's update but failed.

(It accepts the esc key input well on the other hand)


Do you guys know why?

craigpmiller
07-17-2011, 06:17 AM
PREFACE

A bit of a MEL noob. :hmm:

string $formula = "set of instructions followed unintelligently; // MEL joke. :-)

I've been trawling the net
(big props to Malcolm Kesson - http://www.fundza.com/index.html )
and had a little success building a little light intensity mulitplier.

// select lights - discards anything not a light
// window with slider and a "do it" button pops up
// adjust slider to multiply light intensities
// press button
// loops though selected lights and multiplies current value by multiplier,
// sets new light intensity value.

THE MEAT

My next - overly ambitious :scream: - idea was to create an on-the-fly dimmer board creating a sliders for each selected light.

Hmm ... :hmm:

Looping through the selection makes a new slider but only the last slider actually works and all the buttons apply the last slider's value. // I haven't gotten around to applying each slider to its own light yet so ignore that bit for now.

// THE MEL CODE

// Written by Craig Miller (craig@whimsy.co.nz)

// Adapted from Malcolm Kesson tutorials (http://www.fundza.com/index.html)

global string $dimmerwin;
global string $sldrDmmr;

// Echoes the value of a slider in the script window

global proc getSliderValue()
{
global string $sldrDmmr;
float $v = `floatSliderGrp -q -v $sldrDmmr`;

string $select[] = `ls -sl -dag -lights`;
for ($light in $select){
float $value = `getAttr ($light + ".intensity")`;
print ($light + " intensity is " + $value + "\n");
setAttr ($light + ".intensity") ($value * $v);
float $newVal = `getAttr ($light + ".intensity")`;
print ($light + " new intensity is " + $newVal + "\n");
}

print("The current value of the multiplier is " + $v + "\n");
}

// Adds a slider and a button to the window

global proc addUIWidgets()
{
global string $sldrDmmr;
string $select[] = `ls -sl -dag -lights`;
int $count = size($select);
for ($v = 0; $v < $count; $v++){
columnLayout;
$sldrDmmr = `floatSliderGrp -columnWidth 1 50
-label "Light"
-ann "Multiplier"
-field true
-value 1
-min 0.1 -max 2`;
button -label "Apply Multiplier Value" -command "getSliderValue";
}
}

// Main proc

global proc DmmrUI()
{
global string $dimmerwin;
deleteUI $dimmerwin;
int $doesExist = `window -exists $dimmerwin`;
if($doesExist == 0) {
$dimmerwin = `window -w 400 -h 200
-retain
-topLeftCorner 500 1000
-title "The Dimmer's Arms"`;
// Should move this section to the addUIWidgets section
// string $select[] = `ls -sl -dag -lights`;
//int $count = size($select);
//for ($v = 0; $v < $count; $v++){
// addUIWidgets();
// }
addUIWidgets();
}
showWindow $dimmerwin;
// Resize the window
window -edit -widthHeight 500 250 $dimmerwin;
}

DmmrUI();


// ERR ... END CODE BIT


I'm sure I have a problem making unique sliders.
I think the sliders are all an instance of some sort of $sldrDmmr
Therefore I would need to generate a unique name slider name each loop ??
The same would go for the button command.
Do I need to adapt the getSliderValue proc to accept an argument, that is, which slider/light to use/affect.

Sorry if this is a bit long or convoluted.

Any help/pointers would be greatly appreciated.

Cheers

_____________________________


The Next Day ...

Having slept on it - I do some of my best work when I'm asleep - I realised my getSliderValue needed an argument. :lightbulb

global proc getSliderValue (int $i)

// Now to add an integer to my button's -command

global proc addUIWidgets()
{

global string $sldrDmmr[];
global int $i;
string $select[] = `ls -sl -dag -lights`;
int $count = size($select);
string $lightNames[] = `listRelatives -parent $select`; // pretty names for the labels

for ($v = 0; $v < $count; $v++){
columnLayout;
$sldrDmmr[$v] = `floatSliderGrp -columnWidth 1 150 //works!! individual sliders
-label $lightNames[$v] // works!! correct name labels
-field true
-value 1
-min 0.1 -max 2`;
button -label "Apply Multiplier Value" -command "getSliderValue $v"; // FAIL - buttons all have 0 as argument.
}
}

// Now this seems to run but both buttons affect the same light.
// I have two lights selected and run script window

getSliderValue 0; // returns the value of the 1st slider
getSliderValue 1; // returns the value of the 2nd slider


// All well and good getSliderValue $i works.
// It seems in my button creation both are getting -command "getSliderValue 0";


// There was no reply to my last message.


// But I live in hope. :wavey:


______________________


Must be still in my MANIC phase... :drool:

// Realised that the button -command "getSliderValue" was inside "'" and thus a string!! :lightbulb
// So I changed you button line to...

button -label "Apply Multiplier Value" -command ("getSliderValue " + $v); // Should have thought of this!!

// BINGO!!

:beer:

Hope this helps some one else!!

Xinos
07-29-2011, 08:16 AM
I'm having troubles with paneLayout, and would gladly ditch it for a better sollution.
Thing is I can't get my left pane to stay at a fixed width. The Static Width Pane flag helps, but it only ensures the pane stays the same width when resizing the window.
But if I resize the window and restart the script (I want it to remember the window size of the last session) the pane width will be wrong. You define pane width by percentage of window size, so I should be able to calculate what size it should.. however I don't get the actual window size when querying my window.

Is there another way of doing this? I would rather just have to column layouts side by side, because I alwayse want my left one to be a fixed width. There's a screenshot and download of my script here (http://www.creativecrash.com/maya/downloads/scripts-plugins/texturing/c/uvdeluxe/) so you can see what I mean.

NaughtyNathan
07-29-2011, 08:42 AM
if you want your left column a fixed width, why are you using paneLayout then? if you want two columns side by side use a formLayout or evan a simple rowLayout...

:nathaN

Xinos
07-29-2011, 07:42 PM
I was using a paneLayout because it was the only layout type that I could successfully attach the texture editor to (a scriptedPanel with the pane layout as parent). I'm trying now with the rowLayout but it just will not show.

Edit: Not having any luck with formLayout either. What am I doing wrong?
First I detach any existing texture editors, before creating the UI elements.

uvTextureViews = cmds.getPanel(scriptType='polyTexturePlacementPanel')
if len(uvTextureViews):cmds.scriptedPanel(uvTextureViews[0], e=True, unParent=True)

form = cmds.formLayout(nd=2)

texturePanel = mc.scriptedPanel(uvTextureViews[0])

column = cmds.columnLayout ('MainColumn', columnWidth=220)
#A bunch of UI stuff loaded into this column#
cmds.setParent('..')
cmds.formLayout(form,edit=True, attachForm=[(column,'left',0),(texturePanel,'left',220)])

But all I get is:
# RuntimeError: Object's name 'polyTexturePlacementPanel1' is not unique. #

EdgarM
08-18-2011, 10:56 PM
I am a real newbie when it comes to mel and stuff. What I want is to attach a custom toolbar to uv texture editor window's bottom. How can I do that?
For that matter, I can't figure out how to attach anything to anything.

LegoBlock
08-25-2011, 05:42 PM
I am a real newbie when it comes to mel and stuff. What I want is to attach a custom toolbar to uv texture editor window's bottom. How can I do that?
For that matter, I can't figure out how to attach anything to anything.

This is how I would do it. If anyone else has more advice or a better way to do it, I'd love to know!
But this should at least get you started in the right direction:


// With Texture editor open, this captures the main frame layout into a variable
$texFrame = `frameLayout -q -p textureEditorToolbarFrameLayout`;
// That variable will contain a long name separated by pipes, "|"
// We need to extract the right layout from that long name, so we'll 'tokenize' it,
// which means separating it based on a certain string

// We need to made make string array to put the separated $texFrame into
string $buffer[];

// In case you run this more than once, we'll clear that array
clear($buffer);

// Tokenize it. The first intput in tokenize is the input string,
// the second is what we'll separate it with. the pipe '|' is a special character,
// so we need to escape it with '\'. Look up regular expressions to learn more on that.
// The third is the array that we put the separated strings into.
// Tokenize returns an int number of items that were separated, so we capture that with $numT
$numT = tokenize($texFrame, "\|", $buffer);

// So now we want to get the children from the formLayout that we separated
// Since the string we want (which is the formLayout) is the last in the array, we get it with:
// [$numT - 1]. Since $numT is the number of items separated, we subtract one since it's 0 based
$texChildren = `formLayout -query -childArray $buffer[$numT - 1]`;

// We'll make a button and attach it to the form layout

$testButton = `button -p $buffer[$numT - 1] testBtn`;

// Now we need to edit the formLayout to attach the button
// Look up formLayout to learn more on how you can attach it in different ways.
formLayout -e
-attachForm $testButton "left" 0
-attachForm $testButton "right" 0
-attachControl $testButton "top" 0 $texChildren[1]
-attachForm $testButton "bottom" 0

-attachForm $texChildren[1] "left" 0
-attachForm $texChildren[1] "right" 0
-attachControl $texChildren[1] "top" 0 $texChildren[0]
-attachPosition $texChildren[1] "bottom" 0 90

$buffer[$numT - 1];


Obviously you'd eventually want to attach some layout instead of just a button, but that should hopefully give you some ideas.

PerfectLine
08-26-2011, 04:04 PM
Attempting to change basic maya UI again.

We are now starting to use Maya 2012 in our department as a standard.

Since I can't stand the color scheme OR much any of the other ones I know about I use a command to change the color of the main UI.

window -e -bgc .79 .79 .79 $gMainWindow;

But.....

This never sticks... it always resets on the next start. Where can I modify this color as the default? There is no setting for it in the plain color preferences, though there should be, and I can't seem to find its entry anywhere.

Is there a MEL file I can edit to get this color to stay?

I mean, how does the

"E:\Program Files\Autodesk\Maya2012\bin\maya.exe" -style windowsxp

command specific "-style whatever" get its information from? I want to edit that.

Mainly because I want also to get rid of the HORRIBLE contrast they have in any of the UI choices. The default is too dark with no contrast and the other options have these glaring white boxes which need to be fixed. As well as the timeline slider.

default using above style.

yuck... just like every other option. A little better then the dark UI. But those damn bright white boxes... ARG! Seriously. Who ever put these UI color schemes together needs to go back to design school and learn basic color theory.

http://img198.imageshack.us/img198/3571/blehqtui.jpg

Using gmainwindow command with photoshop to get desired look. AH... easy like sunday mornin on the mind. Seriously though, money might exchange hands if you can give me the solution. Because I am lamenting using the new QT daily due to these horrible color schemes. Since I am being forced I am trying to save what is left of my eyes as a last ditch effort. The grey allows both black and white to be read easily. Its a mid tone grey so it wont leave white blocks in your eyes OR like the dark UI leave much to be desired with no contrast for reading the text easily, especially in the outliner, script editor, etc. May not be to others liking but my eyes would thank you..... right click VIEW IMAGE to see full size.

http://img843.imageshack.us/img843/1081/kcmyqtui.jpg

ewerybody
08-26-2011, 07:43 PM
if you wantwindow -e -bgc .79 .79 .79 $gMainWindow;to be executed on each Maya start put it into a userSetup.mel located in the userScriptDirinternalVar -usd;

Geuse
08-26-2011, 10:14 PM
He's also wondering about how to change the background color in the outliner if I understood him and I'm also curious about that.

PerfectLine
08-26-2011, 11:28 PM
Thanks for the tip. Gah, sometimes the easiest solution is overlooked.

At the moment. I have found a few more commands to force change colors.

Adrian Graham sits next to me at DD. He is one of the original UI developers/programmers from the Alias days. You may have watched a tutorial DVD of his at one time or another on particle fx and dynamics and what not.


He is looking at a way to tweak it. But, it (outliner bg color and other misc) may very well need to be tweaked in QT designer. He's checking it out now.

Hamburger
08-29-2011, 06:22 AM
How can one parent a hudButton with a global procedure?

It seems I have to make all my strings global for it to work otherwise it cannot find it.

jdex24
09-01-2011, 06:35 AM
quick question about keeping windows open when loading a new file.

I apologise in advance if this question has already been asked, Ive spent so long searching for an answer.

I've created a window that I want to remain open when I load in a new scene, The window that I've created has a button that runs a command whereby it saves the current scene as a new version, runs a fix cache script then re-opens the scene. yet on re-open all my windows disappear.

what seems to confuse me the most is I've been using this tool for a few days now and it wasnt deleting any windows on re-open yet now it does.

I've considered including in my command the addition of a scriptNode so it re-loads the window yet I'm sure there is an easier answer

any suggestions are greatly appreciated

PerfectLine
09-01-2011, 08:05 AM
Hmm, well I figured out that if your
window -e -bgc .x .x .x $gMainWindow;

....is .5 .5 .5 or lower the bg color will be the dark gray. If its .51 .51 .51 or higher it will be pure white.

I suppose the color at .5 .5 .5 is a little better but the outliner and script editor still need tweaking with being too dark or too bright. I made the hidden text back to the old blue but slightly brighter because the dark grey is just ridiculous, couldn't tell what was hidden or not in some cases. Also the gold icons are strange. I was trying to figure out how to edit the mesh icons back to the old blue colors. Plus... some of the hypershade icons are worse too. The spot info node took me a bit to spot.

I tried to do 2012 today at work.... but after I noticed my face getting closer and closer to the screen slowly over the course of 20 minutes I pulled back and just exported the scene to 2009 again. In Linux flavor ... as ugly as the old 2009 interface is to some people I prefer the mid range gray look and view ports.

Maybe in 2013 they will give us better control over it all. :arteest:

Don't meant to be bitchy, but as soon as I went back to 2009 the speed was there, the eye strain was gone and little things like switching between the channelbox and attribute editor wasn't weird /buggy everytime. Marking menus were instant.. etc etc. I love maya the best out of all the apps.

Oh does everyone else have to resize the hypershade everytime they open it?

The area with the shader choices is taking up too much space. I always have to size up the work area and size down the shader list.

---edit----

Just realized that Softimage is probably the other big factor here. Since I had used that for a long time I was used to its midrange gray UI. Which is really great all around. Black and white texts are easily readable. Oh yeah. Feature request... IF Maya has an unchangable UI color theme make it so its closer to Softimage's colors. Which is without a doubt the best one so far of any app.

Right now I am using .5 .5 .5 and its not a bad compromise.... might make due.

http://img203.imageshack.us/img203/7496/mayalwvx.jpg

PauliSuuraho
10-08-2011, 11:24 AM
Hello,

I'd like to know, if anyone has found any way to build custom UI-controls. Basically all I need is a canvas-control where I can draw with c++ API.

Also is there any way to query/get the top and left coordinates of ui-controls placed on formLayout and -attachPosition command in MEL?

-Pauli

Geuse
11-02-2011, 10:41 AM
So I've been battling with this UI last night and couldn't get it to look as I want.
I want the radio button to keep it's position centered in the columnlayout which is then parented to a formlayout. I obviusly got the label flag to behave correctly, but not the radiobutton itself. I just can't seem to get it under control. The idea is to have 8 radio buttons in a row and be able to scale the window and have the radiobuttons follow.

This is what I have now
http://dl.dropbox.com/u/16029672/win_orig.jpg

This is what I want
http://dl.dropbox.com/u/16029672/win_mod.jpg


and this is the
global proc newWin(){


if (`window -q -ex autoRigWin`)
{
deleteUI autoRigWin;
}

window -w 230 -h 60 -t "New Win" autoRigWin;

string $Form = `formLayout`;

string $formBtm = `formLayout`;
setParent $Form;
string $formTop = `formLayout`;

string $form1 = `formLayout`;

string $col = `columnLayout -adj 1`;
string $btn1 = `radioButtonGrp
-adj 1
-cw 1 20
-cal 1 "center"

-numberOfRadioButtons 1
-label "cm "`;
//string $btn1 = `button -l "1"`;
setParent $col;
setParent $form1;
setParent $formTop;

string $form2 = `formLayout`;
string $btn2 = `button -l "2"`;
setParent $form2;

setParent $formTop;
setParent $Form;



string $tab = `tabLayout`;

//TAB1 SPINE
string $masterForm = `formLayout`;
string $topForm = `formLayout`;
setParent $masterForm;
setParent $tab;


//TAB2 ARM
string $masterForm2 = `formLayout`;
string $topForm2 = `formLayout`;
setParent $masterForm2;
setParent $tab;


//TAB3 LEG
string $masterForm3 = `formLayout`;
string $topForm3 = `formLayout`;
setParent $masterForm3;
setParent $tab;


//TAB4 TENTACLE/TAIL
string $masterForm4 = `formLayout`;
string $topForm4 = `formLayout`;
setParent $masterForm4;
setParent $tab;


//TAB5 EXTRAS
string $masterForm5 = `formLayout`;
string $topForm5 = `formLayout`;
setParent $masterForm5;
setParent $tab;


//TAB6 SAVE/LOAD LAYOUTS
string $masterForm6 = `formLayout`;
string $topForm6 = `formLayout`;
setParent $masterForm6;
setParent $tab;


//TAB HELP
string $helpForm = `formLayout`;
string $helpField = `scrollField -text "some help text.. or whatever"`;
setParent $helpForm;
setParent $tab;



tabLayout -e -tli 1 "Spine/Neck" -tli 2 "Arm" -tli 3 "Leg" -tli 4 "Tail/Tentacle" -tli 5 "Extras" -tli 6 "Save/Load Layout" -tli 7 "Help" $tab;
int $rowHeight = 25;
int $border = 5;
setParent $Form;





string $b1dBtn = `button
-l ("Build")
-bgc 0 0.9 0
-c "build"`;

setParent $Form;






formLayout -e
//-ac $tab "top" 10 $topCol
-ap $tab "top" 0 20
-af $tab "left" 0
-af $tab "right" 0
-ap $tab "bottom" 0 90
$Form;


//FORMLAYOUT
formLayout -e
-ac $b1dBtn "top" 0 $tab
-af $b1dBtn "left" 0
-af $b1dBtn "right" 0
-af $b1dBtn "bottom" 0
$Form;



//FORMLAYOUT
formLayout -e
-af $formBtm "top" 0
-af $formBtm "left" 0
-af $formBtm "right" 0
-ap $formBtm "bottom" 0 95
$Form;


//FORMLAYOUT
formLayout -e
-ap $formTop "top" 0 10
-af $formTop "left" 0
-af $formTop "right" 0
-ac $formTop "bottom" 0 $tab
$Form;



//FORMLAYOUT
formLayout -e
-af $form1 "top" 0
-af $form1 "left" 0
-ap $form1 "right" 0 50
-af $form1 "bottom" 0
$formTop;


//FORMLAYOUT
formLayout -e
-af $form2 "top" 0
-ap $form2 "left" 0 50
-af $form2 "right" 0
-af $form2 "bottom" 0
$formTop;


//Button1
formLayout -e
-af $col "top" 0
-af $col "left" 0
-af $col "right" 0
-af $col "bottom" 0
$form1;

//Button2
formLayout -e
-af $btn2 "top" 0
-af $btn2 "left" 0
-af $btn2 "right" 0
-af $btn2 "bottom" 0
$form2;







//SPINE TAB LAYOUT
formLayout -e

-af $topForm "top" 0

-af $topForm "left" 0
-af $topForm "right" 0



$masterForm;













//ARM TAB LAYOUT
formLayout -e

-af $topForm2 "top" 0

-af $topForm2 "left" 0
-af $topForm2 "right" 0



$masterForm2;








//LEG TAB LAYOUT
formLayout -e

-af $topForm3 "top" 0

-af $topForm3 "left" 0
-af $topForm3 "right" 0



$masterForm3;








//TAIL TAB LAYOUT
formLayout -e

-af $topForm4 "top" 0

-af $topForm4 "left" 0
-af $topForm4 "right" 0


$masterForm4;








//EXTRAS TAB LAYOUT
formLayout -e

-af $topForm5 "top" 0

-af $topForm5 "left" 0
-af $topForm5 "right" 0



$masterForm5;












//LAYOUT TAB
formLayout -e

-af $topForm6 "top" 0

-af $topForm6 "left" 0
-af $topForm6 "right" 0



$masterForm6;







//HELP TAB
formLayout -e
-af $helpField "top" 0
-af $helpField "left" 0
-af $helpField "right" 0
-af $helpField "bottom" 0
$helpForm;








window -e -w 585 -h 175 -topEdge -80 -leftEdge 10 autoRigWin;
showWindow autoRigWin;
}

Bambelby
11-23-2011, 11:05 AM
I have a problem with the command projFileViewer.I don't Know if it's a maya 2012 bug but the example of maya help doesn't work, anybody else has the same problem?

this is the example of maya help:

import maya.cmds as cmds

cmds.window( 'ProjWindow', rtf=0, wh=(150, 150) )
cmds.paneLayout( 'ProjPanes' )
cmds.projFileViewer( 'ProjFileView', dm=0 )
cmds.paneLayout( 'ProjPanes', e=True, cn='single', sp=('ProjFileView', 1) )
cmds.projFileViewer( 'ProjFileView', e=True, fr=True )
cmds.showWindow()

thanks in advance

noobmode
03-04-2012, 03:00 PM
I have a very old question about Maya UI
Is there anyway to insert a background picture into Maya Window?


Anything would help. Thanks

Geuse
03-04-2012, 10:28 PM
Hey Dude!
Of course, but then you must use a form layout and put it in. In prior versions of maya like up to 8 or so(please correct me if I'm wrong) html was implemented so you could create more dynamic and nicer looking UI:s, but it was scrapped before I had time to try it out(Don't understand why either) :(
However as per the implementation of QT the feature is back. This is what I've understood anyway, haven't tested it yet myself. Is this info correct?

Anyway. here's some links to mel UI:s using formlayouts to add a background image
http://xyz2.net/mel/mel.064.htm
http://forums.cgsociety.org/showthread.php?t=858764

noobmode
03-05-2012, 02:41 AM
@Geuse
I also think there is no direct way to insert a BG pic into an UI window
Thanks for the information

Geuse
03-05-2012, 08:17 AM
What do you mean? In a MEL UI you can attach it to a formlayout following the links I posted. It's the most simple and direct way =)

Perhaps I threw you off rambling on about QT and html implementation hence that's a way to create nicer looking UI:s, but using MEL with the formlayout would be what you're looking for. Good luck!

noobmode
03-05-2012, 08:21 AM
@Geuse: Sorry man, i'm new to MEL script so maybe my post not make any sense.
However your post very useful and it gave me the result i want. Thanks again

Edit: I have one more question. I try to create FacialGUI. Like this
http://nj8.upanh.com/b4.s25.d2/70d13833ece25867bcbb3d651fba7505_41707788.facegui.jpg
The Area box in the middle look like a slider but i can't find any command to create it.

Geuse
03-05-2012, 09:25 AM
Cool dude! Keep it up.

caicheng
03-18-2012, 02:23 AM
hi guys!

who can tell me how to use the <-defineTemplayte -useTemplate -docTag >??
thanks a lot!