Attachments

Hipfile

jamesr_displayintermediateresultsandvisualizationgeoupdate.hiplc

Overview

One thing I didn’t realize until after I posted the last blog post/video is that you can actually add an output with a negative index! This output won’t show up as a port on the node.

Negative Output Index

Negative Output Index

We can see this on the RBD Configure SOP. When we hit Enter in the viewport to enter the node’s Viewer State, we are switched to viewing the -1 output.

RBD Configure Negative Output

RBD Configure Negative Output

RBD Configure Contents

RBD Configure Contents

We can’t actually hook up to this output in the network editor, which could make this an excellent option since it causes less clutter!

Example

Let’s implement something similar ourselves. We’ll create a setup that takes some input geo and adds some point normals to it. It will have a couple of false-color visualization modes: Height and Normal.

When we switch our Display menu, if we select anything except the “final result” of the node let’s switch to showing the -1 output in the viewport (which will only be outputting the visualization geo).

  1. Open the hipfile and see the attached setup (or copy it from the screenshots):

    Example Overview

    Example Overview

    Example Contents

    Example Contents

  2. Create an Ordered Menu Parameter called display with the following token/value pairs:

    Menu Tokens

    Menu Tokens

  3. Don’t forget to link it up to your visualizer switch!

    Switch (minus one)

    Switch (minus one)

    We subtract 1 since we’re using index 0 of the menu to select our actual output geo, and if we didn’t subtract 1 our switch would be off by one.

  4. Add a callback to the menu parameter that will switch to the -1 output whenever we select one of the visualizer options.

    1
    
    kwargs["node"].setOutputForViewFlag(-1 if kwargs["script_value"] != "output" else 0)
    
    Menu Callback

    Menu Callback

And that’s it!