Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I register the color of the viewport in the shelf?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
amaterasu-qbb
847 Views, 3 Replies

How do I register the color of the viewport in the shelf?

I am currently registering the ColorPreferencesWindow to the shelf.

How do I register the color of the viewport on the shelf?

For example, a white or light blue flat.

I know that the viewport color can be set in the ColorPreferencesWindow;.

 

キャプチャ2.PNGI know that I can set it with Background and change it with Alt+B.

Please teach me.

 

3 REPLIES 3
Message 2 of 4

Hi @amaterasu-qbb,

 

By running "Echo all commands" in the script editor, you can see actions and their direct code. These code lines can be pasted into a shelf button (A new button can be made by right-clicking the desired shelf).

 

This can be used for almost any function within Maya. For this one however, an extra step is needed.

For example, for the background slider we find "updateRGBcolor background;". We'd expect to see color information, so that tells us that the color is not being imparted through Mel. In cases like this, the command echoed will have a page usually detailing it's functions, known as flags.

Searching RGBcolor background finds this script page displayRGBColor command, which discusses the flags the command is capable of receiving.

 

We can then use this information to put it all together in a button:

// Set the background colour to red
displayRGBColor background 1 0 0;
Message 3 of 4

I'm too dumb to understand the programming.

I know how to access Help, but I don't know what it is explaining. I don't know the process in that order either.
I can't make an example of what I need to do.

 

image.png

Is this RGB, 0 to 1.0?RGB, 0 to 255?HSV?

Message 4 of 4

ah. I see. I get it.
First, create the color you want with RGB, 0 to 255, and then look at it later with RGB, 0 to 1.0. If you enter the RGB, 0 to 1.0 values in RGB order and separate them with commas, you can save them in mel.
Save it to the shelf as well.

Thank you very much.

Create color first with RGB, 0 to 255Create color first with RGB, 0 to 255Copy paste the value.Copy paste the value.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report