I want to use python to center the current viewport. I've tracked it down to
hou.GeometryViewport().homeAll()
Traceback (most recent call last): File “<console>”, line 1, in <module> File “CPROGRA~1/SIDEEF~1/HOUDIN~1.470/houdini/python2.7libs\hou.py”, line 39628, in __init__ def __init__(self): raise AttributeError, “No constructor defined” AttributeError: No constructor defined
but that doesn't work. I'm not sure what the proper syntax is.
I've also tried: import toolutils viewer = toolutils.sceneViewer() hou.GeometryViewport(viewer).homeAll()
Traceback (most recent call last): File “<console>”, line 1, in <module> TypeError: __init__() takes exactly 1 argument (2 given)
The “viewer” will be a Scene Viewer pane (if one is open). But the scene viewer pane has four viewports (even if you are not in quad view, the four viewports are always there). In my case, my perspective viewport was the third one in the list returned by “viewer.viewports()”. You will probably want some logic in there to choose which viewport to home (or you could loop through and home all of them).