MEL - Maya UI Building

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

REPLY TO THREAD
 
Thread Tools Search this Thread Display Modes
  11 November 2004
ActiveX controls

Hello all,
I'd like to know if it's possible to embed a Microsoft ActiveX control (TreeView, ListView) in a custom interface, then access it using it's methods and properties.
Thanks,
Dave
 
  12 December 2004
Textbox to command. HOW?!?!?

Hi there,


I am trying to make a toy for myself with Mel. Actually I am a transfer from MAX and I want to create a UI where I input the x y z coordinates and use these numbers to move scale or rotate the selected object.

I am having a lot of difficulties, especially with the form(text box and controls on the form) but I need to know how to take the values from the textboxes and use them with the move command. I did this and it is giving a Invalid Argument error.

I have 3 textFieldGrps representing x y and z coordinates. I take the coordinates and put them in a string I call komut. I just want to use this komut's content with the move tool. When I type the command manually (like move -rpr 10 15 25 in script editor), it works but this way it does not). Please help ,me where I am doing wrong and also can you point me to a good UI tutorial. I want to create a interface like the Duplicate window but only for coordinates.

Thanks for the help and here is what I did so far.



global proc Tufan()
{
//check& destroy
if((`window -exists koordinat`) == true) deleteUI koordinat;

//create

window -title "Coordinate Entry" -wh 150 60 koordinat;

//controls

columnLayout;
textFieldGrp -label "X" -text "0" xcor;
textFieldGrp -label "Y" -text "0" ycor;
textFieldGrp -label "Z" -text "0" zcor;
button -l "Move Absolute" -c "tam";
button -l "Move Relative" -c "rel";

//show it
showWindow koordinat;
}

//call it
Tufan;
global proc tam()
{
string $komut= `textFieldGrp -q -text xcor`;
$komut=$komut + " ";
$komut=$komut + `textFieldGrp -q -text ycor`;
$komut=$komut + " ";
$komut=$komut + `textFieldGrp -q -text zcor`;
$komut=$komut + " ";
move -xyz $komut;

}
global proc rel()
{
string $komut= `textFieldGrp -q -text xcor`;
$komut=$komut + " ";
$komut=$komut + `textFieldGrp -q -text ycor`;
$komut=$komut + " ";
$komut=$komut + `textFieldGrp -q -text zcor`;
$komut=$komut + " ";
move -r $komut;
};
__________________
MitraloNe

Just learning....

My Living Room WIP
My works:
www.geocities.com/mitralone
 
  12 December 2004
Talking Got it. EVAL

hey there,

I found it out. Eval a string and it solved. Now I need to learn how to make a good UI. Waiting for the UI tutorial links. Thanks all.
__________________
MitraloNe

Just learning....

My Living Room WIP
My works:
www.geocities.com/mitralone
 
  12 December 2004
To the Gods of mel lol

Hey

I hope someone can help me out a tad I have managed to make a simple UI

To help in rigging a player model I have it all dun BUT! canít seem to get a function working

I need to scale the bones/rig from a reference node Ö. Trying to have these controls in my UI

I know am doing something wrong can someone point it out please and thanks



floatSliderGrp -l "scale reference " -field 1;

connectControl $field ( $reference + ".scale");

connectControl $SliderGrp ( $reference + ".scale");
 
  02 February 2005
I'm surprised people actually plan on changing userPrefs.mel....
You should always remember that if other people want to use your script, make it as easy for them to use as possible. To force something like that is not good.... Here's a copy from an article I'm currently writing that involves some heavy UI scripting.

Copied form :
www.final3.com

The article is not done so this is exclusive

---------------------------------------------------------------
windowPref -enableAll true; and windowPref -enableAll false;
---------------------------------------------------------------

"true" is of course when it's turned on and "false" turns it off. This is a boolean value.0 = false (off), 1 = true (on) Just like visibility is a boolean value. A boolean value
can only have one out of two options. "On" and "Off"/ "0" and "1".
We can use this to check if the user has this option turned on or off because we want the AUGBuiler UI to be the correct size no matter what. We check this using an if-
command. This is what we tell the script to do:

If the user has "Remember size and position" turned on, turn it off, open window and then turn it back on. I don't want to create a script that changes userprefs without
doing one of the following. Create an ERROR message or pretend it was never changed by changing it back.

-------------------------------------------------------------------------------------------
windowPref -enableAll false;
error "your userpref has been changed (remember size and position is now turned off)";
-------------------------------------------------------------------------------------------

This turns the "remember size and position" off and tells the user that the script has changed the setting. I do not reccomend to do it this way, I just wanted to show you
the ERROR command you should use if you change ANYTHIG out of the users control. I will stick to the if command. This script "translates" the if sentance I wrote earlier.

--------------------------------------------------------------
string $getWindowPreferences = `windowPref -q -enableAll`;

if ($getWindowPreferences == 1)
{
windowPref -enableAll false;
AUGWindow;
windowPref -enableAll true;
}

else
{
AUGWindow;
}
-------------------------------------------------------------

