CGTalk > Software Specific Forums > Autodesk Maya > Maya Programming
Login register
reply share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 01-20-2003, 05:13 PM   #1
bentllama
warrior soul
 
bentllama's Avatar
CGSociety Member
portfolio
nate walpole
motion zealot
USA
 
Join Date: Jan 2002
Posts: 4,908
Send a message via AIM to bentllama Send a message via MSN to bentllama
Post MEL - Maya UI Building

This thread is dedicated to Maya UI Building.

Please post any tips, tricks and advanced or general useful Maya UI Building knowledge in this thread.

Please only post Maya UI Building related examples, as there is already a sticky thread for general MEL posting.
__________________
bent...
bentllama
...
 
Old 01-20-2003, 07:41 PM   #2
bigfatMELon
Seer
 
bigfatMELon's Avatar
Blizzard
 
Join Date: May 2002
Posts: 340
Send a message via AIM to bigfatMELon
And since I'm the magic nose goblin who asked for it, it's only right that I contribute something.

Here are links to two terribly useful UI tutorials at Bryan Ewert's site.

The Scripted Panel Tutorial
The Form Layout Tutorial

-jl
 
Old 01-21-2003, 04:26 AM   #3
dmcgrath
Pancake Tester
 
dmcgrath's Avatar
Daniel McGrath
USA
 
Join Date: Mar 2002
Posts: 1,553
Okey dokey, since I just finished a MEL class last semester.
the direct UI page:

http://cade.scope.edu/courseware/no...l/uidesign.html


The entire MEL based set (FRAMES HTML)

http://cade.scope.edu/courseware/notes/mel/index.html
__________________
"Don't worry about the world coming to an end today.
It's already tomorrow in Australia."
---- Charles Schultz


Low - Poly Batman in Maya

Tiamat - The World Dragon (Maquette)


Online Tutorial: Character Rigging for Maya


 
Old 01-26-2003, 12:32 AM   #4
bigfatMELon
Seer
 
bigfatMELon's Avatar
Blizzard
 
Join Date: May 2002
Posts: 340
Send a message via AIM to bigfatMELon
This thread didn't exactly take off like a rocket. Perhaps it needs some feeding. Here is a simple tutorial script that shows how to build and manage a textScrollList from the contents of a string array.

