Purge Orphans by Data Type

Made a little quality of life add-on to fix one of the most annoying things for me in Blender. Removing userless data (images, material, etc. with 0 next to the name) is a pain. You either have to restart .blend file to get rid of them or use blenders default Purge/Clean Up button that deletes absolutely every unused data.

The first method is painstaking, second is extremely risky because if you just want to get rid of unused materials that are cluttering your lists, you might accidentally delete actions, mesh data, or images you need but didn’t know were userless, or without fake user.

So to save my time and sanity I wrote this simple code. It adds a button in the Outliner header, which lets you select which data type you want to purge. Simple as. Similar add-on maybe already done, but I couldn’t find it, and if you need it (you do), I’m sharing this for free on Gumroad

Changelog:
1.1.

  • Buttons are inactive (greyed out) if there is no orphan data for that data type
  • After the operation text is printed in the info displaying a number of orphans purged
  • Viewer Node, which is considered orphaned image in Blender won’t be purged or counted by the add-on. (Deleting Viewer Node doesn’t harm anything, it’s just annoying)
  • Included bug tracker link that redirects to this page
5 Likes

Thank you for this convenient add-on. :+1:

Do you think it would be possible to make data types labels (Image, Material, Nodre Tree, … Text, Font) greyed out if not available ?

Also, may I suggest to add extra buttons (Documentation, Report a bug) in the Add-on Preferences?

bl_info = {
    "name": "Purge by Type",
    "author": "Nika Kutsniashvili (nickberckley)",
    "version": (1, 0),
    "blender": (3, 4, 0),
    "location": "Outliner Header",
    "description": "Purge orphaned data by type",
    "doc_url": "https://nickberckley.gumroad.com/l/purge", 
    "tracker_url": "https://blenderartists.org/t/purge-orphans-by-data-type/1448384", 
    "category": "Utilities"
}
2 Likes

That’s a good idea, I’ll look into it.

I’ll also add documentation/tracker url that’ll refer to this topic

1 Like

I took @xan2622’s suggestion and updated the addon to 1.1

  • Buttons are inactive (greyed out) if there is no orphan data for that data type
  • After the operation text is printed in the info displaying a number of orphans purged
  • Viewer Node, which is considered orphaned image in Blender won’t be purged or counted by the add-on. (Deleting Viewer Node doesn’t harm anything, it’s just annoying)
  • Included bug tracker link that redirects to this page
1 Like

Thank you for the 1.1 update, Nika.
If I run Blender in command line, I can notice a warning while Blender is launching:

Warning: ‘OUTLINER_PT_purge_by_type’ does not contain ‘MT’ with prefix and suffix

I tried to recreate the error but it works fine for me. I’m assuming you’re working on either Mac or Linux, cause I have windows.

Try this file, will you? I just changed OUTLINER_PT to OUTLINER_MT, let’s see if it works

You fixed the “issue”. I don’t see the warning anymore.

1 Like

Forgot to post it here, I’ve updated this add-on quite a lot and uploaded it on BlenderMarket, I call it Deep Clean because it incorporates other features besides data type purging, better UI also. I plan on updating this to add third batch of features and I’ll make separate post for it then.

It’s been selling well considering everything and I’m glad people find this feature useful, I use this on hourly basis almost