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