accessing viewport camera

   6884   2   1
User Avatar
Member
277 posts
Joined: July 2006
Offline
Hi!

Is it possible to access “viewport camera” in Houdini?

I'm talking about camera, which user is looking through, even if he isn't looking through “camera object”.

I think, that normally when user is looking in viewport, we should be able to access properties of vieport (angles, x,y,z, etc) - are we?

Thank you
User Avatar
Member
1926 posts
Joined: Nov. 2006
Offline
You can get a transform matrix from the viewport view in Houdini 11 by finding the perspective viewport associated with the viewer pane tab.

In H11 you can now drag the tab into a Python shell and get a reference to that pane. It should give you an instance for hou.SceneViewer. Assuming you just have the perspective viewer showing you can use hou.SceneViewer.curViewport() to get the hou.GeometryViewport you are actually looking through. You can then call hou.GeometrtyViewport.viewTransform() to get that matrix.

If you want to do it using a script you'll have to find the pane tab more manually. If it's from a tool you can use toolutils.activePane(kwargs) to find the viewer, or if it isn't you'll have to use hou.ui.curDesktop() to get the desktop information then look for a viewport using hou.Destop.paneTabOfType(hou.paneTabType.SceneViewer)
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
277 posts
Joined: July 2006
Offline
Graham as always you're infinite python knowledge book ;]

Thank you
  • Quick Links