Hello!
How do you delete items from memory that were created via python and no longer needed?
Especially those two:
- Bezier curves (bpy.data.curves)
- Shape keys (bpy.data.shape_keys.values())
They stay even if the users have been deleted until I restart blender.
Cheers
Oh, just found this useful script:
import bpy
def cleanMemory( meshes = True, curves = True , materials = True ):
n = 0
if meshes:
for datablock in bpy.data.meshes:
if datablock.users==0:
bpy.data.meshes.remove(datablock)
n += 1
if curves:
for datablock in bpy.data.curves:
if datablock.users==0:
bpy.data.curves.remove(datablock)
n += 1
if materials:
for datablock in bpy.data.materials:
if datablock.users==0:
bpy.data.materials.remove(datablock)
n += 1
print("cleanMemory removed %i data blocks" % (n))
return(n)
cleanMemory()
Just don’t know how to implement shape keys right now…