magneto Posted March 7, 2015 Share Posted March 7, 2015 Hi, I am trying to write some shelf scripts so I can assign them hotkeys for the viewport. So far I only found viewdispset command but whatever I try, it says "invalid usage". It would be nice if these functions had examples in the help. I am not sure if I am supposed to provide strings or just values by themself, etc. It's very confusing. I tried this last: viewdispset -m on display "Build.panetab1.world" I want a single hotkey to turn it on and off based on whether it's already on or off. Thanks Quote Link to comment Share on other sites More sharing options...
pezetko Posted March 7, 2015 Share Posted March 7, 2015 Hi, there is help in Textport, Just open Textport view and type: help viewdispset To be able to do switching you need to read current state from somewhere. There is python example (modified shelf tool from qLib) that toggle point diplay on and off. Add this script as shelf button: import toolutils pt = None try: # cycle pts = hou.session.pt[:] pts = pts[1:]+pts[:1] pt = pts[0] hou.session.pt = pts except: # set up default vars hou.session.pt = ['on', 'off'] pt = hou.session.pt[0] pts = { 'on':'on', 'off':'off'} hou.hscript("viewdispset -m %s on scene *" % pts[pt].lower()) hou.ui.setStatusMessage("Display points %s" % pts[pt].lower()) 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 7, 2015 Author Share Posted March 7, 2015 Thanks pezetko, I tried it just now, everything seems to be set correctly i.e. hou.session.pts but I don't get any change in point number display. Am I doing something wrong? I added it to a new shelf button. Quote Link to comment Share on other sites More sharing options...
pezetko Posted March 8, 2015 Share Posted March 8, 2015 (edited) In posted example there is -m flag on line number 17 that toggle point markers only. If you want to toggle point numbers you need to use -c flag. For point normals there is -n flag etc. All flags are described in help (Texport: help viewdispset). Like this for point numbers: viewdispset -c on on scene * Or for point normals: viewdispset -n on on scene * For turning on all at once (point markers, numbers and normals) you can use e.g.: viewdispset -m on on -c on on -n on on scene * Or call viewdispset three times, each time with different flag. Edited March 8, 2015 by pezetko 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 10, 2015 Author Share Posted March 10, 2015 Thanks pezetko, I just tried them but I get nothing. I tried the commands you posted directly in texport, still I don't see any change in point numbers or normals. For example I used this in texport: viewdispset -n on on scene * which makes me think it's not the command but the pane where sceneviewer is located? Mine is inside a floating pane on another screen. Does that matter? I specified it clearly using Build.panetab1.world (acquired from viewls), with and without quotes but no luck. These commands are extremely unintuitive. Some examples in the help would be nice. Quote Link to comment Share on other sites More sharing options...
pezetko Posted March 10, 2015 Share Posted March 10, 2015 If you are not in Scene context, but in geometry context try to use different display_set: viewdispset -n on on display * It depends on your display settings (if there is unique settings applied or if the setting is copied from different display set). 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 10, 2015 Author Share Posted March 10, 2015 Thanks pezetko, display seems to work much better 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.