PDA

View Full Version : How to set undocumented UI colors?


SyncViewS
08-31-2009, 11:41 PM
Hi guys, I'm trying to set some interface colors by MaxScript using colorMan interface. Unfortunately the colors I'm looking for are listed in Max customization panel, but aren't specified in MaxScript Reference, which shows only a bunch of them. Is there a way to access those undocumented color settings? A way to make Max list them?

Thank you.

- Enrico

denisT
09-01-2009, 01:11 AM
Hi guys, I'm trying to set some interface colors by MaxScript using colorMan interface. Unfortunately the colors I'm looking for are listed in Max customization panel, but aren't specified in MaxScript Reference, which shows only a bunch of them. Is there a way to access those undocumented color settings? A way to make Max list them?

Thank you.

- Enrico

what do you know about color which you want to change? is it its id, or name and category?

SyncViewS
09-01-2009, 06:45 AM
If I get it right I need the ID to change the color through:

<boolean>colorMan.setColor <string>color <point3>colorValue
where <string>color is the ID
I'd like to change the 3D Painter system colors, so according to the Customize User Interface, Color panel, I should have in example:

category: "3D Painter"
name: "Gizmo Color", "Mirror Reproject", "Normal Color", ..., and so on

I miss the ID. With a fast test I found out numbers from 1 to 9 are associated to colors from "Track View" category, but couldn't discover anything else.

How do I get the color ID? Thanks :)

- Enrico

denisT
09-01-2009, 03:48 PM
To get and set color with colorMan interface you have to know the name of the color which this color was registered. You don't know the name for custom colors. Here is a workaround:

1. Max stores color settings in *.clr file. It's the same as INI file format. You can use setINIsetting and getINIsetting.
2. To get current UI color file:

ini = colorMan.getColorFile()

3. Find colors that match your search:

count = (getINIsetting ini "CustomColors" "NumColors") as integer
for k=0 to count-1 do
(
index = "_" + (k as string)

id = getINIsetting ini "CustomColors" ("ID"+index)
col = getINIsetting ini "CustomColors" ("Color"+index)
name = getINIsetting ini "CustomColors" ("Name"+index)
category = getINIsetting ini "CustomColors" ("Category"+index)

-- if <here is your conditions> do <...>
)



4. Code and Decode Color Value:

fn getColor col =
(
c = col as integer
r = mod c 256
g = mod (c/256) 256
b = mod (c/1024) 256

((color r g b) as point3)/255
)

fn setColor c = -- c as point3 ([1,1,1] == white)
(
c = (c*255) as color
c = 1024*(c.b as integer) + 256*(c.g as integer) + (c.r as integer)
col = c as string
)


5. Set new color with setINIsetting ini ...
6. Reload clr file (colorMan.loadColorFile ini) or colorMan.repaintUI #repaintAll

I don't know easier way. Maybe anyone else knows.

SyncViewS
09-01-2009, 06:30 PM
That's awesome! Thank you very much Denis for your effort. I'll make good use of that :D

- Enrico

p.s.
As soon as I'm done with PainterInterface based tools, I'll start implementing your doped mouseTrack :D

CGTalk Moderation
09-01-2009, 06:30 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.