Jump to content

definnegan

Members
  • Content count

    5
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

1 Neutral

About definnegan

  • Rank
    Peon

Personal Information

  • Name
    Dan
  • Location
    Vancouver
  1. Learn something new every day! Thanks for the tip.
  2. 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 #
  3. 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 #
  4. Yeah, this doesn't work like I expected it to. Ignore this, it's probably useless!
  5. 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 #
×