Jump to content

Is there a way to write scripts that toggle point numbers/normals and


magneto

Recommended Posts

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 :)

Link to comment
Share on other sites

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())
  • Like 1
Link to comment
Share on other sites

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 by pezetko
  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

  • Like 1
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...