Skip to content

Instantly share code, notes, and snippets.

@kerenskybr
Created December 8, 2020 14:36
Show Gist options
  • Save kerenskybr/f6343346e4bdb7bc876d1a6fd54ccabf to your computer and use it in GitHub Desktop.
Save kerenskybr/f6343346e4bdb7bc876d1a6fd54ccabf to your computer and use it in GitHub Desktop.
Function to clean all data created in runtime to free memory (blender script)
def clean_blocks():
for block in bpy.data.meshes:
if block.users == 0:
bpy.data.meshes.remove(block)
for block in bpy.data.materials:
if block.users == 0:
bpy.data.materials.remove(block)
for block in bpy.data.textures:
if block.users == 0:
bpy.data.textures.remove(block)
for block in bpy.data.images:
if block.users == 0:
bpy.data.images.remove(block)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment