# ***** BEGIN GPL LICENSE BLOCK ***** # # Copyright (C) 2024 Ilia Kurochkin # # Created by Ilia Kurochkin (brothermechanic) # contact: brothermechanic@yandex.com # # This is free software; # you can redistribute it and/or modify # it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # ***** END GPL LICENSE BLOCK ***** # # coding: utf-8 ''' DESCRIPTION. Blender scene from stratch. ''' __version__ = '0.1' import bpy def cleanup_orphan_data(): '''Removes all data without users''' 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) for block in bpy.data.collections: if block.users == 0: bpy.data.collections.remove(block) for block in bpy.data.cameras: if block.users == 0: bpy.data.cameras.remove(block) for block in bpy.data.lights: if block.users == 0: bpy.data.lights.remove(block) for block in bpy.data.scenes: if block.users == 0: bpy.data.scenes.remove(block)