File pattern - Specific files selection

   1656   8   1
User Avatar
Member
385 posts
Joined: July 2018
Offline
i'd like to use File Pattern TOP to select specific files from a folder, there is no pattern though, no similarities in naming.
Something like a multi parm menu would be super useful. Is there a way to do this with another node or do i have to built it myself?
Maybe File pattern is not the only node that reads files from disk?
User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
Pattern allows wild cards such as ? (match any character), * (match any string of characters), and (match any one of the characters inside the square brackets). For example, *.png matches any file that ends with .png. But I don't think it's going to be flexible.
You can first read all the files from the disc using the *.extension template, and then filter the desired files using Filter by Expression.
User Avatar
Member
385 posts
Joined: July 2018
Offline
alexwheezy
You can first read all the files from the disc using the *.extension template, and then filter the desired files using Filter by Expression.
how can i filter based on specific files? i'd like to have a controller where i select the specific files so filter would have to read the filepaths from the controller and keep only those, discard the rest workitems

i have made an attempt here but this has to be automated somehow. maybe python?

Attachments:
File Pattern.zip (210.7 KB)

User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
Then we can consider 2 more options to solve this problem.
Use Filter by Attribute or Labs Filter by Value, which is actually written in Python Script.

https://www.sidefx.com/docs/houdini/nodes/top/labs--filter_by_value-1.1.html [www.sidefx.com]

Attachments:
Screenshot_2024-03-23_18-46-08.png (102.6 KB)

User Avatar
Member
385 posts
Joined: July 2018
Offline
alexwheezy
Use Filter by Attribute or Labs Filter by Value, which is actually written in Python Script.
where are you creating the attribute though? can you share a file please?
User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
The File Pattern node knows how to create attributes from a path such as directory, filename, extension.

https://www.sidefx.com/docs/houdini/nodes/top/filepattern.html [www.sidefx.com]
User Avatar
Member
385 posts
Joined: July 2018
Offline
Problem with this method is that for the labs tool you have to use python to add values automatically to the filter as you are adding more files in the controller null.
Edited by papsphilip - March 23, 2024 13:02:48

Attachments:
File Pattern.zip (182.4 KB)

User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
Why not use the Labs Filter by Value node itself as a control node? It seems that so far there is no problem to replace it.

All I've changed here is a setting in the asset that allows you to select files on disk rather than populate a line, then you don't have to create a new layer of data indirection and avoid the hassle of writing code.
Edited by alexwheezy - March 24, 2024 01:22:24

Attachments:
Screenshot_2024-03-24_07-34-19.png (47.9 KB)

User Avatar
Member
385 posts
Joined: July 2018
Offline
thanks @alexwheezy! Here is the asset for anyone interested.

Attachments:
filter_file_selection.1.0.hdalc (11.8 KB)

  • Quick Links