skyros Posted November 14, 2017 Share Posted November 14, 2017 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 Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted November 14, 2017 Share Posted November 14, 2017 I think you can do it with the hou.ui module using the pane classes, last time I tried though(month or so ago) most of the pane functions crashed Houdini so I never really did much with it. Quote Link to comment Share on other sites More sharing options...
malexander Posted November 14, 2017 Share Posted November 14, 2017 You'll need to iterate through the pane tabs in the current desktop to find one whose type is SceneViewer, then: hou.curDesktop().paneTabs()[ index_of_viewort_tab ].setType( hou.CompositorViewer) Quote Link to comment Share on other sites More sharing options...
skyros Posted November 16, 2017 Author Share Posted November 16, 2017 (edited) 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 November 16, 2017 by skyros 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.