I created a string that gives us the boolean value for the windowPref command. Look up "string" in the help-file if you're unfamiliar with the usage of it.
Strings are sequences of characters. It can be anything you want to name it. If you take a closer look at the string line you can see the "-q" flag. What this flag does is
setting the string in query mode. We need it to be in query mode because we want to get a value for later use. Look up int, float boolean too. These are variables with
certain limits unlike "string"

You can use a print-command to see if what you are doing is totally wrong or undoubtfully correct.

-------------------------------------------------------------
string $getWindowPreferences = `windowPref -q -enableAll`;
print $getWindowPreferences;
-------------------------------------------------------------

If you look in the script editor echo-window you'll see a "1" or a "0" depending if you turned the setting on or off.

if ($getWindowPreferences == 1) We tell the script to check if the string "getWindowPreferences" returns a value of one and one only. If it appears to be the case. The script
will execute the command between the brackets.

windowPref -enableAll false; We turn the "remember size and position" off
AUGWindow; We open the Window
windowPref -enableAll true; And then we turn "remember size and position" back on


I am creating a rifle and I want to create a UI that can build the rifle depending on the parts I select.... Hope you found some of this useful. NEVER EVER change a users prefs without telling him, the conseuences can be catastrophic!!!
 
  03 March 2005
toggle window visibility

alrighty I know how to do this with the script editor but I cant find the name of the windows for any other window in maya to toggle their window visibility or close/open them.

mel script to toggle the script editor is

{

string $scriptWin = $gCommandWindow;

int $scriptTog = `window -q -vis $gCommandWindow`;

if ($scriptTog == 1)

window -edit -vis 0 $scriptWin;
else

showWindow $gCommandWindow;

};


but I want to be able to do this with any window, specifically, component editor, hyper graph, hyper shade, outliner, graph editor, but I cant seem to find what maya calls these windows to set up a command that closes them. if anyone can help that would be supper sweet.


i have hot keys to open all of these windows but the same command that i use to open the spefefic window gives me an error saying that maya cant find the object example


// Error: line 1: Object not found: HypergraphWindow //



help!
 
  03 March 2005
This is a good example of a case you would want to find out by opening the windows in maya to read what maya does. Just turn on the "execute all commands" command and read while doing.

hypershade = HypershadeWindow;
hypergraph = HypergraphWindow;

etc. etc.
__________________
Martin Andersson
- www.animation-hut.no
- http://www.thekove.com

Last edited by Mikademius : 03 March 2005 at 09:55 AM.
 
  03 March 2005
I've finally coded a UI builder. Works from function declaration automatically. http://ndhaussy.free.fr/melScript

If you have any feedback
 
  03 March 2005
Originally Posted by Nicool: I've finally coded a UI builder. Works from function declaration automatically. http://ndhaussy.free.fr/melScript

If you have any feedback


I would love to check it out. I don't have time here at work right now, but I read some of your scripts and they look cool. I'll try some of them out at home later....
__________________
Martin Andersson
- www.animation-hut.no
- http://www.thekove.com
 
  03 March 2005
resizing buttons

Hey, I've been having a play around with melUI, trying to find out if it's possible to have 2 buttons in a rowLayout that both resize horizonally when the window is resized?

I've got it working so that the button on the right correctly resizes, but can't see a way of getting them both to do it together.


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

window -title "windowX" -widthHeight 120 100 -s 1 -tlb 1 windowX;
	
	columnLayout -columnAttach "both" 0 -rowSpacing 2 -columnWidth 100 -adj 1;
		
		separator;
		text -height 13 -label "Buttons";
		separator;
 		
		rowLayout -numberOfColumns 2 -columnWidth2 60 60 -adjustableColumn 2 -columnAttach2 "both" "both" -columnAlign2 "center" "center";
			button -label "but01" -height 20;
			button -label "but02" -height 20;
		setParent ..;
showWindow;


Thanks,

Stu
__________________
blog

Fluid Pixel Studios
 
  04 April 2005
Dual Monitors with Maya UI

Hey everyone
Ive jus purchased maya and am transfering from cinema4d.
Ive got a dual monitor setup on a dual 1.25 ghz G4.

I dont know how to rearrange my maya UI though to make use of the space.

I have no MEL experience and wondered if there are any pre-made UIs that can be downloaded?
Please point me in the right direction.
Thankyou in advance

Nico
__________________
Lovin every minute of every second! :)
 
  04 April 2005
Dual Screen UI setup, please help!

Hey everyone
Ive jus purchased maya and am transfering from cinema4d.
Ive got a dual monitor setup on a dual 1.25 ghz G4.

I dont know how to rearrange my maya UI though to make use of the space.

I have no MEL experience and wondered if there are any pre-made UIs that can be downloaded?
Please point me in the right direction.
Thankyou in advance

Nico
__________________
Lovin every minute of every second! :)
 
  04 April 2005
I haven't seen any other downloadable UI's :( But what kinda UI rearranging have you got in mind?
 
  04 April 2005
In Cinema 4d I had most of my tools and a perspective view on one screen and my orthographic views and main tools on the other. I cant work out how to do this in maya.
Can You help?
__________________
Lovin every minute of every second! :)
 
  04 April 2005
Sorry mate, I wouldn't have a clue how with dual monitors. Try a search, I've seen something like this mentioned before here.. Not going to guarantee that though :P
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:24 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.