fileReferences(project_dir_variable='HIP', include_all_refs=true)
→ tuple
of hou.Parm and str
tuples
Returns a sequence of tuples representing all references to external files (such as textures, geometry files, and asset libraries) in the current scene.
The first item in each tuple is a hou.Parm object representing the parameter containing the file reference, and the second item is the path string. (The second item is a convenience; you can get the same string by calling Parm.unexpandedString()
.)
This can be useful when “preflighting”, to check that there are no references to files outside $HIP
.
import os hipdir = os.environ["HIP"] for parm, path in hou.fileReferences(): # Assume you have a function to check if one path is the descendant # of another path if not is_inside(hipdir, path): print("Problem: path %s is not inside the project dir %s" % (path, hipdir)
(The sequence does not include default images and geometry files from inside Houdini’s install location, for example default.bgeo
in a File SOP.)
project_dir_variable
You can specify the name of an environment variable. If an asset path starts with the variable, it will be replaced with a variable reference in the path string returned by this function.
For example, if $JOB
is /mnt/projects/
and an asset is in /mnt/projects/tool.hda
, if you call hou.fileReferences("JOB")
, it will return the path as $JOB/tool.hda
.
include_all_refs
If this is True, then the function will return all the file references. If this is False, then the function will return only the selected file references.