The metadata contains a dictionary mapping strings to values, and can be used to store additional custom data in the agent definition.
Methods ¶
__init__(filename, keep_external_ref = True)
Loads the metadata from the specified JSON file. Raises hou.OperationFailed if the file does not exist or otherwise cannot be loaded.
filename
A path to a JSON file.
keep_external_ref
A bool
indicating whether the external reference should be maintained when the agent is saved to a geometry file.
If the reference is maintained, then the JSON file needs to be available when the saved geometry is used (only the path to the JSON file is saved in the geometry file).
Otherwise, a copy of the metadata will be inlined when saving out the geometry so that the original file is no longer needed.
__init__(data)
Creates new metadata from the provided dictionary.
data
A dict
mapping strings to values.
asJSON()
→ str
Returns a string containing the JSON representation of the metadata.
data()
→ dict
of str
to value
Returns the metadata dictionary.
fileName(expanded = False)
→ str
If the metadata is an external reference, returns the path to the file on disk.
expanded
Specifies whether to expand any variables in the path, such as $HIP
.
freeze()
→ hou.AgentMetadata
Creates a modifiable copy of the metadata. The copy will not be marked as an external reference.
isExternalReference()
→ bool
Returns a bool
indicating whether the metadata references a file on disk.
isReadOnly()
→ bool
Return a bool
indicating whether the metadata is read-only.
setData(data)
Replaces the metadata dictionary. Raises hou.GeometryPermissionError if the metadata is not modifiable.
data
A dict
mapping strings to values.
See also |