Skip to content

Instantly share code, notes, and snippets.

@giangm9
Last active April 10, 2021 08:39
Show Gist options
  • Save giangm9/5b2bdbf9ab07b3e5b538e948dd845390 to your computer and use it in GitHub Desktop.
Save giangm9/5b2bdbf9ab07b3e5b538e948dd845390 to your computer and use it in GitHub Desktop.

Append data from other blender files (example material)

with bpy.data.libraries.load(MATERIAL_LIBRARY_FILE) as (data_from, data_to):
    data_to.materials = data_from.materials

for mat in templateMat:
    materialList.append(mat.name)

remove all materials

import bpy
for material in bpy.data.materials:
    material.user_clear()
    bpy.data.materials.remove(material)
@giangm9
Copy link
Author

giangm9 commented Apr 10, 2021

Assign mesh sequence cache

def assign_abc(obj):
    for child in obj.children:
        child.modifiers.clear()
        mod = child.modifiers.new("MeshSequenceCache", "MESH_SEQUENCE_CACHE")
        mod.cache_file = bpy.data.cache_files['Girl.abc']
        
        for path in mod.cache_file.object_paths:
            if child.name in path.path:
                mod.object_path = path.path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment