TomRaynor Posted April 30, 2013 Share Posted April 30, 2013 A quick one... How do I set up a hotkey for hiding toggling the "Display Background Image" toggle in the "Background" tab of the scene viewer display options. I know there is a little button in the toolbar at the right of the scene viewer window to do the same thing, but I would quite like a hotkey. I couldn't find it in the hotkey editor... Cheers! Quote Link to comment Share on other sites More sharing options...
graham Posted April 30, 2013 Share Posted April 30, 2013 Normally you can Ctrl + Shift + Alt onto various UI elements to bring the Hotkey Manager up with that ui element selected. However, in this case, doing it on any of the buttons in the Display Options toolbar, or the button in the dialog results in a status bar message about the functionality not being available for those gadgets. Quote Link to comment Share on other sites More sharing options...
TomRaynor Posted April 30, 2013 Author Share Posted April 30, 2013 Yeh that is what I was finding... So does that mean that there is no way to assign a hotkey to "Display Background Image"? Even with something like a python script and a shelf tool? Quote Link to comment Share on other sites More sharing options...
Akabane Posted May 2, 2013 Share Posted May 2, 2013 Well, to use a shelf tool you'd need to click on it, thus making it useless, right? You'd do 1 click anyway to activate or deactivate the display of background image from the viewport... Quote Link to comment Share on other sites More sharing options...
graham Posted May 2, 2013 Share Posted May 2, 2013 Sorry, missed the reply. You can create a shelf tool that will do it and Houdini will let you assign a hotkey to the shelf tool (use the Ctrl + Shift + Alt + Click on the tool). The shelf tool needs to run the 'viewbackground' hscript command with the -b option. The only problem is that it also takes the super annoying viewport string thing. The following module has an example of how to construct the string and example of using viewbackground, though with more options which you probably don't need. http://houdinitoolbox.com/houdini.php?asset=17 Quote Link to comment Share on other sites More sharing options...
TomRaynor Posted May 2, 2013 Author Share Posted May 2, 2013 Great stuff, thanks Graham, I'll check out the link and get it sorted! Quote Link to comment Share on other sites More sharing options...
TomRaynor Posted May 2, 2013 Author Share Posted May 2, 2013 Just to clarify, what to I need to provide as an argument to your buildViewPath(viewer_or_scriptargs) script? Mind giving me a code example? Sorry if I am being a bit dim... Quote Link to comment Share on other sites More sharing options...
Fake Pilot Posted August 24, 2013 Share Posted August 24, 2013 Didn't understand what to put in the Script tab. Could you share your solution? Quote Link to comment Share on other sites More sharing options...
yongbin Posted August 28, 2013 Share Posted August 28, 2013 hi, you can use this shelf tool code with hotkey. panename = hou.hscriptExpression('mousepane()').split('.')[-1]pane = hou.ui.findPaneTab(panename)if pane.type() != hou.paneTabType.SceneViewer: raise hou.Error("This tool cannot run in the current pane")desktop = hou.ui.curDesktop().name()panetab = pane.name()camera = pane.curViewport().name()viewport = ".".join([desktop, panetab, "world", camera])viewoptions = hou.hscript("viewbackground {0}".format(viewport))[0].split()bgoption = viewoptions[viewoptions.index('-b')+1]if bgoption == "off": hou.hscript("viewbackground -b on {0}".format(viewport))else: hou.hscript("viewbackground -b off {0}".format(viewport))[/CODE]It is a quick test. So I don't know whether there is a bug. If then, let me know~cheers 1 Quote Link to comment Share on other sites More sharing options...
Fake Pilot Posted August 28, 2013 Share Posted August 28, 2013 That actually works great! Thanks Youngbin. (in script language Python) Is there a way to make it work for Context view too? In Render view, the hotkey is already shift + b. Would be awesome if it worked for all three. Quote Link to comment Share on other sites More sharing options...
yongbin Posted August 28, 2013 Share Posted August 28, 2013 I couldn't find how can I access render view both python and hscript. So here is my last code except that. when I find it, I will post here. def bg_toggle(): panename = hou.hscriptExpression('mousepane()').split('.')[-1] pane = hou.ui.findPaneTab(panename) if pane: if pane.type() == hou.paneTabType.SceneViewer: pass elif pane.type() == hou.paneTabType.ContextViewer: pane = pane.sceneViewer() else: print("This tool cannot run in the current pane") return else: return desktop = hou.ui.curDesktop().name() panetab = pane.name() camera = pane.curViewport().name() viewport = ".".join([desktop, panetab, "world", camera]) viewoptions = hou.hscript("viewbackground {0}".format(viewport))[0].split() bgoption = viewoptions[viewoptions.index('-b')+1] if bgoption == "off": hou.hscript("viewbackground -b on {0}".format(viewport)) else: hou.hscript("viewbackground -b off {0}".format(viewport))bg_toggle()[/CODE] 1 Quote Link to comment Share on other sites More sharing options...
Fake Pilot Posted August 28, 2013 Share Posted August 28, 2013 Oh, don't care if it's Python or Hscript as long it works! And it does. Thank you very much. Very cool! :-) 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.