Created
December 8, 2020 14:36
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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