PDA

View Full Version : creating linked color GUI controls?


seven6ty
11-11-2005, 11:11 PM
Ok, so I'm trying to create something in MEL that is like the colorAttrSlider thing, and what is in the attribute editor.

Basically, I need a color swatch, with a slider next to it to control the value (of an HSV color type) that controls the lightness to darkness of this. These two need to be linked.

Then, when you click the color swatch, I need to have it bring up the colorEditor, and have that tied into the color swatch (and value slider), so that when you change the colors in the colorEditor, the color swatch on the gui updates as well. Got me? Here's what I have so far:


{
if (`window -exists colors`)
deleteUI colors;
window -title "Colors" -widthHeight 180 100 colors;

rowLayout -numberOfColumns 2 -columnWidth2 30 150 color1Row1;
canvas -width 25 -height 25
-pressCommand "colorEditor" colorCanvas1;

if (`colorEditor -query -result`) {
float $values[] = `colorEditor -query -hsv`;

print `colorEditor -query -hsv`;
};
floatSlider
-min 0.0 -max 1.0
-width 145
-value 1.0
-step .05
-changeCommand "$color1BW = `intSlider -query -value`;" color1Slider;

showWindow colors;

window -e -widthHeight 180 50 colors;

};

However, these three values (slider, swatch and colorEditor) are not all connected yet, anyone have some help to offer on this one?

sunit
11-12-2005, 12:40 AM
why not use the "colorSliderGrp"?


window;
columnLayout;
colorSliderGrp -label "Blue" -rgb 0 0 1;
colorSliderGrp -label "Green" -hsv 120 1 1;
showWindow;


-sunit

seven6ty
11-12-2005, 12:58 AM
Yeah, I've been experimenting with this. I keep having trouble with how it displays everything though, it always seems to be placed much further right than I would like, I'm trying to fit it all into a nice tight GUI. Do you know how to go about aligning all of this further left and such?

I'd much rather the freedom of placing things by doing it on my own, which is one reason I wasn't so big on this. Oh, and also, do you know if there's any way to control the size of the swatch/canvas button?

CGTalk Moderation
11-12-2005, 12:58 AM
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.