Copy link to clipboard
Copied
Hi all,
I was wondering if it's possible to script an Image to Material pipeline using the Command Line Tools/Automation Toolkit or the Sampler Python API?
Thanks,
Ryan
Hello, @ryangold333 !
I had the same issue. You can write this functionin your script in pycharm and save it as the .py file. Then import to the Sampler Edit->Preferences-> Plugins and Scripts.
def image_to_material_batch(folder_path):
for file in os.listdir(folder_path):
#here you can define texture format to avoid importing unnecessary files
if file.endswith(".png"):
image_path_list = [os.path.join(folder_path, file)]
asset_name = os.path.basename(file
...
Copy link to clipboard
Copied
Hello, @ryangold333 !
I had the same issue. You can write this functionin your script in pycharm and save it as the .py file. Then import to the Sampler Edit->Preferences-> Plugins and Scripts.
def image_to_material_batch(folder_path):
for file in os.listdir(folder_path):
#here you can define texture format to avoid importing unnecessary files
if file.endswith(".png"):
image_path_list = [os.path.join(folder_path, file)]
asset_name = os.path.basename(file).split('.')[0]
asset = ssa.create_asset(asset_name, ssa.material)
asset.import_images(image_path_list, 0, ssa.image_to_material_AI_powered, False)
Copy link to clipboard
Copied
Of course you will then need to run this function and define your directory. I used project file dir. After importing script to Sampler you just run it from the top menu and it should work.
Copy link to clipboard
Copied
Hey thanks so much! That's what I needed 🙂