Jump to content
newbee

smooth shaded through python

Recommended Posts

Hi, try to follow this F1's code:

 

 

This should work:

import hou

settings = hou.ui.curDesktop() \
                 .paneTabOfType(hou.paneTabType.SceneViewer) \
                 .curViewport() \
                 .settings()

dispset = settings.displaySet(hou.displaySetType.DisplayModel)
dispset.setShadedMode(hou.glShadingType.Smooth)

More about display models here:
http://www.sidefx.com/docs/houdini/hom/hou/GeometryViewportDisplaySet.html

Please note, that there are different settings for the top level (OBJ) and different settings when you are inside GEO node:

markersDisplayModel = settings.displaySet(hou.displaySetType.DisplayModel) # when inside "/obj/geosomething"
markersSceneObject = settings.displaySet(hou.displaySetType.SceneObject)  # when in top level "/obj"

Share this post


Link to post
Share on other sites

@newbee you need Houdini >= 16.0 to use it. You can use hou.hscript() function from Python:

'''Set geometry display mode for Houdini before version 16.0.'''

import hou
import toolutils

mode = 'shade'
display_set = 'display' # For display geometry inside SOP context.
viewport = '%s.%s.world' % (hou.ui.curDesktop().name(),
                            toolutils.sceneViewer().name())

command = 'viewdispset -s %s %s %s' % (mode, display_set, viewport)
hou.hscript(command)

 

Edited by f1480187
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×