Jump to content

smooth shaded through python


newbee

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"

Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...