I am working on a project with mesh created with photogrammetry (mainly). Once the mesh is imported, I would like to apply through scripts different materials before render them. But
- Sometimes, I use meshes with vertex color as color data, and they don't have any material's slot and I can't apply directly a material
- Sometimes, I use meshes with textures, and UV's are dispatched in several slots... so i need to fill every slot with a material
I would like to write something like this in Python:
for "material_slot" of selected object
if there is no material_slot
bpy.ops.object.material_slot_add()
if there is only 1 slot and more
do nothing
for every slot of selected object
apply material "demoMat"
I am not fluent in Python grammar, and don't know how to write this. Here is the documentation I found about material_slot management...
Thank you for your help :)