LC #42 Pipers Alley

View Full Version : Ui creation help..

08-31-2005, 09:55 AM
Ok when I say I need help for UI creation I mean that I'm a total newb at it :blush: so please forgive me.
Kinda weird but I've been doing mel for 1 year now or a bit more and never really had to dig the big UI stuff so don't really know where to start.

What i'm trying to do at first is simple enough but I can't seems to find the button..sorry (I've look in the help of course and couldn't find it).

I'd like first to create a simple Ui with two color button that I can query (i need to query the color).
that's seems easy enough but can't find that type of button.

In another UI I have to create I'd need it to updated to a certain degree undestanding that there is a number of characters in a scene and I'l like the UI to updated and list those character with the name and a colorButton next to each one.(to list the character let say that there are all name something like Char:nameOfCharacter).
I'd also like the UI to remember the value of of the color in each case, if i ever have to close and open UI.

Any advise, script I can dig that look like it or other tips are very welcome.

thanks a lot


forget first part found it..of course is the colorSliderGrp sorry didn't look because i saw slider and didn't think it was what I was looking for..

08-31-2005, 09:21 PM
What are the colors for? Just for visual display purposes in the UI? do you want to be able to change the colors? Does changing the colors do anything to the characters? I did something similar with the updating character name UI but need more information on what you want with the colors. Do you want the colors to be the same when you reopen the scene another time or just the same while Maya is open?

09-01-2005, 06:50 AM
Hi thanks for answering,

the color needs to be change in order to change things on the rendering.

I've figure it out for the first part, wasn't too hard.i'm right now digging the optionVar variables to be able to keep the the color constant between each opening of the UI but it's not that well documented so i struggle at that.

Still need a way to Updated the Ui in fonction of a number of characters present in the scene, haven't looked at it just yet, but will during the day normally.
If you can lead me on that will be great.

thanks mate


09-01-2005, 05:53 PM
Do you have any set method of putting character in a scene? Are they under a group node? What I previously did if the characters are at the root of the scene, named as you said, so once you have the outliner opened it will look something like this:


Then the code to get those is:

string $prevSelected[] = `ls -sl`;
select -ado; // select all root level DAG objects
string $rootObj[] = `ls -sl`; // assign all root level objects to $rootObj[];
string $charNames[] = {};

// Goes through all the root objects
for ($node in $rootObj) {
if ("Char" == `substitute "_.*" $node ""`) // If the object is a character
$charNames[`size($charNames)`] = $node; // add the object to the $charName
select $prevSelected;

// Now add a button for every character in the scene.
// You can change this code depending on the type of
// control you want per character
for ($char in $charNames) {
button -l $char;

09-02-2005, 09:11 AM
ok thanks a lot, I just figure it out actually that you could loop in Ui and create button ect, so yeah it's much easier than i thought..thanks a lot for the help.


09-02-2005, 09:16 AM
mmm..Btw there is an even easiest way to select all char in the scene (just by looking at your code)

string $char[] =`ls "char_*"`;

it will save you a couple of line next time..sorry i'm just such a lazy typer that I always go the shortest way..(probably you knew that already anyway, but it's just in case)

thanks again

09-02-2005, 02:00 PM
you can't query the button -bgc.

09-02-2005, 11:31 PM
yes but I don't use the button command for I said above you have to use the "colorSliderGrp" and query the rgb value.


CGTalk Moderation
09-02-2005, 11:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.