jamesearnest244 Posted November 20, 2020 Share Posted November 20, 2020 Hi, Is there a way to assign hotkeys to specific shading modes in the viewport? I know I can use W to toggle between wireframe and the last selected shading mode, but I'd like to have specific hotkeys for Wireframe Ghost, Flat Wire Shaded, etc. If I use Ctrl+Alt+Shift+LMB, I get a prompt saying the hotkey couldn't be created. BTW, would also be nice to assign hotkeys to Hide Other Objects/Ghost Other Objects, but I'm seeing the same problem there. Thanks! Quote Link to comment Share on other sites More sharing options...
animatrix Posted November 21, 2020 Share Posted November 21, 2020 Hi, You can write some Python code and call these functions inside a shelf tool and assign a hotkey to this shelf tool that can be constrained to SceneViewers only or global depending on how you want to execute them. You can get the viewport under the mouse also. I just get the first available SceneViewer for my workflow. def currentViewportSetToWireframe(): with hou.undos.disabler(): desktop = hou.ui.curDesktop() viewport = desktop.paneTabOfType(hou.paneTabType.SceneViewer) if viewport.isCurrentTab(): view = viewport.curViewport() displaySet = view.settings().displaySet(hou.displaySetType.DisplayModel) displaySet.setShadedMode(hou.glShadingType.WireGhost) def currentViewportSetToHiddenLineInvisible(): with hou.undos.disabler(): desktop = hou.ui.curDesktop() viewport = desktop.paneTabOfType(hou.paneTabType.SceneViewer) if viewport.isCurrentTab(): view = viewport.curViewport() displaySet = view.settings().displaySet(hou.displaySetType.DisplayModel) displaySet.setShadedMode(hou.glShadingType.HiddenLineInvisible) def currentViewportSetToFlatShaded(): with hou.undos.disabler(): desktop = hou.ui.curDesktop() viewport = desktop.paneTabOfType(hou.paneTabType.SceneViewer) if viewport.isCurrentTab(): view = viewport.curViewport() displaySet = view.settings().displaySet(hou.displaySetType.DisplayModel) displaySet.setShadedMode(hou.glShadingType.Flat) def currentViewportSetToFlatWireShaded(): with hou.undos.disabler(): desktop = hou.ui.curDesktop() viewport = desktop.paneTabOfType(hou.paneTabType.SceneViewer) if viewport.isCurrentTab(): view = viewport.curViewport() displaySet = view.settings().displaySet(hou.displaySetType.DisplayModel) displaySet.setShadedMode(hou.glShadingType.FlatWire) def currentViewportSetToSmoothShaded(): with hou.undos.disabler(): desktop = hou.ui.curDesktop() viewport = desktop.paneTabOfType(hou.paneTabType.SceneViewer) if viewport.isCurrentTab(): view = viewport.curViewport() displaySet = view.settings().displaySet(hou.displaySetType.DisplayModel) displaySet.setShadedMode(hou.glShadingType.Smooth) def currentViewportSetToSmoothWireShaded(): with hou.undos.disabler(): desktop = hou.ui.curDesktop() viewport = desktop.paneTabOfType(hou.paneTabType.SceneViewer) if viewport.isCurrentTab(): view = viewport.curViewport() displaySet = view.settings().displaySet(hou.displaySetType.DisplayModel) displaySet.setShadedMode(hou.glShadingType.SmoothWire) For changing the visibility of other objects, you might have to call an Hscript command in Python. 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.