Jump to content

Switching Views using python/hscript


skyros

Recommended Posts

I'm in the middle of making an otl for our artists and was wondering if there is a way to switch Houdini's viewport panes between Scene View and Composite View.  I haven't found the proper help files for manipulating Houdini's layout through scripting.

Thanks

Mike

Link to comment
Share on other sites

Thanks for the heads up Mark.  That was enough for me to search around a little more in the help files.

I have to say I found referencing UI elements a bit confusing since there seem to be several ways to look up different elements.  I ended up changing 'setType' to 'setIsCurrentTab', since I didn't want to actually change the tab but rather which one was selected.  If you have some thoughts on how I could improve this I would appreciate it.

 

import hou

class TabSwitch:
    """
    Switch viewport tabs based on user input
    """
    
    def __init__(self):
        self.comp       = hou.paneTabType.CompositorViewer
        self.scene      = hou.paneTabType.SceneViewer
    
    def getTab(self, tab):
        paneTabs = hou.ui.paneTabs()
        for pt in paneTabs:
            if(pt.type() == tab):
                pt.setIsCurrentTab()    
                              
ts = TabSwitch()       
ts.getTab(ts.comp)

 

 

Edited by skyros
  • Like 2
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...