Unlike the hou.styles module, the style sheets represented by this class are not saved anywhere. They are parsed style sheets that can be evaluated for particular objects and geometry. This allows you to debug the operation of your style sheets outside of mantra. It also allows building SOPs which evaluate style information to apply it to a more specific target.
Methods ¶
__init__()
Creates a new empty StyleSheet.
__init__(json_text)
Creates a new StyleSheet from the provided string in JSON format.
clone()
→ hou.StyleSheet
Makes an identical copy of an existing style sheet object.
cloneWithObject(object)
→ hou.StyleSheet
Makes a copy of an existing style sheet object which contains only the styling information that applies to the provided hou.ObjNode.
cloneWithPrim(prim)
→ hou.StyleSheet
Makes a copy of an existing style sheet object which contains only the styling information that applies to the provided hou.Prim.
cloneWithShape(shape_name, prim)
→ hou.StyleSheet
Makes a copy of an existing style sheet object which contains only the styling information that applies to the named shape in the provided crowd agent hou.PackedPrim.
cloneWithAddedStyleSheet(stylesheet, target)
→ hou.StyleSheet
Makes a copy of an existing style sheet object combined with another style sheet object. The added styles are given a lower priority than the styles already in the style sheet. In addition, a target argument can be provided which is a JSON formatted string describing a target condition which must be satisfied in order for the added styles to be applied. This function can therefore be used to build an object level style sheet by combining per-primitive style sheets from the object’s geometry.
errors()
→ str
Returns any errors generated while parsing the style sheet. If there are
no errors, an empty string is returned. For style sheet objects returned
from any of the cloneWith
methods, the returned string will always be
empty.
asJSON()
→ str
Returns a string containing the JSON that represents the style sheet. If the style sheet was constructed from a string argument, the original string will be returned even if there were parsing errors. If this style sheet was cloned with a specific target, the JSON string is generated from the style information that applies to that target.