Python hou.viewportColorScheme

   1661   4   1
User Avatar
Member
36 posts
Joined: 1月 2014
Offline
Hi,

I'm having a hard time trying to change the background color scheme via the viewportColorScheme module. For one, the class isn't mentioned in the help.

A little help would be appreciated

Thanks!

Max
User Avatar
Member
106 posts
Joined: 6月 2011
Offline
Here you go

import toolutils
# Get the viewports from the sceneviewer
scene_viewer = toolutils.sceneViewer()
viewports = scene_viewer.viewports()
print(viewports)
>> (<hou.GeometryViewport right1 of type Right>, <hou.GeometryViewport front1 of type Front>, <hou.GeometryViewport top1 of type Top>, <hou.GeometryViewport persp1 of type Perspective>)
# Choose the viewport you want to change the color scheme
persp_viewport = viewports[-1]
viewport_settings = persp_viewport.settings()
viewport_settings.setColorScheme(hou.viewportColorScheme.Dark)

Hope it helps
-J
User Avatar
Member
36 posts
Joined: 1月 2014
Offline
That's awesome!

Is this anywhere to be found in the hou module help? I found myself circling over and over and I didn't see anything regarding toolutils. Would you mind providing a bit more insight as to how you found this please?

Thanks again for your help J.

Max
User Avatar
Member
106 posts
Joined: 6月 2011
Offline
Hi Max,

toolutils is not part of hou. It's part of the houdini python libs. You can find it here

$HFS/houdini/python2.7libs/toolutils.py

I don't think there's an official documentation page. Please check out these links.

https://jtomori.github.io/houdini_additional_python_docs/toolutils.html [jtomori.github.io]

Documentation for Other modules can be found here

https://jtomori.github.io/houdini_additional_python_docs/ [jtomori.github.io]

Having said that, you could use hou to achieve the same thing.

scene_viewer = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)
viewports = scene_viewer.viewports()
print(viewports)
>> (<hou.GeometryViewport right1 of type Right>, <hou.GeometryViewport front1 of type Front>, <hou.GeometryViewport top1 of type Top>, <hou.GeometryViewport persp1 of type Perspective>)
# Choose the viewport you want to change the color scheme
persp_viewport = viewports[-1]
viewport_settings = persp_viewport.settings()
viewport_settings.setColorScheme(hou.viewportColorScheme.Dark)

Cheers
-J
User Avatar
Member
36 posts
Joined: 1月 2014
Offline
Thanks again J

I will look into this documentation.
  • Quick Links