How to set Active, Visible, Solo in SceneGraph with python

   1514   4   2
User Avatar
Member
260 posts
Joined: Nov. 2014
Offline
Hello all.
Im redoing my group/shading tool from SOPs to LOPs and i would like to know, if there is a way how to toggle Active, Visible, Solo icons inside the Scene Graph Tree with python?
User Avatar
Staff
4441 posts
Joined: July 2005
Offline
Yes. Have a look at this help page: https://www.sidefx.com/docs/houdini/hom/hou/LopViewportOverrides.html [www.sidefx.com]
User Avatar
Member
260 posts
Joined: Nov. 2014
Offline
Thank you.
I have seen it there but had no luck to make it work.
I always get errors about the "with block". So my syntax must be bad.
Docu dais "end of the with block".

Can someone please help me to get the correct syntax?
User Avatar
Staff
4441 posts
Joined: July 2005
Offline
Yu have to create and use a LopViewportOverrides object in a python `with` block, like this (assuuming you first drop a Torus node in /stage):
lopnet = hou.node("/stage")
with lopnet.viewportOverrides(lopnet.node("torus1")) as overrides:
    selrule = hou.LopSelectionRule()
    selrule.setPathPattern("/torus1")
    overrides.setVisible(selrule, False)
User Avatar
Member
260 posts
Joined: Nov. 2014
Offline
Awesome.
Thank you very much for your help.
M.
  • Quick Links