Created
March 26, 2012 11:08
-
-
Save zeffii/2204464 to your computer and use it in GitHub Desktop.
how_to_sanitize_a_blend
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
import bpy | |
#unselect everything | |
# <insert code here, this can vary depending on your situation> | |
# bpy.ops.object.select_all() | |
# gather list of items of interest. | |
candidate_list = [item.name for item in bpy.data.objects if item.type == "MESH"] | |
# select them only. | |
for object_name in candidate_list: | |
bpy.data.objects[object_name].select = True | |
# remove all selected. | |
bpy.ops.object.delete() | |
# remove the meshes, they have no users anymore. | |
for item in bpy.data.meshes: | |
bpy.data.meshes.remove(item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment