This module provides functions for accessing and managing style sheets that are stored in the hip file as text strings in JSON format. These style sheets can be saved into IFD files generated by the /hom/hou/mantra.html ROP.
Functions ¶
hasStyle(name)
→ bool
Returns true if there is a style with the specified name.
styles()
→ tuple of str
Return a tuple containing the names of all styles in the style manager.
description(name)
→ str
Returns the description associated with the named style. If there is no style with the provided name, an empty string is returned.
stylesheet(name)
→ str
Returns the style sheet text associated with the named style. If there is no style with the provided name, an empty string is returned.
errors(name)
→ str
Returns any error messages generated while parsing the named style. If there is no style with the provided name, an empty string is returned.
addStyle(name, description, stylesheet)
Create a new named style. If a style sheet with the supplied name already exists, it will be overwritten with the new values.
name
A unique name that will be used to identify the style sheet. Follows the same naming limitations as node names (no spaces, no slashes, etc).
description
An arbitrary string that can optionally be used to identify the purpose of this style sheet.
stylesheet
The style sheet definition expressed as a string in JSON format.
renameStyle(old_name, new_name)
Changes the name of an existing style sheet. If there is no style with the provided old_name, or there is already a style with the provided new_name, an exception will be generated. References to this style sheet in the hip file will be automatically updated to refer to the new name.
reorderStyles(names)
Changes the order of the style sheets defined in the hip file. This order
determines the order of the style names returned by the styles
function.
This in turn may affect the final material assignments in a mantra render,
since priority is given to style sheets listed last in the Apply Style
Sheets parameter of the /hom/hou/mantra.html ROP.
names
A tuple of strings which must contain exactly the same set of strings
returned by the styles
function, but in a different order. If the
set of strings do not match, this function raises a ValueError.
removeStyle(name)
Deletes an existing style sheet.
removeAll()
Deletes all existing style sheets.