I'm writing a exporter, and I have most of it already working, the missing piece now is to export the texture maps properly. I'm having trouble understanding how I can fetch those with python.
I have written custom nodes in c, and the export routine is currently written in python.
My current material export works fine, color \ float values and all that works, but as soon as I assign a texture into a color slot I'm having trouble accessing that texture.
So, my question is this:
How can I loop through each parameter in a material node, check the parameter by name (if I'm looking for a specific one), then check if a texture is assigned to that parameter?
Take for example the 'kd' slot here:
The kd color parameter I fetch like this:
nodes = mat.node_tree.nodes r = nodes["Matte"].inputs.default_value g = nodes["Matte"].inputs.default_value b = nodes["Matte"].inputs.default_value
And I know using the name 'matte' there is wrong, what I would like is to get the name of the 'class' of material - then check if the material is of type 'matte', instead of relying on the name. (only way I can explain it, I come from 16 years of 3dsmax, and that's one way of checking there when you write scripts). So a pointer on that too would be nice.
And now I have my next question - how can I check if a texture map is assigned like this on that parameter:
I would like to get that texture info (file path) if a texture is assigned to it.