Custom Node: Pattern Filemerge
I recently ran into a situation where I needed to load a bunch of geometry data from multiple files, but the filenames did not match the required pattern for using the filemerge node. With this node, each file must match the pattern “some_string_SLICE” where SLICE is a unique index. I decided to write my own filemerge node that uses a python glob pattern matcher instead.
The node itself is fairly simple: it just scans through files in the specified directory and creates a point attribute for each matching file. Then, it runs a foreach node loop and loads each file.

Here’s the python for matching the files:
import glob
import os
node = hou.pwd()
parent = node.parent()
geo = node.geometry()
root_directory = parent.evalParm('root_dir')
filepattern = parent.evalParm('filepattern')
attribute_name = parent.evalParm('path_attribute_name')
if (root_directory and filepattern and attribute_name):
geo.addAttrib(hou.attribType.Point, attribute_name, "")
files = glob.glob(filepattern, root_dir=root_directory, recursive=True)
for filename in files:
full_path = os.path.join(root_directory, filename)
new_point = geo.createPoint()
new_point.setAttribValue(attribute_name, full_path)