Jump to content

shelf tool solution to certain Houdini viewport bugs


Recommended Posts

I often run into problems with the houdini viewport, particularly working with volumes, where things get "stuck" in the viewport or are otherwise inaccurately represented.  I'll have the display flag on a null, have "hide other objects" turned on, and still some volume I was looking at 5 minutes ago remains in the viewport.  Or, for another fun example, everything just all of a sudden becomes the same color as the background viewport color and I can only see where things are by turning on point display.  

 

The only solution I've found is to close the scene view and open another one, which trashes all your viewport settings (visibility, camera view, normals display, selection settings, pinning, everything), so then you gotta go clicking around resetting everything, and then the viewport craps out again 5 minutes later.

 

I finally got sick of doing that, so I whipped up a little shelf tool that has the effect of fixing some of the bogus display issues that I've encountered, and somehow maintaining all the viewport settings (nothing clever there, I just got lucky).  It identifies all the scene viewers in your desktop, turns them into textports, and then turns them back into scene viewers.  Here's the tool, I hope it saves you some time and frustration.  Enjoy!

 

 

 

####get list of panes####
panes = hou.ui.paneTabs()
viewers = []
####identify scene viewers####
for p in panes:
    if p.type() == hou.paneTabType.SceneViewer: 
        viewers.append(p)
###turn scene viewers into textports, then back into scene viewers####       
for v in viewers:
    trickview = v.setType(hou.paneTabType.Textport)
    newview = trickview.setType(hou.paneTabType.SceneViewer)
# Dan Finnegan, FX TD: definnegan@gmail.com #
 

 

Edited by definnegan
Link to comment
Share on other sites

This actually works, I changed the script to just delete any current scene views and make new ones in any panes that they exist in.  You lose all your scene viewer settings, but you save a few seconds not having to close your scene view and create a new one.

 

 

¡¡¡¡WARNING!!!!  Don't run this if you have a pane open that contains only 1 tab, and that tab is a scene viewer, unless you love crashing houdini.

 

 

 

####get list of panes####
panes = hou.ui.paneTabs()
sceneviewers = []
####identify scene viewers####
for p in panes:
    if p.type() == hou.paneTabType.SceneViewer: 
        sceneviewers.append(p)
###delete current scene viewers and create replacements ####       
for v in sceneviewers:
    pane = v.pane()
    pane.createTab(hou.paneTabType.SceneViewer)
    v.close()
# Dan Finnegan, FX TD: definnegan@gmail.com #
Link to comment
Share on other sites

So far I've picked up that volumes and particles tend to be the things that get stuck in the viewport. Is anyone getting polygons or other things stuck too?

 

Thanks!

Link to comment
Share on other sites

Would be nice if until they figure out the root cause of the problem that SESI could just added a proper opengl refresh function to python, or a refresh button on the viewport itself. Something like  hou.ui.refreshOpenGl()  and it completely blew out the gl buffer and re-initialized it from scratch with the same display settings.. Anything to just flush it and rebuild it would be nice. It's rather disurptive to have my viewport set nicely for whatever I'm working on, and then having to close it because some geo got stuck, then have to open a new tab, set my display options back to what I had it (say dark for volumes, certain attributes displayed, etc), and then get back to work.    Volumes and particles tend to be the worst, but I've been working with a lot of geometry lately, and it also happens with geo too. 

Link to comment
Share on other sites

Yeah - maybe Rfe a 'break in emergency' style command that refreshes everything but keeps settings.

 

Perhaps if/when Vulkan gets implemented the whole architecture can put on new foundations that abstracts the way the viewport is updated.

Link to comment
Share on other sites

  • 2 weeks later...

