krueger This one is cleaned up a little bit, also adding the option to run over every scene view or just the active one. Adding a hotkey for the scene viewer will make it work on whichever scene view your mouse is over too.
deftoggleNulls(toggleAllViewers=True):importtoolutils# Check to see if the nulls were toggled already.if"nullsVisible"indir(hou.session):visible=hou.session.nullsVisibleelse:visible=Truehou.session.nullsVisible=visibletry:desktop=hou.ui.curDesktop().name()pane=toolutils.activePane(kwargs).name()views=hou.hscript("viewls -n")[0].split("\n")ifvisible:toggle="-"else:toggle="+"# Toggle viewersiftoggleAllViewers:forviewinviews:hou.hscript("vieweroption -V '%snull' '%s'"%(toggle,view))else:# Find the viewer name for hscript.forviewinviews:if(desktopinview)and(".%s."%(pane)inview):hou.hscript("vieweroption -V '%snull' '%s'"%(toggle,view))# Change the stored variable.hou.session.nullsVisible=notvisibleexcept:print"No scene view open."# Toggle current viewertoggleNulls(toggleAllViewers=False)# Toggle all viewers#toggleNulls()
Hey Krueger,
would you be so kind to update your script to Houdini 19? It's not working for me. maybe because of PY3?
deftoggleNulls(toggleAllViewers=True):importtoolutils# Check to see if the nulls were toggled already.if"nullsVisible"indir(hou.session):visible=hou.session.nullsVisibleelse:visible=Truehou.session.nullsVisible=visibletry:desktop=hou.ui.curDesktop().name()pane=toolutils.activePane(kwargs).name()views=hou.hscript("viewls -n")[0].split("\n")ifvisible:toggle="-"else:toggle="+"# Toggle viewersiftoggleAllViewers:forviewinviews:hou.hscript("vieweroption -V '%snull' '%s'"%(toggle,view))else:# Find the viewer name for hscript.forviewinviews:if(desktopinview)and(".%s."%(pane)inview):hou.hscript("vieweroption -V '%snull' '%s'"%(toggle,view))# Change the stored variable.hou.session.nullsVisible=notvisibleexcept:print("No scene view open.")# Toggle current viewertoggleNulls(toggleAllViewers=False)# Toggle all viewers#toggleNulls()
me and my animation team would love to be able to do this with polygons! can i simply replace the nulls flag with something else to make this work? i am pretty limited in my houdini and python knowledge here..... as far as i can tell it may not be polygons in houdini but "characters" ...so sorry for the dumb question
pbinga me and my animation team would love to be able to do this with polygons! can i simply replace the nulls flag with something else to make this work? i am pretty limited in my houdini and python knowledge here..... as far as i can tell it may not be polygons in houdini but "characters" ...so sorry for the dumb question
Hey, can you explain more what you're trying to toggle? It's been a few years, but this is using the hscript command vieweroption so these are the options:
-V ‹visibilitystring›
Set object level visibility by supplying a space separated string of tokens. Each token takes the form '+‹type›' or '-‹type›' where type is one of: *, geo, cam, light, muscle, bone, null, blend, other, or popguide.
were using the apex animate stage in houdini 20.5 and wanting to be able to globally toggle the char vis of all characters on and off with a hotkey rather than per selection set.
I haven't used apex before, but you can try using the script above but just change the 2 lines that actually specify the "null" to use "geo". So these 2 lines: