[MAXScript] ViewPort Background Color

Hello every one, I hope it is okey to post topics about MAXScripts here.

I’m trying to quickly change the background colour of my viewport to black through the Listener. I type:

setVPortBGColor(color 0 0 0)

and I get this output:

(color 0 0 0)

But still, the viewport is grey, nothing happens.

Any suggestions on how to fix this? What I’m trying to create in the end is a simple UI icon that toggles between grey (standard) and black viewport colour.

Cheers!

setVPortBGColor seems to be broken in max 2010. As an alternative you can use:


SetUIColor 41 (color 0 0 0)
colorMan.repaintUI #repaintAll

Ha! That’s awesome, thanks mate! :smiley: :smiley:

Yeay! I finally got it working! :smiley:

This is my first MAXScript ever! :slight_smile: Its function is very straight forward; it allows you to quickly toggle between the standard grey and pitch black colour of all the viewports.

The black viewport makes it easier to see particles when working with Particle Flow and the standard grey is my prefered option when working with other stuff. So this is simply an easy way to toggle back and forth between workflow.

Here’s the final code that got it to work for me:

CurrentColor = (GetUIColor 41*255) as color

if CurrentColor != color 0 0 0 then
(
SetUIColor 41 (color 0 0 0)
colorMan.repaintUI #repaintAll
)
else
(
SetUIColor 41 (color 131 131 131)
colorMan.repaintUI #repaintAll
)

Feel free to try it out, you can download it here:http://www.nanne-san.com/files/maxscripts/NannesViewportColourSwitch01.ms

Let me know if there are any bugs. It works for me in max 9 and 2010.

Cheers mate, thanks for your help! :slight_smile:

A similar topic on scriptspot:
http://www.scriptspot.com/forums/3ds-max/general-scripting/viewport-background-toggle

Yes, I saw that and I tried my best from what I red there before posting here. But I didn’t get a hang of it until you pointed out what I was suppose to look for, thanks! :slight_smile: