Adding the “Purge” button to the 3D Viewport header in Blender

Pressing the “Purge” button cleans the current open scene – removes all unused objects from it (mesh, nodes, materials, textures, etc.). However, this button is located very inconveniently, in the Outliner header and is visible only in the “Orphan Data” Outliner mode. For quick access to this button we can move it to the header of the 3D Viewport.

Clicking on the “Purge” button invokes the “outliner.orphans_purge” operator.

Let’s write a function for drawing a button that will call this operator:

And add this function to the header of the 3D Viewport area:

Full code:

After executing this code in the Text Editor, a “Purge” button will be added to the 3D Viewport header. Pressing it will call the removal of unused objects in the same way as from the Outliner.

0 0 votes
Article Rating
Notify of
0 Comment
Inline Feedbacks
View all comments