Skip to content

Instantly share code, notes, and snippets.

@p2or
Last active May 21, 2023 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save p2or/7a543dd8cb3cc535d6a382d464391008 to your computer and use it in GitHub Desktop.
Save p2or/7a543dd8cb3cc535d6a382d464391008 to your computer and use it in GitHub Desktop.
Del Save Reopen #Blender
# http://blender.stackexchange.com/q/75310/3710
import bpy
# select all mesh objects
for o in bpy.data.objects:
if o.type == 'MESH':
o.select = True
else:
o.select = False
# call the operator one time
bpy.ops.object.delete()
# save and re-open to clean up the data blocks
bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)
bpy.ops.wm.open_mainfile(filepath=bpy.data.filepath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment