Skip to content

Instantly share code, notes, and snippets.

@CGArtPython
Created September 25, 2024 06:52
Show Gist options
  • Save CGArtPython/3951a2aba0b14ef1b4090e5c8ad516dd to your computer and use it in GitHub Desktop.
Save CGArtPython/3951a2aba0b14ef1b4090e5c8ad516dd to your computer and use it in GitHub Desktop.
Save only a material into a blend file
import bpy
# Specify the material name
material_name = "ExportThisMaterial"
# Get the material from the current blend file
material = bpy.data.materials.get(material_name)
if material:
# add only the material to the blend new file
bpy.data.libraries.write(filepath="E:\\tmp\\material.blend", datablocks={material})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment