Main Problem
I work on some specific script which generated list - creates new CSV file and I try to attach information about name materials so name would fit to name of object.
I am pretty new in scripting so please help me understand that. I have found many similar topics, but I just can't use it as I need; (like material index name or number, or object data, or active material) :/
I try find that in internet, but I can't find like this. Closest to my need is:
context = bpy.context
mesh_objs = [ob for ob in context.selected_objects if ob.type == 'MESH']
for mesh in mesh_objs:
print("active_slot:", mesh.active_material)
And that generates this:
active_slot: <bpy_struct, Material("MaterialOne") at 0x000001EB95BE5008>
active_slot: <bpy_struct, Material("MaterialOne") at 0x000001EB95BE4A08>
active_slot: <bpy_struct, Material("MaterialOne") at 0x000001EB95BE5008>
active_slot: <bpy_struct, Material("MaterialTwo") at 0x000001EB95BE5008>
active_slot: <bpy_struct, Material("MaterialOne") at 0x000001EB95BE5008>
active_slot: <bpy_struct, Material("MaterialTwo") at 0x000001EB95BE5008>
But I need something like this (it can look different, this is no problem), for example:
- of course only selected Objects
- situation when you have more then 2 materials on slot 1, and on slot 2 is basically one or none
MaterialsList
Cube.001, MaterialOne and DiffrentMaterialOne
Cube.002, MaterialTwo and None
Cube.003, MaterialOne and None
Cube.004, MaterialTwo and None
Cube.005, MaterialOne and DiffrentMaterialOne
Cube.006, MaterialTwo and DiffrentMaterialOne
Let me know if it is possible.