COP file node, load by filePattern?

   2707   1   1
User Avatar
Member
1 posts
Joined: 9月 2019
Offline
I'd love to auto-detect and load texture files when creating materials. I often have a subfolder with 4 files: diffuse, specular, roughness, and normal- and they're named with a pattern. Is there a way to have the cop file node automatically detect the (*_roughness.png) file if I tell it the directory to look in?

In a perfect world, I'd love to make an HDA with an exposed folder location: I tell it the subfolder, it makes a material out of the png maps inside. Is this possible? Thanks!
User Avatar
Member
1391 posts
Joined: 12月 2010
Offline
Hi

You can use below python script for doing this :


import glob
subF = "PATH to SUBFOLDER"
file = subF + "*_spec.jpg" #PATTERN
a = glob.glob(file) # SEARCH FOR FILE
return a[0] # RETURN FULL PATH OF THE FILE



check attached project

Attachments:
JKCOP_File.hip (54.5 KB)

https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
  • Quick Links