COP file node, load by filePattern?

   82   1   1
User Avatar
Member
1 posts
Joined: Sept. 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: Dec. 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)

www.JKCompany.org
info@JKCompany.org

Rabiee.Sadjad@Gmail.Com
  • Quick Links