Q100496: How to add a red error glow around a node using Python to flag an error

Follow


SUMMARY

When creating custom node types, for example, with SuperTools or NodeTypeBuilder-based node types, users may wish to add a red error glow around their node to indicate if there is an issue that might be preventing the node from working correctly (for example, a missing input connection or plug-in that hasn’t been found).

This article demonstrates the API functions used to add this error glow to a node.

MORE INFORMATION

The red glow that typically indicates errors with particular nodes in Katana's Node Graph tab can be controlled using the UI4.Util.NodeErrors Python module.

Given a particular node:

node = NodegraphAPI.GetNode('GafferThree')

Apply the red glow:

UI4.Util.NodeErrors.SetNodeError(node, 'Something is wrong.')

The second parameter is an error message that can be viewed by pressing the T key (for Tooltip) while pointing at the node in the Node Graph tab:

Upload_KB_Q100496.png

To remove the red glow:

UI4.Util.NodeErrors.ClearNodeError(node)

This could be used in custom node types like SuperTools to indicate to users that something went wrong with a particular node, for example, after performing some operation when clicking a button in the SuperTool's parameter interface.

 

FURTHER READING

More info about creating custom node types:

Groups, Macros, and SuperTools in the Katana User Guide

Customizing Node Types in the Katana Developer Guide

More info about customizing the look of nodes in the Node Graph tab using Python:

Node Properties in the Katana Developer Guide
Q100108: How to add custom menu items to the context menu of nodes
Q100277: How to create and position new nodes via Python

 

If you are encountering any issues with the information above, then please open a Support ticket and let us know the issue you are encountering and the troubleshooting steps you have taken so far.

For more information on how to open a Support ticket, please refer to Q100064: How to raise a support ticket.

 

    We're sorry to hear that

    Please tell us why