I found some time to polish the script up a bit, and I'm pretty happy with how it turned out.  Forget my previous posts, this script is the real deal.  It'll retain your camera settings (if you've got one set, otherwise it retains your persp transformations).  It also retains all the viewport settings that I could pythonically/hscript-onically script.

On a side[fx] note, if you're reading this, why not not list every hscript command when one runs exhelp?  I've always relied on exhelp to look up hscript commands, and just recently learned that there are so many more documented online than are listed via exhelp.  And they're useful!  Every hscript command I used in this script is unlisted via exhelp and has a python equivalent that is, as far as I know, "not yet implemented".

 

 

 

#####get list of panes####
panes = hou.ui.paneTabs()
sceneviewers = []
curDesktop = hou.ui.curDesktop()
desktopName = curDesktop.name()
#####identify scene viewers####
for p in panes:
    if p.type() == hou.paneTabType.SceneViewer: 
        sceneviewers.append(p)
####delete current scene viewers and create replacements ####       
for v in sceneviewers:
    ###collect viewport settings####
    Pin = v.isPin()
    linkGroup = v.linkGroup()
    GroupListColoringGeometry = v.isGroupListColoringGeometry()
    GroupListShowingEmptyGroups = v.isGroupListShowingEmptyGroups()
    GroupListVisible = v.isGroupListVisible()
    GroupPicking = v.isGroupPicking()
    PickingCurrentNode = v.isPickingCurrentNode()
    PickingVisibleGeometry = v.isPickingVisibleGeometry()
    SecureSelection = v.isSecureSelection()    
    WholeGeometryPicking = v.isWholeGeometryPicking()
    PickFacing = v.pickFacing()
    PickGeometryType = v.pickGeometryType()
    PickModifier = v.pickModifier()
    PickStyle = v.pickStyle()
#####get old scene viewer name, create new viewer, and get its name.###################################    
    pane = v.pane()
    currentName = v.pane().desktop().name() + "." + v.name() + ".world" + "." + v.curViewport().name()
    newview = pane.createTab(hou.paneTabType.SceneViewer)
    newName = newview.pane().desktop().name() + "." + newview.name() + ".world"
    newNamePersp = newview.pane().desktop().name() + "." + newview.name() + ".world" +"." + newview.curViewport().name()
#####if old scene viewer was looking through a camera, make new scene viewer look through
#####the same camera.  If not, match the persp view of the new viewer to the persp view of the old
    camera = v.curViewport().camera()
    if camera is None:
        viewTransform = hou.hscript("viewtransform -p %s"%currentName)[0]
        newTransform = viewTransform.replace(currentName, newNamePersp)
        hou.hscript("%s"%newTransform)        
    else:
        newview.curViewport().setCamera(hou.node(camera.path()))        
    hou.hscript("viewcopy %s %s"%(currentName, newNamePersp))  
###set the new viewer to "hide other objects", to prevent unwanted cooking 
####set the left viewport toolbar to be visible, because why would you not want it do be...
    hou.hscript("vieweroption -a 0 %s"%newName)
    hou.hscript("viewerstow -l open %s"%newName)
####set viewport settings############
    newview.setPin(Pin)
    newview.setLinkGroup(linkGroup)
    newview.setGroupListColoringGeometry(GroupListColoringGeometry)
    newview.setGroupListShowingEmptyGroups(GroupListShowingEmptyGroups)
    newview.setGroupListVisible(GroupListVisible)
    newview.setGroupPicking(GroupPicking)
    newview.setPickingCurrentNode(PickingCurrentNode)
    newview.setPickingVisibleGeometry(PickingVisibleGeometry)
    newview.setSecureSelection(SecureSelection)
    newview.setWholeGeometryPicking(WholeGeometryPicking)
    newview.setPickFacing(PickFacing)
    newview.setPickGeometryType(PickGeometryType)
    newview.setPickModifier(PickModifier)
    newview.setPickStyle(PickStyle)
##########################################################################  
    v.close()
## Dan Finnegan, FX TD: definnegan@gmail.com #
Edited by definnegan
  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Because I'm not that fluent with programing (closer to... "at all"), is there a way to prevent this script from going up few levels (until on object level) if you are in vopsop? Pinning does the trick, but I have to pin it everytime I want to refresh.

 

But aside of that: GREAT script. It will be quite often used. Thank you.

Edited by ChargingImage
Link to comment
Share on other sites

I keep experiencing a complete viewport fritz when playing the Crowd Sim, which I guess it particle based. This bug does not exist in H14.396 (which is what I am currently using) but was introduced in all builds after that. I have reported it and SESI sent me an email that they are looking into it. After the "fritz" nothing can be drawn in the viewport. Restart Houdini

 

It looks like this...

post-12295-0-48913300-1443532689_thumb.j

Edited by Atom
Link to comment
Share on other sites

I keep experiencing a complete viewport fritz when playing the Crowd Sim, which I guess it particle based. This bug does not exist in H14.396 (which is what I am currently using) but was introduced in all builds after that. I have reported it and SESI sent me an email that they are looking into it. After the "fritz" nothing can be drawn in the viewport. Restart Houdini

 

It looks like this...

 

You could check a few things: try clearing the OpenGL Texture/Vertex Cache in the menu Window/Cache Manager. Under Optimise in Display Option try modifying the 'Crowd Agents' values. Also in Display Options, the top right 'i' will give some info about the framebuffer.

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...