Jump to content

Scene viewport : Set path from node button press


LaidlawFX

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

Link to comment
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.

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