REmove blender material

 avatar
unknown
python
13 days ago
595 B
3
Indexable
import bpy

# Function to remove all materials from the selected objects
def remove_materials_from_selected():
    # Loop through all selected objects
    for obj in bpy.context.selected_objects:
        # Check if the object has material slots
        if obj.type == 'MESH' and obj.data.materials:
            # Remove all materials from the object's material slots
            obj.data.materials.clear()
            print(f"Removed materials from {obj.name}")

# Call the function
remove_materials_from_selected()

# Optional: Update the scene
bpy.context.view_layer.update()
Editor is loading...
Leave a Comment