Delete All Hidden Objects

Problem I’m solving

Sometimes I want to delete every single hidden objects to save a cleaned file that only have visible stuff. I just want a way to do this though scripting so that I can programmatically using this.

Solution

This script, more like a code snippet, can delete all hidden objects.

Installation

  1. Simply just drag the script to the viewport to install.
  2. Right-click on the toolbar > Customize…
  3. Choose the tab ‘Toolbars’
  4. In the Category: dropdown, select ‘ManniiCode’
  5. Drag the script to the toolbar where ever you want!

Code

Macroscript (Maxscript)
macroscript DeleteAllHiddenObjects
	Category:"ManniiCode"
	toolTip:"Delete All Hidden Objects"
(
	delete (for obj in objects where obj.ishidden collect(obj))
)
Maxscript Snippet
delete (for obj in objects where obj.ishidden collect(obj))

Python
from pymxs import runtime as rt

rt.delete([x for x in rt.objects if x.ishidden == True])

Images