Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active September 1, 2016 10:49
Show Gist options
  • Save zeffii/c8ae734d12fe8547dfa1a2aa9f26c4b6 to your computer and use it in GitHub Desktop.
Save zeffii/c8ae734d12fe8547dfa1a2aa9f26c4b6 to your computer and use it in GitHub Desktop.
hard wipe mesh / objects from blender scene
import bpy
def remove_obj_and_mesh(context):
scene = context.scene
objs = bpy.data.objects
meshes = bpy.data.meshes
for obj in objs:
if obj.type == 'MESH':
if obj.name in scene.objects:
scene.objects.unlink(obj)
else:
print(obj.name, 'was previously unlinked from scene')
obj.user_clear()
objs.remove(obj, do_unlink=True)
for mesh in meshes:
meshes.remove(mesh)
remove_obj_and_mesh(bpy.context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment