How to load a texture file into the base color shader of a node (Iray) (SOLVED)
3djoji
Posts: 1,092
I have one geometry which is splited into a great number of textured elements. Instead of loading one by one the textures of these elements, I write a little script which can do it automatically, based on a text description. I'm able to choose and retreive the node and/up to the material to work with but when I search the property of the material using the material.findProperty("Base Color"), it doesn't give any property.value and I'm not able to use the property.set value or Mat instruction.
Is there a simple way to load a texture file name into the "Base color" or any other property of that Iray shader?
Post edited by 3djoji on
Comments
Check that the name is right - click the gear on the slider, Parameter Settings, and copy the name from there.
Thank you, it helps because the name, in that case is different than the label
When I search the Property by name, should I include the path? For instance should I write
property = material.findProperty("Diffuse Color"); or property = material.findProperty("Base/Diffuse/Reflection/Diffuse Color");
In both case, I get an error of my next script line : property.setMat(mat_name); // mat_name is the absolute path of the texture file
Use the:
if you wanna load a single map that is NOT a layered image(.jpg, .png etc). Or:
if you wanna load a material preset (file.duf file)
This may help you!
Rob has a relevant sample script here http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/material_properties/start
oki, thank you so much, I learn a lot and never find out what's going on until... I read MikeD post once again and.. so sorry, I'm stupid, I forget to concatenate the file extension... lol, it is always like that. But I read and change some part of my code, it was really a great lesson.