1 2 3 4 5 6 7 8 9 10 11 12 | import bpy print("*****************") print("This Loop Trough Multi Materials") selection = bpy.context.object print("SELECTED OBJECT: "+selection.name) index = -1 for m in selection.material_slots: index += 1 bpy.context.object.active_material_index=index mat = bpy.context.object.active_material print(mat) |
mercredi 26 juin 2019
Blender code: loop by index
Inscription à :
Publier les commentaires (Atom)
In python, there is also 'enumerate' that allows not to count index by hand, for ex :
RépondreSupprimerfor index, m in enumerate(selection.material_slots):
...