Code:
global proc scrollExample (){ if (`window -ex "scrollWin"`) //does the window already exist? deleteUI "scrollWin"; //if it does, kill it //define the window window //create a window -title "Text Scroll Example" //give it a title -w 250 -h 220 //set width and height "scrollWin"; //give the window a unique name columnLayout -w 250; //create a column text -l "" -h 10; //text spacer textScrollList //set up the scroll list -h 200 -w 240 -ams false //disallow multiple selections -sc "scrollWinUpdateSel" //the command used when an item is selected "swScrollList"; //the control is given a unique, explicit name textField -w 240 "scTextField"; //text field also gets a unique name text -l "" -h 10; //text spacer swUpdateWin; //call a general purpose window update showWindow "scrollWin"; //tell Maya to draw the window } //general purpose window updater. This makes it //easy to refresh the window contents from anywhere //in the script with a single call global proc swUpdateWin (){ string $cams[] = `ls -cameras`; //create an array of all the cameras in the scene string $x; //it's a good idea to declare all variables textScrollList -e -ra "swScrollList"; //clear the scroll list before adding new stuff //the list is now empty for ($x in $cams) //loop over the array with $x textScrollList //fill in the contents of the scroll list -edit //put the command in edit mode -append $x //add every $x in $cams to the scrollList "swScrollList"; //gotta tell it which scroll list to append to } //the selector proc. This is called by the command //attached to the scrollList itself. The -sc flag global proc scrollWinUpdateSel (){ string $sel[] = `textScrollList //define an array for the selection -query //put the command in query mode -selectItem //get the string of the item the user selected "swScrollList"`; //naming controls makes this a snap textField //put the name of the selection in the field -edit //put the command in edit mode -text $sel[0] //text is what we're editing. $sel is that text "scTextField"; //name of the text field }


-jl
 
Old 01-26-2003, 12:21 PM   #5
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
Hi Melon-

I also have procedures to add and remove items from a given textScrollList.


//Procedure adds selected objects to a given textScrollList.
global proc dwAddSelectedObjectsToList (string $textScrollListName)
{
//find out what exists in textScrollList.
string $textInScrollList[] = `textScrollList -q -ai $textScrollListName`;

//find out what´s selected in scene.
string $currentMayaSelection[] = `ls -sl`;

if (size($currentMayaSelection) == 0)
error "Nothing selected.";

//remove all items from textList (need to "refresh" list).
textScrollList -e -removeAll $textScrollListName;

string $allSelectedArray[] = `stringArrayCatenate $textInScrollList $currentMayaSelection`;

string $cleanedSelection[] = `stringArrayRemoveDuplicates $allSelectedArray`;


for ($current in $cleanedSelection)
{
textScrollList -e -append $current $textScrollListName;
}
}



..and to remove selected items from list:

//Procedure to remove selected elements from a textScrollList.
global proc dwRemoveObjectsFromList (string $textScrollListName)
{
string $currentTextSelection[] = `textScrollList -q -si $textScrollListName`;
if (size($currentTextSelection) == 0)
error "Nothing selected in text list.";
for ($currentText in $currentTextSelection)
{
textScrollList -e -ri $currentText $textScrollListName;
}
}



David
 
Old 02-03-2003, 08:21 PM   #6
alexx
Yes, I Listen...
 
alexx's Avatar
Technical Director / 3D Artist
 
Join Date: Feb 2002
Posts: 2,202
not that i want to say this thread is not worthy to be alive (it definitely is, since UI building took me the longest time to learn).. but dont you think that it would be well placed in the other mel scripts sticky thread?
the more sticky threads there are the faster questions plunge to page 2 that most ppl dont read.

how bout it?

cheers

alexx
 
Old 02-04-2003, 10:36 AM   #7
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
Yeah, good point. I also noticed the plethora of sticky threads was kind of overcrowding the normal threads. And yes, I admit it, I never read the second page....
I don't know....maybe there should be a "sticky section" or something where all the sticky threads go...

Quote:
UI building took me the longest time to learn


longer than particle scripting??? I can't believe that!



David
 
Old 02-04-2003, 05:46 PM   #8
bentllama
warrior soul
 
bentllama's Avatar
CGSociety Member
portfolio
nate walpole
motion zealot
USA
 
Join Date: Jan 2002
Posts: 4,908
Send a message via AIM to bentllama Send a message via MSN to bentllama
they are sticky threads for a reason. so you can easily find what you are looking for. myself as well as a few others dont feel it its getting over crowded. as far as posts in this thread and the sticky... any posts with just thanks! great! or other banter that does not contribute actual MEL or MEL links and info will be culled... to effectively organize them into a streamlined resource...

there are some stickies that can be "unstuck" and we will do a better job ensuring that page 1 does not get overcrowded...

if you feel a thread is worthy of page 1 glory, do us all a favour and *bump* it up...

I appreciate your guys' comments on the validity of this thread and stickies in general... thanks.


__________________
bent...
bentllama
...
 
Old 03-20-2003, 11:12 AM   #9
twidup
zombie slaying rugby plyr
 
twidup's Avatar
portfolio
Todd Widup
Sr Creature TD
movielocation
Cardinal Pier, United Kingdom
 
Join Date: May 2002
Posts: 974
I hope its ok to ask UI related questions here, if not, feel free to move this over to the mel forum.
I have used the -w/-h flags on controls before without a problem, and also the position controls for formlayout, but here is the question. Whenever I have tried to use -w/-h for a window, they dont seem to work beyond the first time the window is opened. Is there a secret trick to this or something?

ie: I create a window with no retain flag and -w/-h set. test it, it works but I add a new control to the script, so I close that window, source the script again and it should be a bigger window, but its the same as the previous one, even though the width/height has been changed.

Thanks
-Todd
__________________
Good . . . Bad . . . I'm the guy with the gun.
-Ash

<.|.. My comments are not those of my employer(s)
 
Old 03-20-2003, 01:42 PM   #10
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
Yeah, this stuff with the dimensions of windows/controls has always been a mystery to me as well. Even when you specify explicit w/h it just kinda´does what it wants. The only real way to fix the size of a window in my experience is to use -sizeable 0, but that of course fixes it at the specified size. There´s probably a logic somewhere to this but I stopped searching for it, and it´s not such a big deal for me....


David
 
Old 03-20-2003, 02:02 PM   #11
alexx
Yes, I Listen...
 
alexx's Avatar
Technical Director / 3D Artist
 
Join Date: Feb 2002
Posts: 2,202
there is a logic indeed

usually in your preferences you have a checkbox set (default), that is called:

interface-> Windows: remember size and position

with that one switched on, you can only one specify the width and height of your window. after that maya reads the size out of the following file:

"C:\Dokumente und Einstellungen\yourname\Eigene Dateien\maya\4.0\prefs\windowPrefs.mel"

you can edit that file and throw out the line which has the size for your window.. then you can create it again with your own settings.

cheers

alexx

Last edited by alexx : 03-20-2003 at 02:27 PM.
 
Old 03-20-2003, 02:30 PM   #12
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
Alexx you is the man!


David
 
Old 03-20-2003, 07:47 PM   #13
alexx
Yes, I Listen...
 
alexx's Avatar
Technical Director / 3D Artist
 
Join Date: Feb 2002
Posts: 2,202
you´d better *not* ask me how long it took me to find THAT out

cheers david

alexx
 
Old 03-20-2003, 08:42 PM   #14
twidup
zombie slaying rugby plyr
 
twidup's Avatar
portfolio
Todd Widup
Sr Creature TD
movielocation
Cardinal Pier, United Kingdom
 
Join Date: May 2002
Posts: 974
yeah, thanks a lot alexx.
__________________
Good . . . Bad . . . I'm the guy with the gun.
-Ash

<.|.. My comments are not those of my employer(s)
 
Old 03-24-2003, 07:25 AM   #15
bentllama
warrior soul
 
bentllama's Avatar
CGSociety Member
portfolio
nate walpole
motion zealot
USA
 
Join Date: Jan 2002
Posts: 4,908
Send a message via AIM to bentllama Send a message via MSN to bentllama
Quote:
Originally posted by dwalden74
Yeah, this stuff with the dimensions of windows/controls has always been a mystery to me as well. Even when you specify explicit w/h it just kinda´does what it wants. The only real way to fix the size of a window in my experience is to use -sizeable 0, but that of course fixes it at the specified size. There´s probably a logic somewhere to this but I stopped searching for it, and it´s not such a big deal for me....


David


can't you just use the command

Code:
windowPref -remove myWindowName;


to get rid of your size and position prefs for that window???
__________________
bent...
bentllama
...
 
reply share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:10 AM.


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