Parameter Hints

Parameter hints are arbitrary metadata, most commonly used to tell the user interface what a parameter contains. For example, add a string parameter to represent a file path to an asset, and use a hint to tell Katana to use the asset browser widget for that parameter:

# Get root level
rootNode = NodegraphAPI.GetRootNode()

# Create a PrimitiveCreate node at root level
primNode = NodegraphAPI.CreateNode('PrimitiveCreate', rootNode)

# Get the root parameter of the PrimitiveCreate node
rootParam = primNode.getParameters()

# Add a new parameter of type string
pathParam = rootParam.createChildString("yourFilePath", "yourFile.txt")

# Tell Katana to use the assetIdInput widget to represent this parameter
hints = {'widget': 'assetIdInput'}
pathParam.setHintString(repr(hints))

Or, to add a string parameter as a dropdown menu:

# Add a new parameter of type string
dropdownParam = rootParam.createChildString("yourDropdown", "yourDefaultValue")

# Tell Katana to use the pop-up widget
# and fill out the menu values
hints = {'widget': 'popup', 'options': ['a', 'b', 'c']}
dropdownParam.setHintString(repr(hints))
Parameter.getHintString() → str

Return a parameter’s hint string – or an empty string on absence

Parameter.setHintString(value)

Set the parameter’s hint string.