Jump to content
LaidlawFX

Scene viewport : Set path from node button press

Recommended Posts

Hello,

I am trying to set the path of the current scene viewport via a button press from a hda.

I know these python docs below are the key, but I can't seem to tie the relevant python functions together. 

https://www.sidefx.com/docs/houdini/hom/hou/PaneTab.html

https://www.sidefx.com/docs/houdini/hom/hou/PathBasedPaneTab.html

https://www.sidefx.com/docs/houdini/hom/hou/SceneViewer.html

https://www.sidefx.com/docs/houdini/hom/hou/GeometryViewport.html

Any help would be great. 

Thanks,

-Ben

Share this post


Link to post
Share on other sites

Ok I figured it out a bit based on this chat.

This code was put into the Python Source Editor. If you have a geometry object /obj/geo1 in your scene, it will change the path of the SceneViewer to node. It will do a simple check if it is pinned and pin it. Probably could use a bunch of exceptions...

import hou
node = hou.node('/obj/geo1')
scene_pane = hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer)
if scene_pane.isPin() :
    scene_pane.setPin(False)
scene_pane.setPwd(node)
scene_pane.setPin(True)

https://www.sidefx.com/docs/houdini/hom/hou/ui.html

to

https://www.sidefx.com/docs/houdini/hom/hou/Desktop.html

which needs one of these

https://www.sidefx.com/docs/houdini/hom/hou/paneTabType.html

Then you can use these.

https://www.sidefx.com/docs/houdini/hom/hou/PathBasedPaneTab.html

Hope that helps future me, and other fine folks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×